mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 07:23:13 +00:00
Fix build APIs / Session
This commit is contained in:
@@ -318,6 +318,8 @@ class Core extends \Pimple
|
||||
$this->getRequest()->setLocale($cookies->get('locale'));
|
||||
}
|
||||
|
||||
\Session_Handler::set_locale($this->getRequest()->getLocale());
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@@ -1116,7 +1116,7 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
{
|
||||
$ret = array(
|
||||
'created_on' => $basket->getCreated()->format(DATE_ATOM)
|
||||
, 'description' => $basket->getDescription()
|
||||
, 'description' => (string) $basket->getDescription()
|
||||
, 'name' => $basket->getName()
|
||||
, 'pusher_usr_id' => $basket->getPusherId()
|
||||
, 'ssel_id' => $basket->getId()
|
||||
|
@@ -270,7 +270,7 @@ class API_V1_adapterTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
public function testSet_record_status()
|
||||
{
|
||||
$appbox = appbox::get_instance();
|
||||
$stub = $this->getMock("API_V1_adapter", array("list_record_status"), array(false, &$appbox));
|
||||
$stub = $this->getMock("API_V1_adapter", array("list_record_status"), array(false, &$appbox, bootstrap::getCore()));
|
||||
$appbox = appbox::get_instance();
|
||||
$databox = self::$record_1->get_databox();
|
||||
|
||||
@@ -307,7 +307,7 @@ class API_V1_adapterTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
public function testSet_record_collection()
|
||||
{
|
||||
$appbox = appbox::get_instance();
|
||||
$stub = $this->getMock("API_V1_adapter", array("list_record"), array(false, &$appbox));
|
||||
$stub = $this->getMock("API_V1_adapter", array("list_record"), array(false, &$appbox, bootstrap::getCore()));
|
||||
$databox = self::$record_1->get_databox();
|
||||
|
||||
$request = new Request(array("salut" => "salut c'est la fete"), array(), array(), array(), array(), array('HTTP_Accept' => 'application/json'));
|
||||
@@ -375,10 +375,10 @@ class API_V1_adapterTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
$repo = $em->getRepository('\Entities\Basket');
|
||||
|
||||
/* @var $repo \Repositories\BasketRepository */
|
||||
$repo->findUserBasket($ssel_id, self::$core->getAuthenticatedUser());
|
||||
$basket = $repo->findUserBasket($ssel_id, self::$core->getAuthenticatedUser());
|
||||
|
||||
$this->assertTrue($basket instanceof \Entities\Basket);
|
||||
$em->remove($Basket);
|
||||
$em->remove($basket);
|
||||
$em->flush();
|
||||
}
|
||||
|
||||
@@ -445,9 +445,11 @@ class API_V1_adapterTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
$this->assertEquals('application/json', $result->get_content_type());
|
||||
$this->assertTrue(is_object(json_decode($result->format())));
|
||||
|
||||
self::$core->getEntityManager()->refresh($basket);
|
||||
$repository =self::$core->getEntityManager()->getRepository('\Entities\Basket');
|
||||
|
||||
$this->assertEquals('PROUTO', $basket->getName());
|
||||
$ret_bask = $repository->find($basket->getId());
|
||||
|
||||
$this->assertEquals('PROUTO', $ret_bask->getName());
|
||||
}
|
||||
|
||||
public function testSet_basket_description()
|
||||
@@ -463,17 +465,17 @@ class API_V1_adapterTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
$this->assertEquals('application/json', $result->get_content_type());
|
||||
$this->assertTrue(is_object(json_decode($result->format())));
|
||||
|
||||
$em = self::$core->getEntityManager();
|
||||
/* @var $em \Doctrine\ORM\EntityManager */
|
||||
$em->refresh($basket);
|
||||
$repository =self::$core->getEntityManager()->getRepository('\Entities\Basket');
|
||||
|
||||
$this->assertEquals('une belle description', $basket->getDescription());
|
||||
$ret_bask = $repository->find($basket->getId());
|
||||
|
||||
$this->assertEquals('une belle description', $ret_bask->getDescription());
|
||||
}
|
||||
|
||||
public function testSearch_publications()
|
||||
{
|
||||
$appbox = appbox::get_instance();
|
||||
$stub = $this->getMock("API_V1_adapter", array("list_publication"), array(false, &$appbox));
|
||||
$stub = $this->getMock("API_V1_adapter", array("list_publication"), array(false, &$appbox, bootstrap::getCore()));
|
||||
$request = new Request(array(), array(), array(), array(), array(), array('HTTP_Accept' => 'application/json'));
|
||||
$feed = Feed_Adapter::create($appbox, self::$user, "hello", "salut");
|
||||
$result = $this->object->search_publications($request, self::$user);
|
||||
|
@@ -890,7 +890,7 @@ class API_V1_test_adapter extends PhraseanetWebTestCaseAbstract
|
||||
foreach ($content->response->basket as $basket_str)
|
||||
{
|
||||
$this->evaluateGoodBasket($basket_str);
|
||||
$this->assertEquals($basket_str->name, 'aéaa');
|
||||
$this->assertEquals($basket_str->name, '<strong>aéaa');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -924,10 +924,9 @@ class API_V1_test_adapter extends PhraseanetWebTestCaseAbstract
|
||||
|
||||
public function testDeleteBasket()
|
||||
{
|
||||
$basket = $this->insertOneBasket();
|
||||
$basket2 = $this->insertOneBasket();
|
||||
$baskets = $this->insertFiveBasket();
|
||||
|
||||
$route = '/baskets/' . $basket->getId() . '/delete/?oauth_token=' . self::$token;
|
||||
$route = '/baskets/' . $baskets[0]->getId() . '/delete/?oauth_token=' . self::$token;
|
||||
|
||||
$this->evaluateMethodNotAllowedRoute($route, array('GET', 'PUT', 'DELETE'));
|
||||
|
||||
@@ -947,7 +946,7 @@ class API_V1_test_adapter extends PhraseanetWebTestCaseAbstract
|
||||
}
|
||||
if(!$found)
|
||||
{
|
||||
$this->fail('There should be a basket left');
|
||||
$this->fail('There should be four baskets left');
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -897,7 +897,7 @@ class API_V1_test_adapterYaml extends PhraseanetWebTestCaseAbstract
|
||||
foreach ($content["response"]["basket"] as $basket_str)
|
||||
{
|
||||
$this->evaluateGoodBasket($basket_str);
|
||||
$this->assertEquals($basket_str["name"], 'aéaa');
|
||||
$this->assertEquals($basket_str["name"], '<strong>aéaa');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -928,10 +928,9 @@ class API_V1_test_adapterYaml extends PhraseanetWebTestCaseAbstract
|
||||
|
||||
public function testDeleteBasket()
|
||||
{
|
||||
$basket = $this->insertOneBasket();
|
||||
$basket2 = $this->insertOneBasket();
|
||||
$baskets = $this->insertFiveBasket();
|
||||
|
||||
$route = '/baskets/' . $basket->getId() . '/delete/?oauth_token=' . self::$token;
|
||||
$route = '/baskets/' . $baskets[0]->getId() . '/delete/?oauth_token=' . self::$token;
|
||||
|
||||
$this->evaluateMethodNotAllowedRoute($route, array('GET', 'PUT', 'DELETE'));
|
||||
|
||||
@@ -951,7 +950,7 @@ class API_V1_test_adapterYaml extends PhraseanetWebTestCaseAbstract
|
||||
}
|
||||
if (!$found)
|
||||
{
|
||||
$this->fail('There should be a basket left');
|
||||
$this->fail('There should be four baskets left');
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user