Commit eec4141e0eb65799f9f526d5bae20631ec5e884f
1 parent
93ab9e09
Exists in
master
and in
1 other branch
bugfix tests
Showing
4 changed files
with
33 additions
and
8 deletions
Show diff stats
src/Controller/UsersController.php
@@ -265,6 +265,7 @@ class UsersController extends AppController | @@ -265,6 +265,7 @@ class UsersController extends AppController | ||
265 | $user_fullname = $this->_getCurrentUserFullNameFromSession($session_user); | 265 | $user_fullname = $this->_getCurrentUserFullNameFromSession($session_user); |
266 | //debug($user_fullname); | 266 | //debug($user_fullname); |
267 | // "Pallier Etienne" | 267 | // "Pallier Etienne" |
268 | + | ||
268 | return $this->Users->find()->where(['nom'=>$user_fullname])->first(); | 269 | return $this->Users->find()->where(['nom'=>$user_fullname])->first(); |
269 | } | 270 | } |
270 | 271 |
src/Template/Materiels/view.ctp
@@ -236,11 +236,12 @@ $CAN_PRINT_LABEL = $IS_VALIDATED && $configuration->hasPrinter && $USER_IS_ADMIN | @@ -236,11 +236,12 @@ $CAN_PRINT_LABEL = $IS_VALIDATED && $configuration->hasPrinter && $USER_IS_ADMIN | ||
236 | 236 | ||
237 | 237 | ||
238 | 238 | ||
239 | - <!-- QRCODE (Url) --> | 239 | + <!-- 1) QRCODE (Url) --> |
240 | + | ||
240 | <?php | 241 | <?php |
241 | //debug($this->request->env('HTTP_REFERER')); // 'http://labinvent.test/materiels' | 242 | //debug($this->request->env('HTTP_REFERER')); // 'http://labinvent.test/materiels' |
242 | //debug($this->request); | 243 | //debug($this->request); |
243 | - // 1) Création | 244 | + // - a) Création |
244 | //$proto = $this->request->env('REQUEST_SCHEME'); | 245 | //$proto = $this->request->env('REQUEST_SCHEME'); |
245 | //$proto = $this->request->env('HTTP_REFERER'); | 246 | //$proto = $this->request->env('HTTP_REFERER'); |
246 | $proto = $this->request->getEnv('HTTP_REFERER'); | 247 | $proto = $this->request->getEnv('HTTP_REFERER'); |
@@ -256,7 +257,7 @@ $CAN_PRINT_LABEL = $IS_VALIDATED && $configuration->hasPrinter && $USER_IS_ADMIN | @@ -256,7 +257,7 @@ $CAN_PRINT_LABEL = $IS_VALIDATED && $configuration->hasPrinter && $USER_IS_ADMIN | ||
256 | // Il faut normalement remplacer requestAction par un view Cell | 257 | // Il faut normalement remplacer requestAction par un view Cell |
257 | $this->requestAction('/QrCodes/creer/'); | 258 | $this->requestAction('/QrCodes/creer/'); |
258 | 259 | ||
259 | - // 2) Affichage | 260 | + // - b) Affichage |
260 | //echo '<div id="qrcode" style="text-align: left;">'; | 261 | //echo '<div id="qrcode" style="text-align: left;">'; |
261 | ?> | 262 | ?> |
262 | <div id="qrcode"> | 263 | <div id="qrcode"> |
@@ -271,7 +272,8 @@ $CAN_PRINT_LABEL = $IS_VALIDATED && $configuration->hasPrinter && $USER_IS_ADMIN | @@ -271,7 +272,8 @@ $CAN_PRINT_LABEL = $IS_VALIDATED && $configuration->hasPrinter && $USER_IS_ADMIN | ||
271 | </div> | 272 | </div> |
272 | 273 | ||
273 | 274 | ||
274 | - <!-- 0 à N IMAGE(S) --> | 275 | + <!-- 2) IMAGE(S) --> |
276 | + | ||
275 | <div id="materiel_images"> | 277 | <div id="materiel_images"> |
276 | <!-- <div id="materiel_images" style="text-align: center;"> --> | 278 | <!-- <div id="materiel_images" style="text-align: center;"> --> |
277 | <?php | 279 | <?php |
tests/Fixture/StatsFixture.php
@@ -8,11 +8,17 @@ use Cake\TestSuite\Fixture\TestFixture; | @@ -8,11 +8,17 @@ use Cake\TestSuite\Fixture\TestFixture; | ||
8 | */ | 8 | */ |
9 | class StatsFixture extends TestFixture | 9 | class StatsFixture extends TestFixture |
10 | { | 10 | { |
11 | + | ||
12 | + // (EP) pour éviter d'avoir à décrire les champs | ||
13 | + public $import = ['model' => 'Stats']; | ||
14 | + | ||
11 | /** | 15 | /** |
12 | * Fields | 16 | * Fields |
13 | * | 17 | * |
14 | * @var array | 18 | * @var array |
15 | */ | 19 | */ |
20 | + | ||
21 | + /* (EP) | ||
16 | // @codingStandardsIgnoreStart | 22 | // @codingStandardsIgnoreStart |
17 | public $fields = [ | 23 | public $fields = [ |
18 | 'year' => ['type' => 'string', 'length' => null, 'null' => false, 'default' => null, 'collate' => null, 'comment' => '', 'precision' => null, 'fixed' => null], | 24 | 'year' => ['type' => 'string', 'length' => null, 'null' => false, 'default' => null, 'collate' => null, 'comment' => '', 'precision' => null, 'fixed' => null], |
@@ -34,6 +40,8 @@ class StatsFixture extends TestFixture | @@ -34,6 +40,8 @@ class StatsFixture extends TestFixture | ||
34 | 'collation' => 'latin1_swedish_ci' | 40 | 'collation' => 'latin1_swedish_ci' |
35 | ], | 41 | ], |
36 | ]; | 42 | ]; |
43 | + */ | ||
44 | + | ||
37 | // @codingStandardsIgnoreEnd | 45 | // @codingStandardsIgnoreEnd |
38 | /** | 46 | /** |
39 | * Init method | 47 | * Init method |
@@ -42,6 +50,9 @@ class StatsFixture extends TestFixture | @@ -42,6 +50,9 @@ class StatsFixture extends TestFixture | ||
42 | */ | 50 | */ |
43 | public function init() | 51 | public function init() |
44 | { | 52 | { |
53 | + // (EP) | ||
54 | + $this->records = []; | ||
55 | + /* | ||
45 | $this->records = [ | 56 | $this->records = [ |
46 | [ | 57 | [ |
47 | 'year' => 'a4a821dd-3174-4fa5-9672-b2d5b3d9903c', | 58 | 'year' => 'a4a821dd-3174-4fa5-9672-b2d5b3d9903c', |
@@ -52,6 +63,7 @@ class StatsFixture extends TestFixture | @@ -52,6 +63,7 @@ class StatsFixture extends TestFixture | ||
52 | 'connex_dur' => 1 | 63 | 'connex_dur' => 1 |
53 | ], | 64 | ], |
54 | ]; | 65 | ]; |
66 | + */ | ||
55 | parent::init(); | 67 | parent::init(); |
56 | } | 68 | } |
57 | } | 69 | } |
tests/TestCase/Controller/General.php
@@ -400,27 +400,33 @@ class General extends TestCase { | @@ -400,27 +400,33 @@ class General extends TestCase { | ||
400 | } | 400 | } |
401 | } | 401 | } |
402 | 402 | ||
403 | + // authUser('login', 'Prenom', 'Nom'); | ||
404 | + // ex: $this->authUser('u1SUPER', 'user1', 'SUPER'); | ||
403 | // ex: $this->authUser('user5_USER', 'test9', 'test0'); | 405 | // ex: $this->authUser('user5_USER', 'test9', 'test0'); |
404 | - private function authUser($cn, $givenName='test1', $sn='test2') { | 406 | + private function authUser($login, $givenName='test1', $name='test2') { |
405 | $user = [ | 407 | $user = [ |
406 | 'Auth' => [ | 408 | 'Auth' => [ |
407 | 'User' => [ | 409 | 'User' => [ |
410 | + // Nom | ||
408 | 'sn' => [ | 411 | 'sn' => [ |
409 | - 0 => $sn | 412 | + 0 => $name |
410 | ], | 413 | ], |
414 | + // Email (normalement prenom.nom@test.fr) | ||
411 | 'mail' => [ | 415 | 'mail' => [ |
412 | 0 => 'testa@test.fr' | 416 | 0 => 'testa@test.fr' |
413 | ], | 417 | ], |
418 | + // Prenom | ||
414 | 'givenname' => [ | 419 | 'givenname' => [ |
415 | 0 => $givenName | 420 | 0 => $givenName |
416 | ], | 421 | ], |
422 | + // LOGIN (normalement epallier) | ||
417 | /* | 423 | /* |
418 | 'cn' => [ | 424 | 'cn' => [ |
419 | 0 => $cn | 425 | 0 => $cn |
420 | ], | 426 | ], |
421 | */ | 427 | */ |
422 | 'uid' => [ | 428 | 'uid' => [ |
423 | - 0 => $cn | 429 | + 0 => $login |
424 | ], | 430 | ], |
425 | 'userpassword' => [ | 431 | 'userpassword' => [ |
426 | 0 => 'test' | 432 | 0 => 'test' |
@@ -440,7 +446,11 @@ class General extends TestCase { | @@ -440,7 +446,11 @@ class General extends TestCase { | ||
440 | } | 446 | } |
441 | 447 | ||
442 | public function authSuperAdmin() { | 448 | public function authSuperAdmin() { |
443 | - $this->authUser('user1_SUPER', 'user1', 'SUPER'); | 449 | + |
450 | + //$this->authUser('login', 'Prenom', 'Nom'); | ||
451 | + $this->authUser('u1SUPER', 'user1', 'SUPER'); | ||
452 | + ///$this->authUser('user1_SUPER', 'user1', 'SUPER'); | ||
453 | + | ||
444 | //$this->authUser('user1_SUPER', 'test1', 'test2'); | 454 | //$this->authUser('user1_SUPER', 'test1', 'test2'); |
445 | //$this->authUser('testa', 'user1', 'SUPER'); | 455 | //$this->authUser('testa', 'user1', 'SUPER'); |
446 | } | 456 | } |