|
@@ -19,13 +19,13 @@ discard block |
|
|
block discarded – undo |
|
19
|
19
|
public function testGetHashIdNode() |
|
20
|
20
|
{ |
|
21
|
21
|
// Valid JSON proof |
|
22
|
|
- $proofValid = file_get_contents(realpath(__DIR__) . '/../fixture/proof-valid.json'); |
|
|
22
|
+ $proofValid = file_get_contents(realpath(__DIR__).'/../fixture/proof-valid.json'); |
|
23
|
23
|
$proofField = ChainpointProof::create()->setValue($proofValid); |
|
24
|
24
|
|
|
25
|
25
|
$this->assertEquals('bd469a90-7922-11e8-91f0-01201f800553', $proofField->getHashIdNode()); |
|
26
|
26
|
|
|
27
|
27
|
// Invalid: Missing hash_id_node |
|
28
|
|
- $proofInValid = file_get_contents(realpath(__DIR__) . '/../fixture/proof-invalid-no-hashid.json'); |
|
|
28
|
+ $proofInValid = file_get_contents(realpath(__DIR__).'/../fixture/proof-invalid-no-hashid.json'); |
|
29
|
29
|
$proofField = ChainpointProof::create()->setValue($proofInValid); |
|
30
|
30
|
|
|
31
|
31
|
$this->assertEquals('', $proofField->getHashIdNode()); |
|
@@ -34,13 +34,13 @@ discard block |
|
|
block discarded – undo |
|
34
|
34
|
public function testGetHash() |
|
35
|
35
|
{ |
|
36
|
36
|
// Valid JSON proof |
|
37
|
|
- $proofValid = file_get_contents(realpath(__DIR__) . '/../fixture/proof-valid.json'); |
|
|
37
|
+ $proofValid = file_get_contents(realpath(__DIR__).'/../fixture/proof-valid.json'); |
|
38
|
38
|
$proofField = ChainpointProof::create()->setValue($proofValid); |
|
39
|
39
|
|
|
40
|
40
|
$this->assertEquals('611d8759d9de000cd7fd4abef8d95ee9f2571bc8b953f8efbba21b110e1bbf0e', $proofField->getHash()); |
|
41
|
41
|
|
|
42
|
42
|
// Invalid: Missing hash |
|
43
|
|
- $proofInValid = file_get_contents(realpath(__DIR__) . '/../fixture/proof-invalid-no-hash.json'); |
|
|
43
|
+ $proofInValid = file_get_contents(realpath(__DIR__).'/../fixture/proof-invalid-no-hash.json'); |
|
44
|
44
|
$proofField = ChainpointProof::create()->setValue($proofInValid); |
|
45
|
45
|
|
|
46
|
46
|
$this->assertEquals('', $proofField->getHash()); |
|
@@ -49,13 +49,13 @@ discard block |
|
|
block discarded – undo |
|
49
|
49
|
public function testMatch() |
|
50
|
50
|
{ |
|
51
|
51
|
// Valid JSON proof |
|
52
|
|
- $proofValid = file_get_contents(realpath(__DIR__) . '/../fixture/proof-valid.json'); |
|
|
52
|
+ $proofValid = file_get_contents(realpath(__DIR__).'/../fixture/proof-valid.json'); |
|
53
|
53
|
$proofField = ChainpointProof::create()->setValue($proofValid); |
|
54
|
54
|
|
|
55
|
55
|
$this->assertTrue($proofField->match('611d8759d9de000cd7fd4abef8d95ee9f2571bc8b953f8efbba21b110e1bbf0e')); |
|
56
|
56
|
|
|
57
|
57
|
// Invalid: Mismatched hash passed |
|
58
|
|
- $proofValid = file_get_contents(realpath(__DIR__) . '/../fixture/proof-valid.json'); |
|
|
58
|
+ $proofValid = file_get_contents(realpath(__DIR__).'/../fixture/proof-valid.json'); |
|
59
|
59
|
$proofField = ChainpointProof::create()->setValue($proofValid); |
|
60
|
60
|
|
|
61
|
61
|
$this->assertFalse($proofField->match('61d8759d9de000cd7fd4abef8d95ee9f2571bc8b953f8efbba21b110e1bbf0e')); |