diff --git a/core/lib/Thelia/Tests/Action/ContentTest.php b/core/lib/Thelia/Tests/Action/ContentTest.php index e5021ea74..4417cd7ea 100644 --- a/core/lib/Thelia/Tests/Action/ContentTest.php +++ b/core/lib/Thelia/Tests/Action/ContentTest.php @@ -288,6 +288,7 @@ class ContentTest extends TestCaseWithURLToolSetup $this->assertNull($testAssociation); } + /** * @return \Thelia\Model\Content */ @@ -320,9 +321,7 @@ class ContentTest extends TestCaseWithURLToolSetup $folder->setVisible(1); $folder->setPosition(1); - $folder - ->setLocale('en_US') - ->setTitle('folder test'); + $this->setI18N($folder, "folder"); $folder->save(); @@ -334,9 +333,7 @@ class ContentTest extends TestCaseWithURLToolSetup $content->setVisible(1); $content->setPosition($i + 1); - $content - ->setLocale('en_US') - ->setTitle(sprintf('content test %s', $i)); + $this->setI18N($content, "content"); $contentFolders = $content->getContentFolders(); $collection = new Collection(); @@ -353,6 +350,24 @@ class ContentTest extends TestCaseWithURLToolSetup return self::$folderForPositionTest; } + /** + * Set the title of te object in all locales + * + * @param mixed $object + * @param string $title + */ + public function setI18N(&$object, $title) + { + + $localeList = array('fr_FR', 'en_US', 'es_ES', 'it_IT'); + + foreach ($localeList as $locale) { + $object->setLocale($locale); + $object->setTitle($locale . ' : ' . $title); + } + + } + /** * @return \Thelia\Model\Folder */ diff --git a/core/lib/Thelia/Tests/Action/FolderTest.php b/core/lib/Thelia/Tests/Action/FolderTest.php index bd7be2366..cc29c3e93 100644 --- a/core/lib/Thelia/Tests/Action/FolderTest.php +++ b/core/lib/Thelia/Tests/Action/FolderTest.php @@ -297,9 +297,8 @@ class FolderTest extends TestCaseWithURLToolSetup $folder->setParent(0); $folder->setVisible(1); $folder->setPosition(1); - $folder - ->setLocale('en_US') - ->setTitle('folder test'); + + $this->setI18N($folder, "folder"); $folder->save(); @@ -311,9 +310,7 @@ class FolderTest extends TestCaseWithURLToolSetup $subFolder->setVisible(1); $subFolder->setPosition($i + 1); - $folder - ->setLocale('en_US') - ->setTitle(sprintf('folder test %s', $i)); + $this->setI18N($subFolder, "sub folder"); $subFolder->save(); } @@ -324,6 +321,23 @@ class FolderTest extends TestCaseWithURLToolSetup return self::$folderIdForPositionTest; } + /** + * Set the title of te object in all locales + * + * @param mixed $object + * @param string $title + */ + public function setI18N(&$object, $title) + { + + $localeList = array('fr_FR', 'en_US', 'es_ES', 'it_IT'); + + foreach ($localeList as $locale) { + $object->setLocale($locale); + $object->setTitle($locale . ' : ' . $title); + } + + } /** * @return \Thelia\Model\Folder