. */ use Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition; use Fisharebest\Webtrees\SurnameTradition\SurnameTraditionInterface; /** * Test harness for the class PatrilinenalSurnameTradition */ class PatrilinealSurnameTraditionTest extends \PHPUnit_Framework_TestCase { /** @var SurnameTraditionInterface */ private $surname_tradition; /** * Prepare the environment for these tests */ public function setUp() { $this->surname_tradition = new PatrilinealSurnameTradition; } /** * Test whether married surnames are used */ public function testMarriedSurnames() { $this->assertSame(false, $this->surname_tradition->hasMarriedNames()); } /** * Test whether surnames are used */ public function testSurnames() { $this->assertSame(true, $this->surname_tradition->hasSurnames()); } /** * Test new son names */ public function testNewSonNames() { $this->assertSame( array('NAME' => '/White/', 'SURN' => 'White'), $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'M') ); } /** * Test new daughter names */ public function testNewDaughterNames() { $this->assertSame( array('NAME' => '/White/', 'SURN' => 'White'), $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'F') ); } /** * Test new child names */ public function testNewChildNames() { $this->assertSame( array('NAME' => '/White/', 'SURN' => 'White'), $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'U') ); } /** * Test new child names */ public function testNewChildNamesWithSpfx() { $this->assertSame( array('NAME' => '/de White/', 'SPFX' => 'de', 'SURN' => 'White'), $this->surname_tradition->newChildNames('John /de White/', 'Mary /van Black/', 'U') ); } /** * Test new child names */ public function testNewChildNamesWithNoParentsNames() { $this->assertSame( array('NAME' => '//'), $this->surname_tradition->newChildNames('', '', 'U') ); } /** * Test new father names */ public function testNewFatherNames() { $this->assertSame( array('NAME' => '/White/', 'SURN' => 'White'), $this->surname_tradition->newParentNames('John /White/', 'M') ); } /** * Test new mother names */ public function testNewMotherNames() { $this->assertSame( array('NAME' => '//'), $this->surname_tradition->newParentNames('John /White/', 'F') ); } /** * Test new parent names */ public function testNewParentNames() { $this->assertSame( array('NAME' => '//'), $this->surname_tradition->newParentNames('John /White/', 'U') ); } /** * Test new husband names */ public function testNewHusbandNames() { $this->assertSame( array('NAME' => '//'), $this->surname_tradition->newSpouseNames('Mary /Black/', 'M') ); } /** * Test new wife names */ public function testNewWifeNames() { $this->assertSame( array('NAME' => '//'), $this->surname_tradition->newSpouseNames('John /White/', 'F') ); } /** * Test new spouse names */ public function testNewSpouseNames() { $this->assertSame( array('NAME' => '//'), $this->surname_tradition->newSpouseNames('Chris /Green/', 'U') ); } }