@@ 39-45 (lines=7) @@ | ||
36 | ||
37 | } |
|
38 | ||
39 | public function testHash() |
|
40 | { |
|
41 | $actual = $this->hmac->create($this->data); |
|
42 | $expected = hash_hmac($this->algo, json_encode($this->data) , $this->privateKey); |
|
43 | $result = $this->hmac->verify($actual, $expected); |
|
44 | $this->assertEquals(true, $result); |
|
45 | } |
|
46 | ||
47 | public function testCompareHash() |
|
48 | { |
|
@@ 70-76 (lines=7) @@ | ||
67 | $this->auth->compareHash($encodedHash, $differentPayload); |
|
68 | } |
|
69 | ||
70 | public function testVerify() |
|
71 | { |
|
72 | $hash1 = hash_hmac($this->algo, json_encode($this->data), $this->privateKey); |
|
73 | $expected = true; |
|
74 | $actual = $this->hmac->verify($hash1, $this->data); |
|
75 | $this->assertEquals($expected, $actual); |
|
76 | } |
|
77 | ||
78 | public function testVerifyHashWrongKey() |
|
79 | { |