diff --git a/phpunit.xml b/phpunit.xml index e2199f1ff6dd8c04f574801bdc2bc19853884db4..952987b7644c2988cc5a40c044c78494c9f2c887 100755 --- a/phpunit.xml +++ b/phpunit.xml @@ -3,6 +3,7 @@ <testsuites> <testsuite name="Maarch Test Suite"> <file>test/unitTests/core/AuthenticationControllerTest.php</file> + <file>test/unitTests/core/PasswordControllerTest.php</file> <file>test/unitTests/app/user/UserControllerTest.php</file> <file>test/unitTests/app/document/DocumentControllerTest.php</file> </testsuite> diff --git a/src/core/models/AuthenticationModel.php b/src/core/models/AuthenticationModel.php index 52ba155e733c0259946485c838964d6d087d7818..f982f49c3630482c8b56cb468c0c7910868392aa 100755 --- a/src/core/models/AuthenticationModel.php +++ b/src/core/models/AuthenticationModel.php @@ -117,7 +117,7 @@ class AuthenticationModel 'lang' => empty($previousCookie['lang']) ? CoreConfigModel::getLanguage() : $previousCookie['lang'], 'cookieKey' => $cookieKey ]); - setcookie('maarchParapheurAuth', base64_encode($cookieData), $cookieTime, $cookiePath, '', false, false); + @setcookie('maarchParapheurAuth', base64_encode($cookieData), $cookieTime, $cookiePath, '', false, false); return true; } diff --git a/src/frontend/app/sidebar/sidebar.component.html b/src/frontend/app/sidebar/sidebar.component.html index f03dc1b90bc6f6218816391ce59657379c80ff0b..43bcf428fb5cc48aa32625e7cd0e33278fbe1e36 100755 --- a/src/frontend/app/sidebar/sidebar.component.html +++ b/src/frontend/app/sidebar/sidebar.component.html @@ -13,8 +13,8 @@ <header class="sidebar-header"> </header> <section class="sidebar-btn"> - <button class="btn btn-xs blue filter" [ngClass]="[mode == 'NOTE' ? 'active' : '']" (click)="filter('NOTE')">Annotation <span class="badgeNbDocument">{{signaturesService.documentsListCount["NOTE"]}}</span></button> - <button class="btn btn-xs blue filter" [ngClass]="[mode == 'SIGN' ? 'active' : '']" (click)="filter('SIGN')">Paraphe <span class="badgeNbDocument">{{signaturesService.documentsListCount["SIGN"]}}</span></button> + <button class="btn btn-xs blue filter" [ngClass]="[mode == 'NOTE' ? 'active' : '']" (click)="filter('NOTE')">Annotation <span *ngIf="signaturesService.documentsListCount['NOTE']" class="badgeNbDocument">{{signaturesService.documentsListCount["NOTE"]}}</span></button> + <button class="btn btn-xs blue filter" [ngClass]="[mode == 'SIGN' ? 'active' : '']" (click)="filter('SIGN')">Paraphe <span *ngIf="signaturesService.documentsListCount['SIGN']" class="badgeNbDocument">{{signaturesService.documentsListCount["SIGN"]}}</span></button> </section> </div> <ul #listContent class="nav" detect-scroll (onScroll)="handleScroll($event)" [bottomOffset]="1" [topOffset]="1"> diff --git a/test/unitTests/core/PasswordControllerTest.php b/test/unitTests/core/PasswordControllerTest.php new file mode 100755 index 0000000000000000000000000000000000000000..115228cc20d05e184c7d095646e2697995a5a36d --- /dev/null +++ b/test/unitTests/core/PasswordControllerTest.php @@ -0,0 +1,35 @@ +<?php + +/** +* Copyright Maarch since 2008 under licence GPLv3. +* See LICENCE.txt file at the root folder for more details. +* This file is part of Maarch software. +* +*/ + +use PHPUnit\Framework\TestCase; + +class PasswordControllerTest extends TestCase +{ + public function testGet() + { + $passwordController = new \SrcCore\controllers\PasswordController(); + + $environment = \Slim\Http\Environment::mock(['REQUEST_METHOD' => 'GET']); + $request = \Slim\Http\Request::createFromEnvironment($environment); + + $response = $passwordController->get($request, new \Slim\Http\Response()); + $responseBody = json_decode((string)$response->getBody()); + + $this->assertNotEmpty($responseBody->rules); + + foreach ($responseBody->rules as $value) { + $this->assertNotEmpty($value->id); + $this->assertInternalType('int', $value->id); + $this->assertNotEmpty($value->label); + $this->assertInternalType('int', $value->value); + $this->assertInternalType('boolean', $value->enabled); + } + + } +}