xref: /webtrees/tests/app/Census/CensusOfCanadaTest.php (revision 202c018b592d5a516e4a465dc6dc515f3be37399)
1a8139624SGreg Roach<?php
2a8139624SGreg Roach
3a8139624SGreg Roach/**
4a8139624SGreg Roach * webtrees: online genealogy
5d11be702SGreg Roach * Copyright (C) 2023 webtrees development team
6a8139624SGreg Roach * This program is free software: you can redistribute it and/or modify
7a8139624SGreg Roach * it under the terms of the GNU General Public License as published by
8a8139624SGreg Roach * the Free Software Foundation, either version 3 of the License, or
9a8139624SGreg Roach * (at your option) any later version.
10a8139624SGreg Roach * This program is distributed in the hope that it will be useful,
11a8139624SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
12a8139624SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13a8139624SGreg Roach * GNU General Public License for more details.
14a8139624SGreg Roach * You should have received a copy of the GNU General Public License
15a8139624SGreg Roach * along with this program. If not, see <https://www.gnu.org/licenses/>.
16a8139624SGreg Roach */
17a8139624SGreg Roach
18a8139624SGreg Roachdeclare(strict_types=1);
19a8139624SGreg Roach
20a8139624SGreg Roachnamespace Fisharebest\Webtrees\Census;
21a8139624SGreg Roach
22a8139624SGreg Roachuse Fisharebest\Webtrees\TestCase;
23*202c018bSGreg Roachuse PHPUnit\Framework\Attributes\CoversClass;
24a8139624SGreg Roach
25*202c018bSGreg Roach
26*202c018bSGreg Roach#[CoversClass(CensusOfCanada::class)]
27a8139624SGreg Roachclass CensusOfCanadaTest extends TestCase
28a8139624SGreg Roach{
29f71a4582Smanf0001    /**
30f71a4582Smanf0001     * Test the census place
31f71a4582Smanf0001     */
32f71a4582Smanf0001    public function testPlace(): void
33a8139624SGreg Roach    {
34f71a4582Smanf0001        $census = new CensusOfCanada();
35f71a4582Smanf0001
36f71a4582Smanf0001        self::assertSame('Canada', $census->censusPlace());
37f71a4582Smanf0001    }
38f71a4582Smanf0001
39f71a4582Smanf0001    /**
40f71a4582Smanf0001     * Test the census language
41f71a4582Smanf0001     */
42f71a4582Smanf0001    public function testLanguage(): void
43f71a4582Smanf0001    {
44f71a4582Smanf0001        $census = new CensusOfCanada();
45f71a4582Smanf0001
46f71a4582Smanf0001        self::assertSame('en-US', $census->censusLanguage());
47f71a4582Smanf0001    }
48f71a4582Smanf0001
49f71a4582Smanf0001    /**
50f71a4582Smanf0001     * Test the census dates
51f71a4582Smanf0001     */
52f71a4582Smanf0001    public function testAllDates(): void
53f71a4582Smanf0001    {
54f71a4582Smanf0001        $census = new CensusOfCanada();
55f71a4582Smanf0001
56f71a4582Smanf0001        $census_dates = $census->allCensusDates();
57f71a4582Smanf0001
58f71a4582Smanf0001        self::assertCount(11, $census_dates);
59f71a4582Smanf0001        self::assertInstanceOf(CensusOfCanada1851::class, $census_dates[0]);
60f71a4582Smanf0001        self::assertInstanceOf(CensusOfCanada1861::class, $census_dates[1]);
61f71a4582Smanf0001        self::assertInstanceOf(CensusOfCanada1871::class, $census_dates[2]);
62f71a4582Smanf0001        self::assertInstanceOf(CensusOfCanada1881::class, $census_dates[3]);
63f71a4582Smanf0001        self::assertInstanceOf(CensusOfCanada1891::class, $census_dates[4]);
64f71a4582Smanf0001        self::assertInstanceOf(CensusOfCanada1901::class, $census_dates[5]);
65f71a4582Smanf0001        self::assertInstanceOf(CensusOfCanada1911::class, $census_dates[6]);
66f71a4582Smanf0001        self::assertInstanceOf(CensusOfCanadaPraries1916::class, $census_dates[7]);
67f71a4582Smanf0001        self::assertInstanceOf(CensusOfCanada1921::class, $census_dates[8]);
68f71a4582Smanf0001        self::assertInstanceOf(CensusOfCanadaPraries1926::class, $census_dates[9]);
69f71a4582Smanf0001        self::assertInstanceOf(CensusOfCanada1931::class, $census_dates[10]);
70a8139624SGreg Roach    }
71a8139624SGreg Roach}
72