BUGFIX Allowing translations of VirtualPage by not copying over original Locale property (see #5000) (from r97912)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@102554 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2010-04-13 01:44:23 +00:00
parent 48bd1ffa24
commit 6c0efa68de
2 changed files with 17 additions and 1 deletions

View File

@ -30,7 +30,8 @@ class VirtualPage extends Page {
"Sort", "Sort",
"Status", "Status",
'ShowInMenus', 'ShowInMenus',
'ShowInSearch' 'ShowInSearch',
'Locale'
); );
$allFields = $this->db(); $allFields = $this->db();

View File

@ -681,6 +681,21 @@ class TranslatableTest extends FunctionalTest {
); );
} }
function testLocalePersistsInAllPageTypes() {
$types = ClassInfo::subclassesFor('SiteTree');
foreach($types as $type) {
if(singleton($type) instanceof TestOnly) continue;
$enPage = new $type();
$enPage->Locale = 'en_US';
$enPage->write();
$dePage = $enPage->createTranslation('de_DE');
$dePage->write();
$this->assertEquals('de_DE', $dePage->Locale, "Page type $type retains Locale property");
}
}
function testGetTranslationByStage() { function testGetTranslationByStage() {
$publishedPage = new SiteTree(); $publishedPage = new SiteTree();
$publishedPage->Locale = 'en_US'; $publishedPage->Locale = 'en_US';