xref: /webtrees/tests/app/Elements/TextFromSourceTest.php (revision 3d2c98d1066d5e178a3d1ceb3bdc58b7ba8ee926)
1*3d2c98d1SGreg Roach<?php
2*3d2c98d1SGreg Roach
3*3d2c98d1SGreg Roach/**
4*3d2c98d1SGreg Roach * webtrees: online genealogy
5*3d2c98d1SGreg Roach * Copyright (C) 2021 webtrees development team
6*3d2c98d1SGreg Roach * This program is free software: you can redistribute it and/or modify
7*3d2c98d1SGreg Roach * it under the terms of the GNU General Public License as published by
8*3d2c98d1SGreg Roach * the Free Software Foundation, either version 3 of the License, or
9*3d2c98d1SGreg Roach * (at your option) any later version.
10*3d2c98d1SGreg Roach * This program is distributed in the hope that it will be useful,
11*3d2c98d1SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
12*3d2c98d1SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13*3d2c98d1SGreg Roach * GNU General Public License for more details.
14*3d2c98d1SGreg Roach * You should have received a copy of the GNU General Public License
15*3d2c98d1SGreg Roach * along with this program. If not, see <https://www.gnu.org/licenses/>.
16*3d2c98d1SGreg Roach */
17*3d2c98d1SGreg Roach
18*3d2c98d1SGreg Roachdeclare(strict_types=1);
19*3d2c98d1SGreg Roach
20*3d2c98d1SGreg Roachnamespace Fisharebest\Webtrees\Elements;
21*3d2c98d1SGreg Roach
22*3d2c98d1SGreg Roach/**
23*3d2c98d1SGreg Roach * Test harness for the class TextFromSource
24*3d2c98d1SGreg Roach *
25*3d2c98d1SGreg Roach * @covers \Fisharebest\Webtrees\Elements\AbstractElement
26*3d2c98d1SGreg Roach * @covers \Fisharebest\Webtrees\Elements\TextFromSource
27*3d2c98d1SGreg Roach */
28*3d2c98d1SGreg Roachclass TextFromSourceTest extends AbstractElementTest
29*3d2c98d1SGreg Roach{
30*3d2c98d1SGreg Roach    /**
31*3d2c98d1SGreg Roach     * Standard tests for all elements.
32*3d2c98d1SGreg Roach     */
33*3d2c98d1SGreg Roach    public static function setupBeforeClass(): void
34*3d2c98d1SGreg Roach    {
35*3d2c98d1SGreg Roach        parent::setUpBeforeClass();
36*3d2c98d1SGreg Roach
37*3d2c98d1SGreg Roach        self::$element = new TextFromSource('label');
38*3d2c98d1SGreg Roach    }
39*3d2c98d1SGreg Roach
40*3d2c98d1SGreg Roach    /**
41*3d2c98d1SGreg Roach     * @return void
42*3d2c98d1SGreg Roach     */
43*3d2c98d1SGreg Roach    public function testCanonical(): void
44*3d2c98d1SGreg Roach    {
45*3d2c98d1SGreg Roach        self::assertSame('Foo  bAr  baZ', self::$element->canonical("Foo  bAr  baZ"));
46*3d2c98d1SGreg Roach        self::assertSame('  Foo  bAr  baZ  ', self::$element->canonical("\t Foo\t bAr \tbaZ\t "));
47*3d2c98d1SGreg Roach        self::assertSame("\nFoo \n\n bAr \n baZ\n", self::$element->canonical("\nFoo \n\r bAr \r\n baZ\r"));
48*3d2c98d1SGreg Roach    }
49*3d2c98d1SGreg Roach}
50