1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
/* |
6
|
|
|
* This file is part of the Zikula package. |
7
|
|
|
* |
8
|
|
|
* Copyright Zikula Foundation - https://ziku.la/ |
9
|
|
|
* |
10
|
|
|
* For the full copyright and license information, please view the LICENSE |
11
|
|
|
* file that was distributed with this source code. |
12
|
|
|
*/ |
13
|
|
|
|
14
|
|
|
namespace Zikula\ZAuthModule\Tests\Api; |
15
|
|
|
|
16
|
|
|
use PHPUnit\Framework\Error\Notice; |
|
|
|
|
17
|
|
|
use PHPUnit\Framework\TestCase; |
|
|
|
|
18
|
|
|
use Zikula\ZAuthModule\Api\ApiInterface\PasswordApiInterface; |
19
|
|
|
use Zikula\ZAuthModule\Api\PasswordApi; |
20
|
|
|
|
21
|
|
|
class PasswordApiTest extends TestCase |
22
|
|
|
{ |
23
|
|
|
/** |
24
|
|
|
* @var PasswordApiInterface |
25
|
|
|
*/ |
26
|
|
|
private $api; |
27
|
|
|
|
28
|
|
|
protected function setUp(): void |
29
|
|
|
{ |
30
|
|
|
$this->api = new PasswordApi(); |
|
|
|
|
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @covers PasswordApi::passwordsMatch() |
35
|
|
|
*/ |
36
|
|
|
public function testPasswordsMatch(): void |
37
|
|
|
{ |
38
|
|
|
$hashedPass = $this->api->getHashedPassword('12345678'); |
39
|
|
|
$this->assertTrue($this->api->passwordsMatch('12345678', $hashedPass)); |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* @covers PasswordApi::passwordsMatch() |
44
|
|
|
*/ |
45
|
|
|
public function testPasswordsMatchExceptionOnEmpty(): void |
46
|
|
|
{ |
47
|
|
|
$hashedPass = $this->api->getHashedPassword('12345678'); |
48
|
|
|
$this->assertFalse($this->api->passwordsMatch('', $hashedPass)); |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* @covers PasswordApi::passwordsMatch() |
53
|
|
|
*/ |
54
|
|
|
public function testPasswordsMatchExceptionOnNull(): void |
55
|
|
|
{ |
56
|
|
|
$this->expectException(\TypeError::class); |
57
|
|
|
$hashedPass = $this->api->getHashedPassword('12345678'); |
58
|
|
|
$this->api->passwordsMatch(null, $hashedPass); |
|
|
|
|
59
|
|
|
} |
60
|
|
|
} |
61
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths