1323788f4SGreg Roach<?php 2323788f4SGreg Roach 3323788f4SGreg Roach/** 4323788f4SGreg Roach * webtrees: online genealogy 5*6bdf7674SGreg Roach * Copyright (C) 2017 webtrees development team 6323788f4SGreg Roach * This program is free software: you can redistribute it and/or modify 7323788f4SGreg Roach * it under the terms of the GNU General Public License as published by 8323788f4SGreg Roach * the Free Software Foundation, either version 3 of the License, or 9323788f4SGreg Roach * (at your option) any later version. 10323788f4SGreg Roach * This program is distributed in the hope that it will be useful, 11323788f4SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of 12323788f4SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13323788f4SGreg Roach * GNU General Public License for more details. 14323788f4SGreg Roach * You should have received a copy of the GNU General Public License 15323788f4SGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>. 16323788f4SGreg Roach */ 17323788f4SGreg Roachuse Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition; 18323788f4SGreg Roachuse Fisharebest\Webtrees\SurnameTradition\SurnameTraditionInterface; 19323788f4SGreg Roach 20323788f4SGreg Roach/** 21323788f4SGreg Roach * Test harness for the class SpanishSurnameTradition 22323788f4SGreg Roach */ 23db7d25eeSGreg Roachclass PolishSurnameTraditionTest extends \PHPUnit_Framework_TestCase { 24323788f4SGreg Roach /** @var SurnameTraditionInterface */ 25323788f4SGreg Roach private $surname_tradition; 26323788f4SGreg Roach 27323788f4SGreg Roach /** 28323788f4SGreg Roach * Prepare the environment for these tests 29323788f4SGreg Roach */ 30323788f4SGreg Roach public function setUp() { 31323788f4SGreg Roach $this->surname_tradition = new PolishSurnameTradition; 32323788f4SGreg Roach } 33323788f4SGreg Roach 34323788f4SGreg Roach /** 35323788f4SGreg Roach * Test whether married surnames are used 3617d74f3aSGreg Roach * 3717d74f3aSGreg Roach * @covers Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 3873d4df56SGreg Roach * @covers Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 39323788f4SGreg Roach */ 40323788f4SGreg Roach public function testMarriedSurnames() { 41323788f4SGreg Roach $this->assertSame(true, $this->surname_tradition->hasMarriedNames()); 42323788f4SGreg Roach } 43323788f4SGreg Roach 44323788f4SGreg Roach /** 45c1ec7145SGreg Roach * Test whether surnames are used 4617d74f3aSGreg Roach * 4717d74f3aSGreg Roach * @covers Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 4873d4df56SGreg Roach * @covers Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 49c1ec7145SGreg Roach */ 50c1ec7145SGreg Roach public function testSurnames() { 51c1ec7145SGreg Roach $this->assertSame(true, $this->surname_tradition->hasSurnames()); 52c1ec7145SGreg Roach } 53c1ec7145SGreg Roach 54c1ec7145SGreg Roach /** 55323788f4SGreg Roach * Test new son names 5617d74f3aSGreg Roach * 5717d74f3aSGreg Roach * @covers Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 5873d4df56SGreg Roach * @covers Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 59323788f4SGreg Roach */ 60323788f4SGreg Roach public function testNewSonNames() { 61323788f4SGreg Roach $this->assertSame( 6213abd6f3SGreg Roach ['NAME' => '/White/', 'SURN' => 'White'], 63323788f4SGreg Roach $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'M') 64323788f4SGreg Roach ); 65323788f4SGreg Roach } 66323788f4SGreg Roach 67323788f4SGreg Roach /** 68323788f4SGreg Roach * Test new daughter names 6917d74f3aSGreg Roach * 7017d74f3aSGreg Roach * @covers Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 7173d4df56SGreg Roach * @covers Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 72323788f4SGreg Roach */ 73323788f4SGreg Roach public function testNewDaughterNames() { 74323788f4SGreg Roach $this->assertSame( 7513abd6f3SGreg Roach ['NAME' => '/White/', 'SURN' => 'White'], 76323788f4SGreg Roach $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'F') 77323788f4SGreg Roach ); 78323788f4SGreg Roach } 79323788f4SGreg Roach 80323788f4SGreg Roach /** 81323788f4SGreg Roach * Test new daughter names 8217d74f3aSGreg Roach * 8317d74f3aSGreg Roach * @covers Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 8473d4df56SGreg Roach * @covers Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 85323788f4SGreg Roach */ 86323788f4SGreg Roach public function testNewDaughterNamesInflected() { 87323788f4SGreg Roach $this->assertSame( 8813abd6f3SGreg Roach ['NAME' => '/Whitecka/', 'SURN' => 'Whitecki'], 89323788f4SGreg Roach $this->surname_tradition->newChildNames('John /Whitecki/', 'Mary /Black/', 'F') 90323788f4SGreg Roach ); 91323788f4SGreg Roach $this->assertSame( 9213abd6f3SGreg Roach ['NAME' => '/Whitedzka/', 'SURN' => 'Whitedzki'], 93323788f4SGreg Roach $this->surname_tradition->newChildNames('John /Whitedzki/', 'Mary /Black/', 'F') 94323788f4SGreg Roach ); 95323788f4SGreg Roach $this->assertSame( 9613abd6f3SGreg Roach ['NAME' => '/Whiteska/', 'SURN' => 'Whiteski'], 97323788f4SGreg Roach $this->surname_tradition->newChildNames('John /Whiteski/', 'Mary /Black/', 'F') 98323788f4SGreg Roach ); 99323788f4SGreg Roach $this->assertSame( 10013abd6f3SGreg Roach ['NAME' => '/Whiteżka/', 'SURN' => 'Whiteżki'], 101323788f4SGreg Roach $this->surname_tradition->newChildNames('John /Whiteżki/', 'Mary /Black/', 'F') 102323788f4SGreg Roach ); 103323788f4SGreg Roach } 104323788f4SGreg Roach 105323788f4SGreg Roach /** 106323788f4SGreg Roach * Test new child names 10717d74f3aSGreg Roach * 10817d74f3aSGreg Roach * @covers Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 10973d4df56SGreg Roach * @covers Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 110323788f4SGreg Roach */ 111323788f4SGreg Roach public function testNewChildNames() { 112323788f4SGreg Roach $this->assertSame( 11313abd6f3SGreg Roach ['NAME' => '/White/', 'SURN' => 'White'], 114323788f4SGreg Roach $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'U') 115323788f4SGreg Roach ); 116323788f4SGreg Roach } 117323788f4SGreg Roach 118323788f4SGreg Roach /** 1191677a03aSGreg Roach * Test new child names 12017d74f3aSGreg Roach * 12117d74f3aSGreg Roach * @covers Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 12273d4df56SGreg Roach * @covers Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 1231677a03aSGreg Roach */ 1241677a03aSGreg Roach public function testNewChildNamesWithNoParentsNames() { 1251677a03aSGreg Roach $this->assertSame( 12613abd6f3SGreg Roach ['NAME' => '//'], 1271677a03aSGreg Roach $this->surname_tradition->newChildNames('', '', 'U') 1281677a03aSGreg Roach ); 1291677a03aSGreg Roach } 1301677a03aSGreg Roach 1311677a03aSGreg Roach /** 132323788f4SGreg Roach * Test new father names 13317d74f3aSGreg Roach * 13417d74f3aSGreg Roach * @covers Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 13573d4df56SGreg Roach * @covers Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 136323788f4SGreg Roach */ 137323788f4SGreg Roach public function testNewFatherNames() { 138323788f4SGreg Roach $this->assertSame( 13913abd6f3SGreg Roach ['NAME' => '/White/', 'SURN' => 'White'], 140323788f4SGreg Roach $this->surname_tradition->newParentNames('John /White/', 'M') 141323788f4SGreg Roach ); 142323788f4SGreg Roach } 143323788f4SGreg Roach 144323788f4SGreg Roach /** 145323788f4SGreg Roach * Test new father names 14617d74f3aSGreg Roach * 14717d74f3aSGreg Roach * @covers Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 14873d4df56SGreg Roach * @covers Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 149323788f4SGreg Roach */ 150323788f4SGreg Roach public function testNewFatherNamesInflected() { 151323788f4SGreg Roach $this->assertSame( 15213abd6f3SGreg Roach ['NAME' => '/Whitecki/', 'SURN' => 'Whitecki'], 153323788f4SGreg Roach $this->surname_tradition->newParentNames('Mary /Whitecka/', 'M') 154323788f4SGreg Roach ); 155323788f4SGreg Roach $this->assertSame( 15613abd6f3SGreg Roach ['NAME' => '/Whitedzki/', 'SURN' => 'Whitedzki'], 157323788f4SGreg Roach $this->surname_tradition->newParentNames('Mary /Whitedzka/', 'M') 158323788f4SGreg Roach ); 159323788f4SGreg Roach $this->assertSame( 16013abd6f3SGreg Roach ['NAME' => '/Whiteski/', 'SURN' => 'Whiteski'], 161323788f4SGreg Roach $this->surname_tradition->newParentNames('Mary /Whiteska/', 'M') 162323788f4SGreg Roach ); 163323788f4SGreg Roach $this->assertSame( 16413abd6f3SGreg Roach ['NAME' => '/Whiteżki/', 'SURN' => 'Whiteżki'], 165323788f4SGreg Roach $this->surname_tradition->newParentNames('Mary /Whiteżka/', 'M') 166323788f4SGreg Roach ); 167323788f4SGreg Roach } 168323788f4SGreg Roach 169323788f4SGreg Roach /** 170323788f4SGreg Roach * Test new mother names 17117d74f3aSGreg Roach * 17217d74f3aSGreg Roach * @covers Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 17373d4df56SGreg Roach * @covers Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 174323788f4SGreg Roach */ 175323788f4SGreg Roach public function testNewMotherNames() { 176323788f4SGreg Roach $this->assertSame( 17713abd6f3SGreg Roach ['NAME' => '//'], 178323788f4SGreg Roach $this->surname_tradition->newParentNames('John /White/', 'F') 179323788f4SGreg Roach ); 180323788f4SGreg Roach } 181323788f4SGreg Roach 182323788f4SGreg Roach /** 183323788f4SGreg Roach * Test new parent names 18417d74f3aSGreg Roach * 18517d74f3aSGreg Roach * @covers Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 18673d4df56SGreg Roach * @covers Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 187323788f4SGreg Roach */ 188323788f4SGreg Roach public function testNewParentNames() { 189323788f4SGreg Roach $this->assertSame( 19013abd6f3SGreg Roach ['NAME' => '//'], 191323788f4SGreg Roach $this->surname_tradition->newParentNames('John /White/', 'U') 192323788f4SGreg Roach ); 193323788f4SGreg Roach } 194323788f4SGreg Roach 195323788f4SGreg Roach /** 196323788f4SGreg Roach * Test new husband names 19717d74f3aSGreg Roach * 19817d74f3aSGreg Roach * @covers Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 19973d4df56SGreg Roach * @covers Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 200323788f4SGreg Roach */ 201323788f4SGreg Roach public function testNewHusbandNames() { 202323788f4SGreg Roach $this->assertSame( 20313abd6f3SGreg Roach ['NAME' => '//'], 204323788f4SGreg Roach $this->surname_tradition->newSpouseNames('Mary /Black/', 'M') 205323788f4SGreg Roach ); 206323788f4SGreg Roach } 207323788f4SGreg Roach 208323788f4SGreg Roach /** 209323788f4SGreg Roach * Test new wife names 21017d74f3aSGreg Roach * 21117d74f3aSGreg Roach * @covers Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 21273d4df56SGreg Roach * @covers Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 213323788f4SGreg Roach */ 214323788f4SGreg Roach public function testNewWifeNames() { 215323788f4SGreg Roach $this->assertSame( 21613abd6f3SGreg Roach ['NAME' => '//', '_MARNM' => '/White/'], 217323788f4SGreg Roach $this->surname_tradition->newSpouseNames('John /White/', 'F') 218323788f4SGreg Roach ); 219323788f4SGreg Roach } 220323788f4SGreg Roach 221323788f4SGreg Roach /** 222323788f4SGreg Roach * Test new spouse names 22317d74f3aSGreg Roach * 22417d74f3aSGreg Roach * @covers Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 22573d4df56SGreg Roach * @covers Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 226323788f4SGreg Roach */ 227323788f4SGreg Roach public function testNewSpouseNames() { 228323788f4SGreg Roach $this->assertSame( 22913abd6f3SGreg Roach ['NAME' => '//'], 230323788f4SGreg Roach $this->surname_tradition->newSpouseNames('Chris /Green/', 'U') 231323788f4SGreg Roach ); 232323788f4SGreg Roach } 233323788f4SGreg Roach} 234