HashTest   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 28
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A testHashSecureTrue() 0 2 1
A testHashDefault() 0 2 1
A testHashSecureSHA256() 0 2 1
A testHashSecureMD5() 0 2 1
1
<?php
2
/**
3
 * @author Alexandre (DaazKu) Chouinard <[email protected]>
4
 * @copyright 2009-2017 Vanilla Forums Inc.
5
 * @license GNU GPLv2 http://www.opensource.org/licenses/gpl-2.0.php
6
 */
7
8
namespace JsConnect\Tests;
9
10
/**
11
 * Unit tests hashing
12
 */
13
class HashTest extends \PHPUnit\Framework\TestCase {
0 ignored issues
show
Bug introduced by
The type PHPUnit\Framework\TestCase was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
14
15
    /**
16
     *  Test {@link jsHash} with no $secure parameter.
17
     */
18
    public function testHashDefault() {
19
        $this->assertEquals(md5('hashMe'), jsHash('hashMe'));
20
    }
21
22
    /**
23
     *  Test {@link jsHash} with true as the $secure parameter.
24
     */
25
    public function testHashSecureTrue() {
26
        $this->assertEquals(md5('hashMe'), jsHash('hashMe', true));
27
    }
28
29
    /**
30
     *  Test {@link jsHash} with 'md5' as the $secure parameter.
31
     */
32
    public function testHashSecureMD5() {
33
        $this->assertEquals(md5('hashMe'), jsHash('hashMe', 'md5'));
34
    }
35
36
    /**
37
     *  Test {@link jsHash} with 'sha256' as the $secure parameter.
38
     */
39
    public function testHashSecureSHA256() {
40
        $this->assertEquals(hash('sha256', 'hashMe'), jsHash('hashMe', 'sha256'));
41
    }
42
}
43