xref: /webtrees/tests/app/Census/CensusOfRhodeIsland1915Test.php (revision 202c018b592d5a516e4a465dc6dc515f3be37399)
16de2fb6bSKirk Gartside<?php
26de2fb6bSKirk Gartside
36de2fb6bSKirk Gartside/**
46de2fb6bSKirk Gartside * webtrees: online genealogy
5d11be702SGreg Roach * Copyright (C) 2023 webtrees development team
66de2fb6bSKirk Gartside * This program is free software: you can redistribute it and/or modify
76de2fb6bSKirk Gartside * it under the terms of the GNU General Public License as published by
86de2fb6bSKirk Gartside * the Free Software Foundation, either version 3 of the License, or
96de2fb6bSKirk Gartside * (at your option) any later version.
106de2fb6bSKirk Gartside * This program is distributed in the hope that it will be useful,
116de2fb6bSKirk Gartside * but WITHOUT ANY WARRANTY; without even the implied warranty of
126de2fb6bSKirk Gartside * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
136de2fb6bSKirk Gartside * GNU General Public License for more details.
146de2fb6bSKirk Gartside * You should have received a copy of the GNU General Public License
156de2fb6bSKirk Gartside * along with this program. If not, see <https://www.gnu.org/licenses/>.
166de2fb6bSKirk Gartside */
176de2fb6bSKirk Gartside
186de2fb6bSKirk Gartsidedeclare(strict_types=1);
196de2fb6bSKirk Gartside
206de2fb6bSKirk Gartsidenamespace Fisharebest\Webtrees\Census;
216de2fb6bSKirk Gartside
226de2fb6bSKirk Gartsideuse Fisharebest\Webtrees\TestCase;
23*202c018bSGreg Roachuse PHPUnit\Framework\Attributes\CoversClass;
246de2fb6bSKirk Gartside
25*202c018bSGreg Roach
26*202c018bSGreg Roach#[CoversClass(CensusOfRhodeIsland1915::class)]
27*202c018bSGreg Roach#[CoversClass(AbstractCensusColumn::class)]
286de2fb6bSKirk Gartsideclass CensusOfRhodeIsland1915Test extends TestCase
296de2fb6bSKirk Gartside{
306de2fb6bSKirk Gartside    /**
316de2fb6bSKirk Gartside     * Test the census place and date
326de2fb6bSKirk Gartside     */
336de2fb6bSKirk Gartside    public function testPlaceAndDate(): void
346de2fb6bSKirk Gartside    {
356de2fb6bSKirk Gartside        $census = new CensusOfRhodeIsland1915();
366de2fb6bSKirk Gartside
376de2fb6bSKirk Gartside        self::assertSame('Rhode Island, United States', $census->censusPlace());
386de2fb6bSKirk Gartside        self::assertSame('APR 1915', $census->censusDate());
396de2fb6bSKirk Gartside    }
406de2fb6bSKirk Gartside
416de2fb6bSKirk Gartside    /**
426de2fb6bSKirk Gartside     * Test the census columns
436de2fb6bSKirk Gartside     */
446de2fb6bSKirk Gartside    public function testColumns(): void
456de2fb6bSKirk Gartside    {
466de2fb6bSKirk Gartside        $census  = new CensusOfRhodeIsland1915();
476de2fb6bSKirk Gartside        $columns = $census->columns();
486de2fb6bSKirk Gartside        self::assertCount(13, $columns);
496de2fb6bSKirk Gartside        self::assertInstanceOf(CensusColumnSurnameGivenNameInitial::class, $columns[0]);
506de2fb6bSKirk Gartside        self::assertInstanceOf(CensusColumnRelationToHeadEnglish::class, $columns[1]);
516de2fb6bSKirk Gartside        self::assertInstanceOf(CensusColumnSexMF::class, $columns[2]);
526de2fb6bSKirk Gartside        self::assertInstanceOf(CensusColumnNull::class, $columns[3]);
536de2fb6bSKirk Gartside        self::assertInstanceOf(CensusColumnAge::class, $columns[4]);
546de2fb6bSKirk Gartside        self::assertInstanceOf(CensusColumnBirthPlaceSimple::class, $columns[5]);
556de2fb6bSKirk Gartside        self::assertInstanceOf(CensusColumnFatherBirthPlaceSimple::class, $columns[6]);
566de2fb6bSKirk Gartside        self::assertInstanceOf(CensusColumnMotherBirthPlaceSimple::class, $columns[7]);
576de2fb6bSKirk Gartside        self::assertInstanceOf(CensusColumnNull::class, $columns[8]);
586de2fb6bSKirk Gartside        self::assertInstanceOf(CensusColumnNull::class, $columns[9]);
596de2fb6bSKirk Gartside        self::assertInstanceOf(CensusColumnNull::class, $columns[10]);
606de2fb6bSKirk Gartside        self::assertInstanceOf(CensusColumnNull::class, $columns[11]);
616de2fb6bSKirk Gartside        self::assertInstanceOf(CensusColumnNull::class, $columns[12]);
626de2fb6bSKirk Gartside
636de2fb6bSKirk Gartside        self::assertSame('Name', $columns[0]->abbreviation());
646de2fb6bSKirk Gartside        self::assertSame('Relation', $columns[1]->abbreviation());
656de2fb6bSKirk Gartside        self::assertSame('Sex', $columns[2]->abbreviation());
666de2fb6bSKirk Gartside        self::assertSame('Race', $columns[3]->abbreviation());
676de2fb6bSKirk Gartside        self::assertSame('Age', $columns[4]->abbreviation());
686de2fb6bSKirk Gartside        self::assertSame('BP', $columns[5]->abbreviation());
696de2fb6bSKirk Gartside        self::assertSame('FBP', $columns[6]->abbreviation());
706de2fb6bSKirk Gartside        self::assertSame('MBP', $columns[7]->abbreviation());
716de2fb6bSKirk Gartside        self::assertSame('Cit', $columns[8]->abbreviation());
726de2fb6bSKirk Gartside        self::assertSame('Trade', $columns[9]->abbreviation());
736de2fb6bSKirk Gartside        self::assertSame('Ind', $columns[10]->abbreviation());
746de2fb6bSKirk Gartside        self::assertSame('Type', $columns[11]->abbreviation());
756de2fb6bSKirk Gartside        self::assertSame('Uemp', $columns[12]->abbreviation());
766de2fb6bSKirk Gartside        self::assertSame('Name', $columns[0]->title());
776de2fb6bSKirk Gartside        self::assertSame('Relationship of this person to head of the family', $columns[1]->title());
786de2fb6bSKirk Gartside        self::assertSame('Sex', $columns[2]->title());
796de2fb6bSKirk Gartside        self::assertSame('Color or race', $columns[3]->title());
806de2fb6bSKirk Gartside        self::assertSame('Age at last birthday', $columns[4]->title());
816de2fb6bSKirk Gartside        self::assertSame('Place of birth of this person', $columns[5]->title());
826de2fb6bSKirk Gartside        self::assertSame('Place of birth of Father of this person', $columns[6]->title());
836de2fb6bSKirk Gartside        self::assertSame('Place of birth of Mother of this person', $columns[7]->title());
846de2fb6bSKirk Gartside        self::assertSame('Whether naturalized or alien', $columns[8]->title());
856de2fb6bSKirk Gartside        self::assertSame('Trade or profession', $columns[9]->title());
866de2fb6bSKirk Gartside        self::assertSame('Nature of industry', $columns[10]->title());
876de2fb6bSKirk Gartside        self::assertSame('Whether an employer, employee or working on own account', $columns[11]->title());
886de2fb6bSKirk Gartside        self::assertSame('If Employee, Whether out of work on Apr 15, 1915', $columns[12]->title());
896de2fb6bSKirk Gartside    }
906de2fb6bSKirk Gartside}
91