Code Duplication    Length = 15-19 lines in 2 locations

tests/unit/TranslatableTest.php 2 locations

@@ 786-800 (lines=15) @@
783
        );
784
    }
785
    
786
    public function testCreateTranslationOnSiteTree()
787
    {
788
        $origPage = $this->objFromFixture('Page', 'testpage_en');
789
        $translatedPage = $origPage->createTranslation('de_DE');
790
    
791
        $this->assertEquals($translatedPage->Locale, 'de_DE');
792
        $this->assertNotEquals($translatedPage->ID, $origPage->ID);
793
    
794
        $subsequentTranslatedPage = $origPage->createTranslation('de_DE');
795
        $this->assertEquals(
796
            $translatedPage->ID,
797
            $subsequentTranslatedPage->ID,
798
            'Subsequent calls to createTranslation() dont cause new records in database'
799
        );
800
    }
801
    
802
    public function testTranslatablePropertiesOnDataObject()
803
    {
@@ 1228-1246 (lines=19) @@
1225
        // );
1226
    }
1227
    
1228
    public function testSiteTreeGetByLinkFindsTranslationWithoutLocale()
1229
    {
1230
        $parent = $this->objFromFixture('Page', 'parent');
1231
        
1232
        $parentTranslation = $parent->createTranslation('en_AU');
1233
        $parentTranslation->URLSegment = 'parent-en-AU';
1234
        $parentTranslation->write();
1235
        
1236
        $match = Sitetree::get_by_link($parentTranslation->URLSegment);
1237
        $this->assertNotNull(
1238
            $match,
1239
            'SiteTree::get_by_link() doesnt need a locale setting to find translated pages'
1240
        );
1241
        $this->assertEquals(
1242
            $parentTranslation->ID,
1243
            $match->ID,
1244
            'SiteTree::get_by_link() doesnt need a locale setting to find translated pages'
1245
        );
1246
    }
1247
}
1248
1249
class TranslatableTest_OneByLocaleDataObject extends DataObject implements TestOnly