Permalink
Browse files

BUGFIX Allowing translations of VirtualPage by not copying over origi…

…nal Locale property (see #5000) (from r97912)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@102554 467b73ca-7a2a-4603-9d3b-597d59a354a9
  • Loading branch information...
1 parent 48bd1ff commit 6c0efa68de08b9074099dfb3817dd24581368dcb @chillu chillu committed Apr 13, 2010
Showing with 17 additions and 1 deletion.
  1. +2 −1 core/model/VirtualPage.php
  2. +15 −0 tests/model/TranslatableTest.php
@@ -30,7 +30,8 @@ function getVirtualFields() {
"Sort",
"Status",
'ShowInMenus',
- 'ShowInSearch'
+ 'ShowInSearch',
+ 'Locale'
);
$allFields = $this->db();
@@ -681,6 +681,21 @@ function testSiteTreeChangePageTypeInMaster() {
);
}
+ 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';

0 comments on commit 6c0efa6

Please sign in to comment.