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

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@97912 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2010-02-01 09:31:49 +00:00 committed by Sam Minnee
parent 810b2162da
commit 662ee20141
2 changed files with 17 additions and 1 deletions

View File

@ -30,7 +30,8 @@ class VirtualPage extends Page {
"Sort",
"Status",
'ShowInMenus',
'ShowInSearch'
'ShowInSearch',
'Locale'
);
$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() {
$publishedPage = new SiteTree();
$publishedPage->Locale = 'en_US';