Fix Controller testes

This commit is contained in:
Nicolas Le Goff
2011-12-28 12:54:03 +01:00
parent 19d5e43283
commit adfd069481
3 changed files with 19 additions and 185 deletions

View File

@@ -11,7 +11,6 @@
require_once __DIR__ . '/../../PhraseanetWebTestCaseAuthenticatedAbstract.class.inc';
use Doctrine\Common\DataFixtures\Loader;
use Alchemy\Phrasea\Helper;
use Alchemy\Phrasea\RouteProcessor as routeProcessor;
@@ -31,6 +30,7 @@ class WorkZoneTest extends PhraseanetWebTestCaseAuthenticatedAbstract
{
parent::setUp();
$this->client = $this->createClient();
$this->purgeDatabase();
}
public function createApplication()
@@ -41,7 +41,7 @@ class WorkZoneTest extends PhraseanetWebTestCaseAuthenticatedAbstract
public function testRootGet()
{
$this->loadOneWZ();
$this->insertOneWZ();
$route = "/WorkZone/";
@@ -52,45 +52,4 @@ class WorkZoneTest extends PhraseanetWebTestCaseAuthenticatedAbstract
$this->assertEquals(200, $response->getStatusCode());
}
protected function loadOneWZ()
{
try
{
$currentUser = self::$user;
$altUser = self::$user_alt1;
//add one basket
$basket = new PhraseaFixture\Basket\LoadOneBasket();
$basket->setUser($currentUser);
//add one story
$story = new PhraseaFixture\Story\LoadOneStory();
$story->setUser($currentUser);
$story->setRecord(self::$record_1);
//add a validation session initiated by alt user
$validationSession = new PhraseaFixture\ValidationSession\LoadOneValidationSession();
$validationSession->setUser($altUser);
$loader = new Loader();
$loader->addFixture($basket);
$loader->addFixture($story);
$loader->addFixture($validationSession);
$this->insertFixtureInDatabase($loader);
//add current user as participant
$validationParticipant = new PhraseaFixture\ValidationParticipant\LoadParticipantWithSession();
$validationParticipant->setSession($validationSession->validationSession);
$validationParticipant->setUser($currentUser);
$loader = new Loader();
$loader->addFixture($validationParticipant);
$this->insertFixtureInDatabase($loader);
}
catch (\Exception $e)
{
$this->fail($e->getMessage());
}
return;
}
}