summaryrefslogtreecommitdiff
path: root/tests/app/Census/CensusColumnSexMFTest.php
diff options
context:
space:
mode:
authorGreg Roach <fisharebest@gmail.com>2015-09-26 23:26:42 +0100
committerGreg Roach <fisharebest@gmail.com>2015-09-26 23:26:42 +0100
commita53db70de9092a80529e77db445001f1acf43696 (patch)
tree9aabf8f49003c06eedf8167ca7ab60daa701dc3e /tests/app/Census/CensusColumnSexMFTest.php
parent40150762995019e237299a92690fdc53f25e4ccf (diff)
downloadwebtrees-a53db70de9092a80529e77db445001f1acf43696.tar.gz
webtrees-a53db70de9092a80529e77db445001f1acf43696.tar.bz2
webtrees-a53db70de9092a80529e77db445001f1acf43696.zip
Unit tests
Diffstat (limited to 'tests/app/Census/CensusColumnSexMFTest.php')
-rw-r--r--tests/app/Census/CensusColumnSexMFTest.php79
1 files changed, 79 insertions, 0 deletions
diff --git a/tests/app/Census/CensusColumnSexMFTest.php b/tests/app/Census/CensusColumnSexMFTest.php
new file mode 100644
index 0000000000..7c5b513a98
--- /dev/null
+++ b/tests/app/Census/CensusColumnSexMFTest.php
@@ -0,0 +1,79 @@
+<?php
+
+/**
+ * webtrees: online genealogy
+ * Copyright (C) 2015 webtrees development team
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+namespace Fisharebest\Webtrees\Census;
+
+use Fisharebest\Webtrees\Date;
+use Fisharebest\Webtrees\Individual;
+use Mockery;
+
+/**
+ * Test harness for the class CensusColumnSexMF
+ */
+class CensusColumnSexMFTest extends \PHPUnit_Framework_TestCase {
+ /**
+ * Delete mock objects
+ */
+ public function tearDown() {
+ Mockery::close();
+ }
+
+ /**
+ * @covers Fisharebest\Webtrees\Census\CensusColumnSexMF
+ * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn
+ */
+ public function testMale() {
+ $individual = Mockery::mock(Individual::class);
+ $individual->shouldReceive('getSex')->andReturn('M');
+
+ $census = Mockery::mock(CensusInterface::class);
+
+ $column = new CensusColumnSexMF($census, '', '');
+
+ $this->assertSame('M', $column->generate($individual));
+ }
+
+ /**
+ * @covers Fisharebest\Webtrees\Census\CensusColumnSexMF
+ * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn
+ */
+ public function testFeale() {
+ $individual = Mockery::mock(Individual::class);
+ $individual->shouldReceive('getSex')->andReturn('F');
+
+ $census = Mockery::mock(CensusInterface::class);
+
+ $column = new CensusColumnSexMF($census, '', '');
+
+ $this->assertSame('F', $column->generate($individual));
+ }
+
+ /**
+ * @covers Fisharebest\Webtrees\Census\CensusColumnSexMF
+ * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn
+ */
+ public function testUnknownSex() {
+ $individual = Mockery::mock(Individual::class);
+ $individual->shouldReceive('getSex')->andReturn('U');
+
+ $census = Mockery::mock(CensusInterface::class);
+
+ $column = new CensusColumnSexMF($census, '', '');
+
+ $this->assertSame('', $column->generate($individual));
+ }
+}