Update tests

This commit is contained in:
Nicolas Le Goff
2012-10-16 16:36:34 +02:00
parent 53807cca4c
commit c1c14cccfa
4 changed files with 16 additions and 17 deletions

View File

@@ -39,7 +39,7 @@ class ExportTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
*/
public function testDisplayMultiExport()
{
self::$DI['client']->request('GET', '/prod/export/multi-export/', array('lst' => self::$DI['record_1']->get_serialize_key()));
self::$DI['client']->request('POST', '/prod/export/multi-export/', array('lst' => self::$DI['record_1']->get_serialize_key()));
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
unset($response);

View File

@@ -14,19 +14,18 @@ class QueryTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
*/
public function testQueryAnswerTrain()
{
\phrasea::start(self::$DI['app']['phraseanet.configuration']);
$auth = new \Session_Authentication_None(self::$DI['user']);
self::$DI['app']->openAccount($auth);
self::$DI['record_story_1'];
$options = new \searchEngine_options();
$serializedOptions = serialize($options);
self::$DI['record_story_1'];
$response = self::$DI['client']->request('POST', '/prod/query/answer-train/', array(
self::$DI['client']->request('POST', '/prod/query/answer-train/', array(
'options_serial' => $serializedOptions,
'pos' => 1,
'query' => ''
));
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
$datas = (array) json_decode($response->getContent());
$this->assertArrayHasKey('current', $datas);
@@ -38,16 +37,12 @@ class QueryTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
*/
public function testQueryRegTrain()
{
$request = Request::create('/prod/query/reg-train/', 'POST', array(
'pos' => 1,
'cont' => self::$DI['record_story_1']->get_serialize_key()
));
$response = self::$DI['client']->request('POST', '/prod/query/reg-train/', array(
self::$DI['client']->request('POST', '/prod/query/reg-train/', array(
'pos' => 1,
'cont' => self::$DI['record_story_1']->get_serialize_key()
));
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
unset($request, $response);
unset($response);
}
}

View File

@@ -14,7 +14,8 @@ class NotificationsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
*/
public function testListNotifications()
{
$response = $this->XMLHTTPRequest('GET', '/user/notifications/');
$this->XMLHTTPRequest('GET', '/user/notifications/');
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
unset($response);
}
@@ -42,9 +43,10 @@ class NotificationsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
*/
public function testSetNotificationsReaded()
{
$response = $this->XMLHTTPRequest('POST', '/user/notifications/read/', array(
$this->XMLHTTPRequest('POST', '/user/notifications/read/', array(
'notifications' => array()
));
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
$datas = (array) json_decode($response->getContent());
$this->assertArrayHasKey('success', $datas);

View File

@@ -24,7 +24,8 @@ class PreferencesTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
->with($this->equalTo('prop_test'), $this->equalTo('val_test'))
->will($this->returnValue(true));
$response = $this->XMLHTTPRequest('POST', '/user/preferences/', array('prop' => 'prop_test', 'value' => 'val_test'));
$this->XMLHTTPRequest('POST', '/user/preferences/', array('prop' => 'prop_test', 'value' => 'val_test'));
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
$datas = (array) json_decode($response->getContent());
$this->assertArrayHasKey('success', $datas);
@@ -56,7 +57,8 @@ class PreferencesTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
*/
public function testSaveTemporaryPref()
{
$response = $this->XMLHTTPRequest('POST', "/user/preferences/temporary/", array('prop' => 'prop_test', 'value' => 'val_test'));
$this->XMLHTTPRequest('POST', "/user/preferences/temporary/", array('prop' => 'prop_test', 'value' => 'val_test'));
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
$datas = (array) json_decode($response->getContent());
$this->assertArrayHasKey('success', $datas);