Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?php
/**
* Copyright (c) 2012-2023, Agence Française Informatique (AFI). All rights reserved.
*
* BOKEH is free software; you can redistribute it and/or modify
* it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
* the Free Software Foundation.
*
* There are special exceptions to the terms and conditions of the AGPL as it
* is applied to this software (see README file).
*
* BOKEH is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with BOKEH; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
abstract class UsersControllerRolesTestCase
extends Admin_AbstractControllerTestCase {
public function setUp() {
parent::setUp();
$this->fixture(Class_Bib::class,
['id' => 1,
'libelle' => 'Annecy']);
$this->fixture(Class_Bib::class,
['id' => 2,
'libelle' => 'Meythet']);
$this->fixture(Class_Users::class,
['id' => 10,
'idabon' => '65656',
'login' => 'bobo',
'password' => 'oo',
'mail' => 'bobo@bo.com',
'id_site' => 1,
'role_level' => ZendAfi_Acl_AdminControllerRoles::ABONNE_SIGB,
'last_login' => 0]);
$this->fixture(Class_Users::class,
['id' => 20,
'idabon' => '656789',
'login' => 'tutu',
'password' => 'ru',
'mail' => 'tutu@ru.com',
'id_site' => 2,
'role_level' => ZendAfi_Acl_AdminControllerRoles::ABONNE_SIGB,
'last_login' => 0]);
ZendAfi_Auth::getInstance()->logUser($this->_createUser());
$this->dispatch('/admin/users');
}
protected function _createUser() : ?Class_Users {
return null;
}
}
class UsersControllerRolesAdminBibTest
extends UsersControllerRolesTestCase {
protected function _createUser() : ?Class_Users {
$admin_bib = $this->fixture(Class_Users::class,
['id' => 1,
'login' => 'toto',
'password' => 'ro',
'mail' => 'toto@ro.com',
'id_site' => 1,
'managed_libraries' => '1;2',
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
'role_level' => ZendAfi_Acl_AdminControllerRoles::ADMIN_BIB,
'last_login' => 0]);
$user_group = $this->fixture(Class_UserGroup::class,
['id' => 28,
'libelle' => 'Admin Bib',
'rights' => [Class_UserGroup::RIGHT_USER_SIGB_USER_READ]]);
$admin_bib->addUserGroup($user_group);
return $admin_bib;
}
/** @test */
public function pageShouldContainsH1_GestionDesUtilisateurs() {
$this->assertXPathContentContains('//h1', 'Gestion des utilisateurs');
}
/** @test */
public function inputBibliothequeShouldNotExist() {
$this->assertNotXPath('//select[@id="search_id_site"]');
}
/** @test */
public function usersTableShouldContainIdentifiantBobo() {
$this->assertXPath('//table[@id="users_table"]/tbody/tr/td[text()="bobo"]');
}
/** @test */
public function usersTableShouldNotContainIdentifiantTutu() {
$this->assertNotXPath('//table[@id="users_table"]//td[text()="tutu"]');
}
}
class UsersControllerRolesAdminPortailTest
extends UsersControllerRolesTestCase {
protected function _createUser() : ?Class_Users {
return $this->fixture(Class_Users::class,
['id' => 1,
'login' => 'toto',
'password' => 'ro',
'mail' => 'toto@ro.com',
'id_site' => 1,
'role_level' => ZendAfi_Acl_AdminControllerRoles::ADMIN_PORTAIL,
'last_login' => 0]);
}
/** @test */
public function pageShouldContainsH1_GestionDesUtilisateurs() {
$this->assertXPathContentContains('//h1', 'Gestion des utilisateurs');
}
/** @test */
public function inputBibliothequeShouldExist() {
$this->assertXPath('//select[@id="search_id_site"]');
}
/** @test */
public function usersTableShouldContainIdentifiantBobo() {
$this->assertXPath('//table[@id="users_table"]/tbody/tr/td[text()="bobo"]');
}
/** @test */
public function usersTableShouldContainIdentifiantTutu() {
$this->assertXPath('//table[@id="users_table"]/tbody/tr/td[text()="tutu"]');
}
}