xref: /webtrees/tests/app/Census/CensusOfFrance1881Test.php (revision 3cfcc809af53e831fa6cafac7b274a2cb407db6e)
1db7d25eeSGreg Roach<?php
23976b470SGreg Roach
3db7d25eeSGreg Roach/**
4db7d25eeSGreg Roach * webtrees: online genealogy
58fcd0d32SGreg Roach * Copyright (C) 2019 webtrees development team
6db7d25eeSGreg Roach * This program is free software: you can redistribute it and/or modify
7db7d25eeSGreg Roach * it under the terms of the GNU General Public License as published by
8db7d25eeSGreg Roach * the Free Software Foundation, either version 3 of the License, or
9db7d25eeSGreg Roach * (at your option) any later version.
10db7d25eeSGreg Roach * This program is distributed in the hope that it will be useful,
11db7d25eeSGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
12db7d25eeSGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13db7d25eeSGreg Roach * GNU General Public License for more details.
14db7d25eeSGreg Roach * You should have received a copy of the GNU General Public License
15db7d25eeSGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>.
16db7d25eeSGreg Roach */
17e7f56f2aSGreg Roachdeclare(strict_types=1);
18e7f56f2aSGreg Roach
19db7d25eeSGreg Roachnamespace Fisharebest\Webtrees\Census;
20db7d25eeSGreg Roach
21*3cfcc809SGreg Roachuse Fisharebest\Webtrees\TestCase;
22*3cfcc809SGreg Roach
23db7d25eeSGreg Roach/**
24db7d25eeSGreg Roach * Test harness for the class CensusOfFrance1881
25db7d25eeSGreg Roach */
26*3cfcc809SGreg Roachclass CensusOfFrance1881Test extends TestCase
27c1010edaSGreg Roach{
28db7d25eeSGreg Roach    /**
29db7d25eeSGreg Roach     * Test the census place and date
30ef21b467SGreg Roach     *
3115d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusOfFrance1881
3252348eb8SGreg Roach     *
3352348eb8SGreg Roach     * @return void
34db7d25eeSGreg Roach     */
359b802b22SGreg Roach    public function testPlaceAndDate(): void
36c1010edaSGreg Roach    {
3774d6dc0eSGreg Roach        $census = new CensusOfFrance1881();
38db7d25eeSGreg Roach
39db7d25eeSGreg Roach        $this->assertSame('France', $census->censusPlace());
4073c569abSGreg Roach        $this->assertSame('20 JAN 1881', $census->censusDate());
41db7d25eeSGreg Roach    }
4240150762SGreg Roach
4340150762SGreg Roach    /**
4440150762SGreg Roach     * Test the census columns
4540150762SGreg Roach     *
4615d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusOfFrance1881
4715d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
4852348eb8SGreg Roach     *
4952348eb8SGreg Roach     * @return void
5040150762SGreg Roach     */
519b802b22SGreg Roach    public function testColumns(): void
52c1010edaSGreg Roach    {
5374d6dc0eSGreg Roach        $census  = new CensusOfFrance1881();
5440150762SGreg Roach        $columns = $census->columns();
5540150762SGreg Roach
5640150762SGreg Roach        $this->assertCount(5, $columns);
57*3cfcc809SGreg Roach        $this->assertInstanceOf(CensusColumnSurname::class, $columns[0]);
58*3cfcc809SGreg Roach        $this->assertInstanceOf(CensusColumnGivenNames::class, $columns[1]);
59*3cfcc809SGreg Roach        $this->assertInstanceOf(CensusColumnAge::class, $columns[2]);
60*3cfcc809SGreg Roach        $this->assertInstanceOf(CensusColumnOccupation::class, $columns[3]);
61*3cfcc809SGreg Roach        $this->assertInstanceOf(CensusColumnRelationToHead::class, $columns[4]);
6240150762SGreg Roach
6300225b98SGreg Roach        $this->assertSame('Noms', $columns[0]->abbreviation());
6400225b98SGreg Roach        $this->assertSame('Prénoms', $columns[1]->abbreviation());
6500225b98SGreg Roach        $this->assertSame('Âge', $columns[2]->abbreviation());
6600225b98SGreg Roach        $this->assertSame('Profession', $columns[3]->abbreviation());
67789ec362SGreg Roach        $this->assertSame('Position', $columns[4]->abbreviation());
6840150762SGreg Roach
6900225b98SGreg Roach        $this->assertSame('Noms de famille', $columns[0]->title());
7000225b98SGreg Roach        $this->assertSame('', $columns[1]->title());
7100225b98SGreg Roach        $this->assertSame('', $columns[2]->title());
7200225b98SGreg Roach        $this->assertSame('', $columns[3]->title());
73789ec362SGreg Roach        $this->assertSame('Position dans le ménage', $columns[4]->title());
7440150762SGreg Roach    }
75db7d25eeSGreg Roach}
76