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 | 265 | $user_fullname = $this->_getCurrentUserFullNameFromSession($session_user); |
266 | 266 | //debug($user_fullname); |
267 | 267 | // "Pallier Etienne" |
268 | + | |
268 | 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 | 236 | |
237 | 237 | |
238 | 238 | |
239 | - <!-- QRCODE (Url) --> | |
239 | + <!-- 1) QRCODE (Url) --> | |
240 | + | |
240 | 241 | <?php |
241 | 242 | //debug($this->request->env('HTTP_REFERER')); // 'http://labinvent.test/materiels' |
242 | 243 | //debug($this->request); |
243 | - // 1) Création | |
244 | + // - a) Création | |
244 | 245 | //$proto = $this->request->env('REQUEST_SCHEME'); |
245 | 246 | //$proto = $this->request->env('HTTP_REFERER'); |
246 | 247 | $proto = $this->request->getEnv('HTTP_REFERER'); |
... | ... | @@ -256,7 +257,7 @@ $CAN_PRINT_LABEL = $IS_VALIDATED && $configuration->hasPrinter && $USER_IS_ADMIN |
256 | 257 | // Il faut normalement remplacer requestAction par un view Cell |
257 | 258 | $this->requestAction('/QrCodes/creer/'); |
258 | 259 | |
259 | - // 2) Affichage | |
260 | + // - b) Affichage | |
260 | 261 | //echo '<div id="qrcode" style="text-align: left;">'; |
261 | 262 | ?> |
262 | 263 | <div id="qrcode"> |
... | ... | @@ -271,7 +272,8 @@ $CAN_PRINT_LABEL = $IS_VALIDATED && $configuration->hasPrinter && $USER_IS_ADMIN |
271 | 272 | </div> |
272 | 273 | |
273 | 274 | |
274 | - <!-- 0 à N IMAGE(S) --> | |
275 | + <!-- 2) IMAGE(S) --> | |
276 | + | |
275 | 277 | <div id="materiel_images"> |
276 | 278 | <!-- <div id="materiel_images" style="text-align: center;"> --> |
277 | 279 | <?php | ... | ... |
tests/Fixture/StatsFixture.php
... | ... | @@ -8,11 +8,17 @@ use Cake\TestSuite\Fixture\TestFixture; |
8 | 8 | */ |
9 | 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 | 16 | * Fields |
13 | 17 | * |
14 | 18 | * @var array |
15 | 19 | */ |
20 | + | |
21 | + /* (EP) | |
16 | 22 | // @codingStandardsIgnoreStart |
17 | 23 | public $fields = [ |
18 | 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 | 40 | 'collation' => 'latin1_swedish_ci' |
35 | 41 | ], |
36 | 42 | ]; |
43 | + */ | |
44 | + | |
37 | 45 | // @codingStandardsIgnoreEnd |
38 | 46 | /** |
39 | 47 | * Init method |
... | ... | @@ -42,6 +50,9 @@ class StatsFixture extends TestFixture |
42 | 50 | */ |
43 | 51 | public function init() |
44 | 52 | { |
53 | + // (EP) | |
54 | + $this->records = []; | |
55 | + /* | |
45 | 56 | $this->records = [ |
46 | 57 | [ |
47 | 58 | 'year' => 'a4a821dd-3174-4fa5-9672-b2d5b3d9903c', |
... | ... | @@ -52,6 +63,7 @@ class StatsFixture extends TestFixture |
52 | 63 | 'connex_dur' => 1 |
53 | 64 | ], |
54 | 65 | ]; |
66 | + */ | |
55 | 67 | parent::init(); |
56 | 68 | } |
57 | 69 | } | ... | ... |
tests/TestCase/Controller/General.php
... | ... | @@ -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 | 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 | 407 | $user = [ |
406 | 408 | 'Auth' => [ |
407 | 409 | 'User' => [ |
410 | + // Nom | |
408 | 411 | 'sn' => [ |
409 | - 0 => $sn | |
412 | + 0 => $name | |
410 | 413 | ], |
414 | + // Email (normalement prenom.nom@test.fr) | |
411 | 415 | 'mail' => [ |
412 | 416 | 0 => 'testa@test.fr' |
413 | 417 | ], |
418 | + // Prenom | |
414 | 419 | 'givenname' => [ |
415 | 420 | 0 => $givenName |
416 | 421 | ], |
422 | + // LOGIN (normalement epallier) | |
417 | 423 | /* |
418 | 424 | 'cn' => [ |
419 | 425 | 0 => $cn |
420 | 426 | ], |
421 | 427 | */ |
422 | 428 | 'uid' => [ |
423 | - 0 => $cn | |
429 | + 0 => $login | |
424 | 430 | ], |
425 | 431 | 'userpassword' => [ |
426 | 432 | 0 => 'test' |
... | ... | @@ -440,7 +446,11 @@ class General extends TestCase { |
440 | 446 | } |
441 | 447 | |
442 | 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 | 454 | //$this->authUser('user1_SUPER', 'test1', 'test2'); |
445 | 455 | //$this->authUser('testa', 'user1', 'SUPER'); |
446 | 456 | } | ... | ... |