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