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