fixed new issue on rewriting test due to blank titles on some locale

This commit is contained in:
Julien Chanséaume
2014-07-04 10:34:00 +02:00
parent 9d79f42ae1
commit 5dae84f0fd
2 changed files with 41 additions and 12 deletions

View File

@@ -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
*/

View File

@@ -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