xref: /webtrees/tests/app/Census/CensusColumnMotherBirthPlaceSimpleTest.php (revision a4500ed5f20510414ab3cde59bd1a55abbf68700)
1*a4500ed5SGreg Roach<?php
2*a4500ed5SGreg Roach
3*a4500ed5SGreg Roach/**
4*a4500ed5SGreg Roach * webtrees: online genealogy
5*a4500ed5SGreg Roach * Copyright (C) 2015 webtrees development team
6*a4500ed5SGreg Roach * This program is free software: you can redistribute it and/or modify
7*a4500ed5SGreg Roach * it under the terms of the GNU General Public License as published by
8*a4500ed5SGreg Roach * the Free Software Foundation, either version 3 of the License, or
9*a4500ed5SGreg Roach * (at your option) any later version.
10*a4500ed5SGreg Roach * This program is distributed in the hope that it will be useful,
11*a4500ed5SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
12*a4500ed5SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13*a4500ed5SGreg Roach * GNU General Public License for more details.
14*a4500ed5SGreg Roach * You should have received a copy of the GNU General Public License
15*a4500ed5SGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>.
16*a4500ed5SGreg Roach */
17*a4500ed5SGreg Roach
18*a4500ed5SGreg Roachnamespace Fisharebest\Webtrees\Census;
19*a4500ed5SGreg Roach
20*a4500ed5SGreg Roachuse Fisharebest\Webtrees\Date;
21*a4500ed5SGreg Roachuse Fisharebest\Webtrees\Individual;
22*a4500ed5SGreg Roachuse Mockery;
23*a4500ed5SGreg Roach
24*a4500ed5SGreg Roach/**
25*a4500ed5SGreg Roach * Test harness for the class CensusColumnMotherBirthPlaceSimple
26*a4500ed5SGreg Roach */
27*a4500ed5SGreg Roachclass CensusColumnMotherBirthPlaceSimpleTest extends \PHPUnit_Framework_TestCase {
28*a4500ed5SGreg Roach	/**
29*a4500ed5SGreg Roach	 * Delete mock objects
30*a4500ed5SGreg Roach	 */
31*a4500ed5SGreg Roach	public function tearDown() {
32*a4500ed5SGreg Roach		Mockery::close();
33*a4500ed5SGreg Roach	}
34*a4500ed5SGreg Roach
35*a4500ed5SGreg Roach	/**
36*a4500ed5SGreg Roach	 * @covers Fisharebest\Webtrees\Census\CensusColumnMotherBirthPlaceSimple
37*a4500ed5SGreg Roach	 * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn
38*a4500ed5SGreg Roach	 */
39*a4500ed5SGreg Roach	public function testKnownStateAndTown() {
40*a4500ed5SGreg Roach		$father = Mockery::mock(Individual::class);
41*a4500ed5SGreg Roach		$father->shouldReceive('getBirthPlace')->andReturn('Miami, Florida, United States');
42*a4500ed5SGreg Roach
43*a4500ed5SGreg Roach		$family = Mockery::mock(Family::class);
44*a4500ed5SGreg Roach		$family->shouldReceive('getWife')->andReturn($father);
45*a4500ed5SGreg Roach
46*a4500ed5SGreg Roach		$individual = Mockery::mock(Individual::class);
47*a4500ed5SGreg Roach		$individual->shouldReceive('getPrimaryChildFamily')->andReturn($family);
48*a4500ed5SGreg Roach
49*a4500ed5SGreg Roach		$census = Mockery::mock(CensusInterface::class);
50*a4500ed5SGreg Roach		$census->shouldReceive('censusPlace')->andReturn('United States');
51*a4500ed5SGreg Roach
52*a4500ed5SGreg Roach		$column = new CensusColumnMotherBirthPlaceSimple($census, '', '');
53*a4500ed5SGreg Roach
54*a4500ed5SGreg Roach		$this->assertSame('Florida', $column->generate($individual));
55*a4500ed5SGreg Roach	}
56*a4500ed5SGreg Roach}
57