Skip to content
Snippets Groups Projects
Commit 078b5857 authored by llaffont's avatar llaffont
Browse files

La boite panier n'affiche pas les paniers dans les domaines pour les utilisateurs < modo bib

parent a74fb3ec
Branches
Tags
No related merge requests found
......@@ -863,8 +863,9 @@ class AbonneController extends ZendAfi_Controller_Action {
$this->_helper->viewRenderer->setNoRender();
$data = [];
$data[] = Class_Users::getIdentity()->getPaniersJson();
$data[] = (new Class_Catalogue())->getDomainesJson(['removeCheckbox' => true]);
$data[] = $this->_user->getPaniersJson();
if ($this->_user->canAccessBackend())
$data[] = (new Class_Catalogue())->getDomainesJson(['removeCheckbox' => true]);
$JSON = json_encode($data);
......
......@@ -34,6 +34,9 @@ class AbonneControllerPaniersForMarcusTest extends AbstractControllerTestCase {
->setPrenom('James')
->setNom('Bond');
ZendAfi_Auth::getInstance()->logUser($this->marcus);
$this->panier_bd = Class_PanierNotice::newInstanceWithId(2,
['id_panier' => 1,
'libelle' => 'Mes BD',
......@@ -48,13 +51,15 @@ class AbonneControllerPaniersForMarcusTest extends AbstractControllerTestCase {
Storm_Test_ObjectWrapper::onLoaderOfModel('Class_Catalogue')
->whenCalled('findTopCatalogues')
->answers([]);
$this->dispatch('abonne/get-paniers.json',true);
}
/** @test **/
public function getPaniersShouldReturnMarcusPanierAsJSON() {
public function getPaniersAsAdminShouldReturnMarcusPanierAsJSON() {
$this->marcus->beModoBib();
$this->dispatch('abonne/get-paniers.json',true);
$this->assertJsonStringEqualsJsonString(
$this->_response->getBody(),
json_encode([
......@@ -75,6 +80,29 @@ class AbonneControllerPaniersForMarcusTest extends AbstractControllerTestCase {
$this->_response->getBody());
}
/** @test **/
public function getPaniersAsInviteShouldReturnMarcusPanierWithoutDomainesAsJSON() {
$this->marcus->beInvite();
$this->dispatch('abonne/get-paniers.json',true);
$this->assertJsonStringEqualsJsonString(
$this->_response->getBody(),
json_encode([
["id" => "panier_for_user",
"label" => "Mes paniers",
"categories" => [],
"items" => [
["id" => 2,
"label" => "Mes BD",
"options" => ["ico" => BASE_URL."/public/admin/images/picto/paniers_16.png"]]],
"options" => ["multipleSelection" => false]]
]),
$this->_response->getBody());
}
}
?>
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment