Files
Phraseanet/lib/unitTest/Alchemy/Phrasea/Controller/Prod/EditTest.php
Romain Neutron 5941bc73e3 Coding standards
2012-01-26 16:45:05 +01:00

100 lines
2.6 KiB
PHP

<?php
require_once __DIR__ . '/../../../../PhraseanetWebTestCaseAuthenticatedAbstract.class.inc';
require_once __DIR__ . '/../../../../../Alchemy/Phrasea/Controller/Prod/Edit.php';
/**
* Test class for Edit.
* Generated by PHPUnit on 2012-01-11 at 18:24:28.
*/
class ControllerEditTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
{
/**
* As controllers use WebTestCase, it requires a client
*/
protected $client;
/**
* If the controller tests require some records, specify it her
*
* For example, this will loacd 2 records
* (self::$record_1 and self::$record_2) :
*
* $need_records = 2;
*
*/
protected static $need_records = 1;
/**
* The application loader
*/
public function createApplication()
{
return require __DIR__ . '/../../../../../Alchemy/Phrasea/Application/Prod.php';
}
public function setUp()
{
parent::setUp();
$this->client = $this->createClient();
}
/**
* Default route test
*/
public function testRouteSlash()
{
$this->client->request('POST', '/records/edit/', array('lst' => self::$record_1->get_serialize_key()));
$response = $this->client->getResponse();
$this->assertTrue($response->isOk());
}
public function testApply()
{
$this->client->request('POST', '/records/edit/apply/', array('lst' => self::$record_1->get_serialize_key()));
$response = $this->client->getResponse();
$this->assertTrue($response->isOk());
}
public function testVocabulary()
{
$this->client->request('GET', '/records/edit/vocabulary/Zanzibar/');
$response = $this->client->getResponse();
$this->assertTrue($response->isOk());
$datas = json_decode($response->getContent());
$this->assertFalse($datas->success);
$this->client->request('GET', '/records/edit/vocabulary/User/');
$response = $this->client->getResponse();
$this->assertTrue($response->isOk());
$datas = json_decode($response->getContent());
$this->assertFalse($datas->success);
$params = array('sbas_id'=>self::$collection->get_sbas_id());
$this->client->request('GET', '/records/edit/vocabulary/Zanzibar/', $params);
$response = $this->client->getResponse();
$this->assertTrue($response->isOk());
$datas = json_decode($response->getContent());
$this->assertFalse($datas->success);
$params = array('sbas_id'=>self::$collection->get_sbas_id());
$this->client->request('GET', '/records/edit/vocabulary/User/', $params);
$response = $this->client->getResponse();
$this->assertTrue($response->isOk());
$datas = json_decode($response->getContent());
$this->assertTrue($datas->success);
}
}