. */ use Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition; use Fisharebest\Webtrees\SurnameTradition\SurnameTraditionInterface; /** * Test harness for the class PaternalSurnameTradition */ class PaternalSurnameTraditionTest extends \PHPUnit\Framework\TestCase { /** @var SurnameTraditionInterface */ private $surname_tradition; /** * Prepare the environment for these tests */ public function setUp() { $this->surname_tradition = new PaternalSurnameTradition; } /** * Test whether married surnames are used * * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition */ public function testMarriedSurnames() { $this->assertSame(true, $this->surname_tradition->hasMarriedNames()); } /** * Test whether surnames are used * * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition */ public function testSurnames() { $this->assertSame(true, $this->surname_tradition->hasSurnames()); } /** * Test new son names * * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition */ public function testNewSonNames() { $this->assertSame( ['NAME' => '/White/', 'SURN' => 'White'], $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'M') ); } /** * Test new daughter names * * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition */ public function testNewDaughterNames() { $this->assertSame( ['NAME' => '/White/', 'SURN' => 'White'], $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'F') ); } /** * Test new child names * * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition */ public function testNewChildNames() { $this->assertSame( ['NAME' => '/White/', 'SURN' => 'White'], $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'U') ); } /** * Test new child names * * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition */ public function testNewChildNamesWithSpfx() { $this->assertSame( ['NAME' => '/de White/', 'SPFX' => 'de', 'SURN' => 'White'], $this->surname_tradition->newChildNames('John /de White/', 'Mary /van Black/', 'U') ); } /** * Test new child names * * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition */ public function testNewChildNamesWithMultipleSpfx() { $this->assertSame( ['NAME' => '/van der White/', 'SPFX' => 'van der', 'SURN' => 'White'], $this->surname_tradition->newChildNames('John /van der White/', 'Mary /van Black/', 'U') ); } /** * Test new child names * * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition */ public function testNewChildNamesWithDutchSpfx() { $this->assertSame( ['NAME' => '/\'t White/', 'SPFX' => '\'t', 'SURN' => 'White'], $this->surname_tradition->newChildNames('John /\'t White/', 'Mary /van Black/', 'U') ); $this->assertSame( ['NAME' => '/’t White/', 'SPFX' => '’t', 'SURN' => 'White'], $this->surname_tradition->newChildNames('John /’t White/', 'Mary /van Black/', 'U') ); } /** * Test new child names * * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition */ public function testNewChildNamesWithMultipleDutchSpfx() { $this->assertSame( ['NAME' => '/van \'t White/', 'SPFX' => 'van \'t', 'SURN' => 'White'], $this->surname_tradition->newChildNames('John /van \'t White/', 'Mary /van Black/', 'U') ); $this->assertSame( ['NAME' => '/van ’t White/', 'SPFX' => 'van ’t', 'SURN' => 'White'], $this->surname_tradition->newChildNames('John /van ’t White/', 'Mary /van Black/', 'U') ); } /** * Test new father names * * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition */ public function testNewFatherNames() { $this->assertSame( ['NAME' => '/White/', 'SURN' => 'White'], $this->surname_tradition->newParentNames('John /White/', 'M') ); } /** * Test new mother names * * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition */ public function testNewMotherNames() { $this->assertSame( ['NAME' => '//', '_MARNM' => '/White/'], $this->surname_tradition->newParentNames('John /White/', 'F') ); } /** * Test new parent names * * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition */ public function testNewParentNames() { $this->assertSame( ['NAME' => '//'], $this->surname_tradition->newParentNames('John /White/', 'U') ); } /** * Test new husband names * * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition */ public function testNewHusbandNames() { $this->assertSame( ['NAME' => '//'], $this->surname_tradition->newSpouseNames('Mary /Black/', 'M') ); } /** * Test new wife names * * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition */ public function testNewWifeNames() { $this->assertSame( ['NAME' => '//', '_MARNM' => '/White/'], $this->surname_tradition->newSpouseNames('John /White/', 'F') ); } /** * Test new wife names * * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition */ public function testNewWifeNamesWithSpfx() { $this->assertSame( ['NAME' => '//', '_MARNM' => '/van der White/'], $this->surname_tradition->newSpouseNames('John /van der White/', 'F') ); } /** * Test new spouse names * * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition */ public function testNewSpouseNames() { $this->assertSame( ['NAME' => '//'], $this->surname_tradition->newSpouseNames('Chris /Green/', 'U') ); } }