1<?php 2 3/** 4 * webtrees: online genealogy 5 * Copyright (C) 2016 webtrees development team 6 * This program is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation, either version 3 of the License, or 9 * (at your option) any later version. 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * You should have received a copy of the GNU General Public License 15 * along with this program. If not, see <http://www.gnu.org/licenses/>. 16 */ 17namespace Fisharebest\Webtrees\Census; 18 19use Fisharebest\Webtrees\Individual; 20use Mockery; 21 22/** 23 * Test harness for the class CensusColumnBornForeignParts 24 */ 25class CensusColumnBornForeignPartsTest extends \PHPUnit_Framework_TestCase { 26 /** 27 * Delete mock objects 28 */ 29 public function tearDown() { 30 Mockery::close(); 31 } 32 33 /** 34 * @covers Fisharebest\Webtrees\Census\CensusColumnBornForeignParts 35 * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn 36 */ 37 public function testBornEnglandCensusEngland() { 38 $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 39 $individual->shouldReceive('getBirthPlace')->andReturn('London, England'); 40 41 $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 42 $census->shouldReceive('censusPlace')->andReturn('England'); 43 44 $column = new CensusColumnBornForeignParts($census, '', ''); 45 46 $this->assertSame('', $column->generate($individual)); 47 } 48 49 /** 50 * @covers Fisharebest\Webtrees\Census\CensusColumnBornForeignParts 51 * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn 52 */ 53 public function testBornWalesCensusEngland() { 54 $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 55 $individual->shouldReceive('getBirthPlace')->andReturn('Cardiff, Wales'); 56 57 $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 58 $census->shouldReceive('censusPlace')->andReturn('England'); 59 60 $column = new CensusColumnBornForeignParts($census, '', ''); 61 62 $this->assertSame('', $column->generate($individual)); 63 } 64 65 /** 66 * @covers Fisharebest\Webtrees\Census\CensusColumnBornForeignParts 67 * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn 68 */ 69 public function testBornScotlandCensusEngland() { 70 $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 71 $individual->shouldReceive('getBirthPlace')->andReturn('Edinburgh, Scotland'); 72 73 $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 74 $census->shouldReceive('censusPlace')->andReturn('England'); 75 76 $column = new CensusColumnBornForeignParts($census, '', ''); 77 78 $this->assertSame('S', $column->generate($individual)); 79 } 80 81 /** 82 * @covers Fisharebest\Webtrees\Census\CensusColumnBornForeignParts 83 * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn 84 */ 85 public function testBornIrelandCensusEngland() { 86 $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 87 $individual->shouldReceive('getBirthPlace')->andReturn('Dublin, Ireland'); 88 89 $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 90 $census->shouldReceive('censusPlace')->andReturn('England'); 91 92 $column = new CensusColumnBornForeignParts($census, '', ''); 93 94 $this->assertSame('I', $column->generate($individual)); 95 } 96 97 /** 98 * @covers Fisharebest\Webtrees\Census\CensusColumnBornForeignParts 99 * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn 100 */ 101 public function testBornForeignCensusEngland() { 102 $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 103 $individual->shouldReceive('getBirthPlace')->andReturn('Elbonia'); 104 105 $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 106 $census->shouldReceive('censusPlace')->andReturn('England'); 107 108 $column = new CensusColumnBornForeignParts($census, '', ''); 109 110 $this->assertSame('F', $column->generate($individual)); 111 } 112 113 /** 114 * @covers Fisharebest\Webtrees\Census\CensusColumnBornForeignParts 115 * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn 116 */ 117 public function testBornEnglandCensusIreland() { 118 $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 119 $individual->shouldReceive('getBirthPlace')->andReturn('London, England'); 120 121 $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 122 $census->shouldReceive('censusPlace')->andReturn('Ireland'); 123 124 $column = new CensusColumnBornForeignParts($census, '', ''); 125 126 $this->assertSame('E', $column->generate($individual)); 127 } 128 129 /** 130 * @covers Fisharebest\Webtrees\Census\CensusColumnBornForeignParts 131 * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn 132 */ 133 public function testBornWalesCensusIreland() { 134 $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 135 $individual->shouldReceive('getBirthPlace')->andReturn('Cardiff, Wales'); 136 137 $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 138 $census->shouldReceive('censusPlace')->andReturn('Ireland'); 139 140 $column = new CensusColumnBornForeignParts($census, '', ''); 141 142 $this->assertSame('E', $column->generate($individual)); 143 } 144 145 /** 146 * @covers Fisharebest\Webtrees\Census\CensusColumnBornForeignParts 147 * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn 148 */ 149 public function testBornScotlandCensusIreland() { 150 $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 151 $individual->shouldReceive('getBirthPlace')->andReturn('Edinburgh, Scotland'); 152 153 $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 154 $census->shouldReceive('censusPlace')->andReturn('Ireland'); 155 156 $column = new CensusColumnBornForeignParts($census, '', ''); 157 158 $this->assertSame('S', $column->generate($individual)); 159 } 160 161 /** 162 * @covers Fisharebest\Webtrees\Census\CensusColumnBornForeignParts 163 * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn 164 */ 165 public function testBornIrelandCensusIreland() { 166 $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 167 $individual->shouldReceive('getBirthPlace')->andReturn('Dublin, Ireland'); 168 169 $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 170 $census->shouldReceive('censusPlace')->andReturn('Ireland'); 171 172 $column = new CensusColumnBornForeignParts($census, '', ''); 173 174 $this->assertSame('', $column->generate($individual)); 175 } 176 177 /** 178 * @covers Fisharebest\Webtrees\Census\CensusColumnBornForeignParts 179 * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn 180 */ 181 public function testBornForeignCensusIreland() { 182 $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 183 $individual->shouldReceive('getBirthPlace')->andReturn('Elbonia'); 184 185 $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 186 $census->shouldReceive('censusPlace')->andReturn('Ireland'); 187 188 $column = new CensusColumnBornForeignParts($census, '', ''); 189 190 $this->assertSame('F', $column->generate($individual)); 191 } 192 193 /** 194 * @covers Fisharebest\Webtrees\Census\CensusColumnBornForeignParts 195 * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn 196 */ 197 public function testBornEnglandCensusScotland() { 198 $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 199 $individual->shouldReceive('getBirthPlace')->andReturn('London, England'); 200 201 $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 202 $census->shouldReceive('censusPlace')->andReturn('Scotland'); 203 204 $column = new CensusColumnBornForeignParts($census, '', ''); 205 206 $this->assertSame('E', $column->generate($individual)); 207 } 208 209 /** 210 * @covers Fisharebest\Webtrees\Census\CensusColumnBornForeignParts 211 * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn 212 */ 213 public function testBornWalesCensusScotland() { 214 $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 215 $individual->shouldReceive('getBirthPlace')->andReturn('Cardiff, Wales'); 216 217 $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 218 $census->shouldReceive('censusPlace')->andReturn('Scotland'); 219 220 $column = new CensusColumnBornForeignParts($census, '', ''); 221 222 $this->assertSame('E', $column->generate($individual)); 223 } 224 225 /** 226 * @covers Fisharebest\Webtrees\Census\CensusColumnBornForeignParts 227 * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn 228 */ 229 public function testBornScotlandCensusScotland() { 230 $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 231 $individual->shouldReceive('getBirthPlace')->andReturn('Edinburgh, Scotland'); 232 233 $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 234 $census->shouldReceive('censusPlace')->andReturn('Scotland'); 235 236 $column = new CensusColumnBornForeignParts($census, '', ''); 237 238 $this->assertSame('', $column->generate($individual)); 239 } 240 241 /** 242 * @covers Fisharebest\Webtrees\Census\CensusColumnBornForeignParts 243 * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn 244 */ 245 public function testBornIrelandCensusScotland() { 246 $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 247 $individual->shouldReceive('getBirthPlace')->andReturn('Dublin, Ireland'); 248 249 $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 250 $census->shouldReceive('censusPlace')->andReturn('Scotland'); 251 252 $column = new CensusColumnBornForeignParts($census, '', ''); 253 254 $this->assertSame('I', $column->generate($individual)); 255 } 256 257 /** 258 * @covers Fisharebest\Webtrees\Census\CensusColumnBornForeignParts 259 * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn 260 */ 261 public function testBornForeignCensusScotland() { 262 $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 263 $individual->shouldReceive('getBirthPlace')->andReturn('Elbonia'); 264 265 $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 266 $census->shouldReceive('censusPlace')->andReturn('Scotland'); 267 268 $column = new CensusColumnBornForeignParts($census, '', ''); 269 270 $this->assertSame('F', $column->generate($individual)); 271 } 272 273 /** 274 * @covers Fisharebest\Webtrees\Census\CensusColumnBornForeignParts 275 * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn 276 */ 277 public function testBornEnglandCensusWales() { 278 $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 279 $individual->shouldReceive('getBirthPlace')->andReturn('London, England'); 280 281 $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 282 $census->shouldReceive('censusPlace')->andReturn('Wales'); 283 284 $column = new CensusColumnBornForeignParts($census, '', ''); 285 286 $this->assertSame('', $column->generate($individual)); 287 } 288 289 /** 290 * @covers Fisharebest\Webtrees\Census\CensusColumnBornForeignParts 291 * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn 292 */ 293 public function testBornWalesCensusWales() { 294 $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 295 $individual->shouldReceive('getBirthPlace')->andReturn('Cardiff, Wales'); 296 297 $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 298 $census->shouldReceive('censusPlace')->andReturn('Wales'); 299 300 $column = new CensusColumnBornForeignParts($census, '', ''); 301 302 $this->assertSame('', $column->generate($individual)); 303 } 304 305 /** 306 * @covers Fisharebest\Webtrees\Census\CensusColumnBornForeignParts 307 * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn 308 */ 309 public function testBornScotlandCensusWales() { 310 $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 311 $individual->shouldReceive('getBirthPlace')->andReturn('Edinburgh, Scotland'); 312 313 $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 314 $census->shouldReceive('censusPlace')->andReturn('Wales'); 315 316 $column = new CensusColumnBornForeignParts($census, '', ''); 317 318 $this->assertSame('S', $column->generate($individual)); 319 } 320 321 /** 322 * @covers Fisharebest\Webtrees\Census\CensusColumnBornForeignParts 323 * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn 324 */ 325 public function testBornIrelandCensusWales() { 326 $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 327 $individual->shouldReceive('getBirthPlace')->andReturn('Dublin, Ireland'); 328 329 $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 330 $census->shouldReceive('censusPlace')->andReturn('Wales'); 331 332 $column = new CensusColumnBornForeignParts($census, '', ''); 333 334 $this->assertSame('I', $column->generate($individual)); 335 } 336 337 /** 338 * @covers Fisharebest\Webtrees\Census\CensusColumnBornForeignParts 339 * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn 340 */ 341 public function testBornForeignCensusWales() { 342 $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 343 $individual->shouldReceive('getBirthPlace')->andReturn('Elbonia'); 344 345 $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 346 $census->shouldReceive('censusPlace')->andReturn('Wales'); 347 348 $column = new CensusColumnBornForeignParts($census, '', ''); 349 350 $this->assertSame('F', $column->generate($individual)); 351 } 352 353 /** 354 * @covers Fisharebest\Webtrees\Census\CensusColumnBornForeignParts 355 * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn 356 */ 357 public function testBornNowhereCensusEngland() { 358 $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 359 $individual->shouldReceive('getBirthPlace')->andReturn(''); 360 361 $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 362 $census->shouldReceive('censusPlace')->andReturn('England'); 363 364 $column = new CensusColumnBornForeignParts($census, '', ''); 365 366 $this->assertSame('', $column->generate($individual)); 367 } 368 369 /** 370 * @covers Fisharebest\Webtrees\Census\CensusColumnBornForeignParts 371 * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn 372 */ 373 public function testBornNowhereCensusWales() { 374 $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 375 $individual->shouldReceive('getBirthPlace')->andReturn(''); 376 377 $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 378 $census->shouldReceive('censusPlace')->andReturn('Wales'); 379 380 $column = new CensusColumnBornForeignParts($census, '', ''); 381 382 $this->assertSame('', $column->generate($individual)); 383 } 384 385 /** 386 * @covers Fisharebest\Webtrees\Census\CensusColumnBornForeignParts 387 * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn 388 */ 389 public function testBornNowhereCensusScotland() { 390 $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 391 $individual->shouldReceive('getBirthPlace')->andReturn(''); 392 393 $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 394 $census->shouldReceive('censusPlace')->andReturn('Scotland'); 395 396 $column = new CensusColumnBornForeignParts($census, '', ''); 397 398 $this->assertSame('', $column->generate($individual)); 399 } 400} 401