PHP Classes
elePHPant
Icontem

File: tests/VerifierTest.php

Recommend this page to a friend!
  Classes of Scott Arciszewski  >  PHP Blake Chain  >  tests/VerifierTest.php  >  Download  
File: tests/VerifierTest.php
Role: Class source
Content type: text/plain
Description: Class source
Class: PHP Blake Chain
Create and verify chained blocks of hashed data
Author: By
Last change:
Date: 6 days ago
Size: 901 bytes
 

 

Contents

Class file image Download
<?php
namespace ParagonIE\Blakechain\UnitTests;

use
ParagonIE\Blakechain\{
   
Blakechain,
   
Node,
   
Verifier
};
use
PHPUnit\Framework\TestCase;

/**
 * Class VerifierTest
 * @package ParagonIE\Blakechain\UnitTests
 */
class VerifierTest extends TestCase
{
   
/**
     * @covers Verifier::verifyLastHash()
     */
   
public function testVerifyLastHash()
    {
       
$verifier = new Verifier;
       
$chainA = new Blakechain(
            new
Node('abcdef'),
            new
Node('abcdefg'),
            new
Node('abcdefh'),
            new
Node('abcde'),
            new
Node('abcdefj')
        );

       
$this->assertTrue(
           
$verifier->verifyLastHash($chainA, $chainA->getLastHash())
        );
       
$chainB = clone $chainA;
       
$chainB->appendData('');

       
$this->assertFalse(
           
$verifier->verifyLastHash($chainB, $chainA->getLastHash())
        );
    }
}