. */ declare(strict_types=1); namespace Fisharebest\Webtrees; /** * Test harness for the class Fact * * @covers \Fisharebest\Webtrees\Fact */ class FactTest extends TestCase { protected static bool $uses_database = true; /** * @return void */ public function testAttribute(): void { $individual = $this->createStub(Individual::class); $individual->method('tag')->willReturn('INDI'); $fact = new Fact("1 BIRT\n2 ADDR address", $individual, ''); self::assertSame('address', $fact->attribute('ADDR')); $fact = new Fact("1 BIRT\n2 ADDR line 1\n3 CONT line 2", $individual, ''); self::assertSame("line 1\nline 2", $fact->attribute('ADDR')); } /** * @return void * * @see https://github.com/fisharebest/webtrees/issues/4417 */ public function testIssue4417(): void { $individual = $this->createStub(Individual::class); $individual->method('tag')->willReturn('INDI'); $fact = new Fact("1 BIRT\n2 PLACXYZ\n3 CONT place", $individual, ''); self::assertSame('', $fact->attribute('PLAC')); $fact = new Fact("1 BIRT\n2 PLACXYZ place", $individual, ''); self::assertSame('', $fact->attribute('PLAC')); } }