Code Duplication    Length = 15-19 lines in 2 locations

tests/unit/TranslatableTest.php 2 locations

@@ 829-843 (lines=15) @@
826
        );
827
    }
828
829
    public function testCreateTranslationOnSiteTree()
830
    {
831
        $origPage = $this->objFromFixture(Page::class, 'testpage_en');
832
        $translatedPage = $origPage->createTranslation('de_DE');
833
834
        $this->assertEquals($translatedPage->Locale, 'de_DE');
835
        $this->assertNotEquals($translatedPage->ID, $origPage->ID);
836
837
        $subsequentTranslatedPage = $origPage->createTranslation('de_DE');
838
        $this->assertEquals(
839
            $translatedPage->ID,
840
            $subsequentTranslatedPage->ID,
841
            'Subsequent calls to createTranslation() dont cause new records in database'
842
        );
843
    }
844
845
    public function testTranslatablePropertiesOnDataObject()
846
    {
@@ 1277-1295 (lines=19) @@
1274
        // );
1275
    }
1276
1277
    public function testSiteTreeGetByLinkFindsTranslationWithoutLocale()
1278
    {
1279
        $parent = $this->objFromFixture(Page::class, 'parent');
1280
1281
        $parentTranslation = $parent->createTranslation('en_AU');
1282
        $parentTranslation->URLSegment = 'parent-en-AU';
1283
        $parentTranslation->write();
1284
1285
        $match = SiteTree::get_by_link($parentTranslation->URLSegment);
1286
        $this->assertNotNull(
1287
            $match,
1288
            'SiteTree::get_by_link() doesnt need a locale setting to find translated pages'
1289
        );
1290
        $this->assertEquals(
1291
            $parentTranslation->ID,
1292
            $match->ID,
1293
            'SiteTree::get_by_link() doesnt need a locale setting to find translated pages'
1294
        );
1295
    }
1296
}
1297