Skip to content
Snippets Groups Projects
Commit 696a5ec0 authored by Patrick Barroca's avatar Patrick Barroca :grin:
Browse files

Corrections tests

parent 902f1110
Branches
Tags
No related merge requests found
......@@ -86,29 +86,27 @@ class AdminAuthControllerNobodyLoggedTest extends Admin_AbstractControllerTestCa
class AdminAuthControllerWithRestrcitedProfilTest extends AbstractControllerTestCase {
class AdminAuthControllerWithRestrictedProfilTest extends AbstractControllerTestCase {
public function setup() {
parent::setUp();
Class_Users::beVolatile();
$tom= Class_Users::newInstanceWithId(5,
['login' => 'tom',
'password'=>'tom1',
'idabon' => 789456,
'role_level' => ZendAfi_Acl_AdminControllerRoles::INVITE,
'id_site' => 1,
'fiche_sigb' => []]);
$tom->save();
Class_Profil::beVolatile();
$profil_invite = Class_Profil::newInstanceWithId(1, ['access_level' => '0' ,'cfg_menus' => '']);
$profil_invite->save();
ZendAfi_Auth::getInstance()->logUser($tom);
$this->dispatch('/admin/index');
$this->fixture('Class_Profil', ['id' => 1,
'access_level' => '0',
'cfg_menus' => '']);
}
/** @test */
public function withAuthenticatedGuestAdminIndexShouldRedirectToOpac() {
public function guestAccessingAdminShouldBeRedirectedToOpac() {
ZendAfi_Auth::getInstance()->logUser(
$this->fixture('Class_Users', ['id' => 5,
'login' => 'tom',
'password'=>'tom1',
'idabon' => 789456,
'role_level' => ZendAfi_Acl_AdminControllerRoles::INVITE,
'id_site' => 1,
'fiche_sigb' => []]));
$this->dispatch('/admin/index');
$this->assertRedirectTo('/opac/');
}
}
......
......@@ -111,7 +111,6 @@ class IndexControllerAsAdminWithCSSEditorTest extends IndexControllerAsAdminTest
class IndexControllerWithInvitedLevelRestrictionForProfilTest extends AbstractControllerTestCase {
public function setup() {
parent::setup();
ZendAfi_Auth::getInstance()->clearIdentity();
......@@ -122,25 +121,8 @@ class IndexControllerWithInvitedLevelRestrictionForProfilTest extends AbstractCo
/** @test **/
public function profilWithAccessLevelShouldContainsFormAdminAuthLogin() {
$this->dispatch('/opac/index/index/id_profil/1');
$this->assertXPath('//form[@name="form"][contains(@action,"/admin/auth/login")]',$this->_response->getBody());
}
/** @test **/
public function postLoginShouldRedirectToOpac() {
ZendAfi_Auth::getInstance()->logUser(
Class_Users::newInstanceWithId(5,
['login' => 'tom',
'username' => 'tom',
'password'=>'tom1',
'idabon' => 789456,
'role_level' => ZendAfi_Acl_AdminControllerRoles::INVITE,
'id_site' => 1,
'fiche_sigb' => []]));
$this->postDispatch('/admin/auth/login',['username'=>'tom',
'password'=>'tom1']);
$this->assertXPath('//article',$this->_response->getBody());
$this->assertXPath('//form[@name="form"][contains(@action,"/admin/auth/login")]',
$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