xref: /webtrees/tests/app/Census/CensusOfCanadaTest.php (revision 5a8afed46297e8105e3e5a33ce37e6a8e88bc79d)
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#[CoversClass(CensusOfCanada::class)]
26a8139624SGreg Roachclass CensusOfCanadaTest extends TestCase
27a8139624SGreg Roach{
28f71a4582Smanf0001    /**
29f71a4582Smanf0001     * Test the census place
30f71a4582Smanf0001     */
31f71a4582Smanf0001    public function testPlace(): void
32a8139624SGreg Roach    {
33f71a4582Smanf0001        $census = new CensusOfCanada();
34f71a4582Smanf0001
35f71a4582Smanf0001        self::assertSame('Canada', $census->censusPlace());
36f71a4582Smanf0001    }
37f71a4582Smanf0001
38f71a4582Smanf0001    /**
39f71a4582Smanf0001     * Test the census language
40f71a4582Smanf0001     */
41f71a4582Smanf0001    public function testLanguage(): void
42f71a4582Smanf0001    {
43f71a4582Smanf0001        $census = new CensusOfCanada();
44f71a4582Smanf0001
45f71a4582Smanf0001        self::assertSame('en-US', $census->censusLanguage());
46f71a4582Smanf0001    }
47f71a4582Smanf0001
48f71a4582Smanf0001    /**
49f71a4582Smanf0001     * Test the census dates
50f71a4582Smanf0001     */
51f71a4582Smanf0001    public function testAllDates(): void
52f71a4582Smanf0001    {
53f71a4582Smanf0001        $census = new CensusOfCanada();
54f71a4582Smanf0001
55f71a4582Smanf0001        $census_dates = $census->allCensusDates();
56f71a4582Smanf0001
57f71a4582Smanf0001        self::assertCount(11, $census_dates);
58f71a4582Smanf0001        self::assertInstanceOf(CensusOfCanada1851::class, $census_dates[0]);
59f71a4582Smanf0001        self::assertInstanceOf(CensusOfCanada1861::class, $census_dates[1]);
60f71a4582Smanf0001        self::assertInstanceOf(CensusOfCanada1871::class, $census_dates[2]);
61f71a4582Smanf0001        self::assertInstanceOf(CensusOfCanada1881::class, $census_dates[3]);
62f71a4582Smanf0001        self::assertInstanceOf(CensusOfCanada1891::class, $census_dates[4]);
63f71a4582Smanf0001        self::assertInstanceOf(CensusOfCanada1901::class, $census_dates[5]);
64f71a4582Smanf0001        self::assertInstanceOf(CensusOfCanada1911::class, $census_dates[6]);
65f71a4582Smanf0001        self::assertInstanceOf(CensusOfCanadaPraries1916::class, $census_dates[7]);
66f71a4582Smanf0001        self::assertInstanceOf(CensusOfCanada1921::class, $census_dates[8]);
67f71a4582Smanf0001        self::assertInstanceOf(CensusOfCanadaPraries1926::class, $census_dates[9]);
68f71a4582Smanf0001        self::assertInstanceOf(CensusOfCanada1931::class, $census_dates[10]);
69a8139624SGreg Roach    }
70a8139624SGreg Roach}
71