. */ declare(strict_types=1); namespace Fisharebest\Webtrees\Services; use Fisharebest\Webtrees\TestCase; /** * Test harness for the class GedcomEditService * * @covers \Fisharebest\Webtrees\Services\GedcomEditService */ class GedcomEditServiceTest extends TestCase { /** * @covers \Fisharebest\Webtrees\Services\GedcomEditService::editLinesToGedcom */ public function testEditLinesToGedcom(): void { $gedcom_edit_service = new GedcomEditService(); $this->assertSame( "1 BIRT Y", $gedcom_edit_service->editLinesToGedcom( 'INDI', ['1'], ['BIRT'], ['Y'] ) ); $this->assertSame( "1 BIRT Y\n2 ADDR England", $gedcom_edit_service->editLinesToGedcom( 'INDI', ['1', '2'], ['BIRT', 'ADDR'], ['Y', 'England'] ) ); $this->assertSame( "1 BIRT\n2 PLAC England", $gedcom_edit_service->editLinesToGedcom( 'INDI', ['1', '2'], ['BIRT', 'PLAC'], ['Y', 'England'] ) ); $this->assertSame( "1 BIRT\n2 PLAC England\n2 SOUR @S1@\n3 PAGE 123", $gedcom_edit_service->editLinesToGedcom( 'INDI', ['1', '2', '2', '3'], ['BIRT', 'PLAC', 'SOUR', 'PAGE'], ['Y', 'England', '@S1@', '123'] ) ); $this->assertSame( "1 BIRT\n2 PLAC England", $gedcom_edit_service->editLinesToGedcom( 'INDI', ['1', '2', '2', '3'], ['BIRT', 'PLAC', 'SOUR', 'PAGE'], ['Y', 'England', '', '123'] ) ); $this->assertSame( "1 BIRT\n2 PLAC England\n1 DEAT\n2 PLAC Scotland", $gedcom_edit_service->editLinesToGedcom( 'INDI', ['1', '2', '2', '3', '1', '2', '2', '3'], ['BIRT', 'PLAC', 'SOUR', 'PAGE', 'DEAT', 'PLAC', 'SOUR', 'PAGE'], ['Y', 'England', '', '123', 'Y', 'Scotland', '', '123'] ) ); $this->assertSame( "0 NOTE @N1@\n1 CONC foo\n1 CONT bar\n1 RESN locked", $gedcom_edit_service->editLinesToGedcom( 'NOTE', ['0', '1', '1'], ['NOTE', 'CONC', 'RESN'], ['@N1@', "foo\nbar", 'locked'] ) ); } }