PHP Classes
elePHPant
Icontem

File: tests/unit/CompatTest.php

Recommend this page to a friend!
  Classes of Scott Arciszewski  >  PHP Sodium Compat  >  tests/unit/CompatTest.php  >  Download  
File: tests/unit/CompatTest.php
Role: Class source
Content type: text/plain
Description: Class source
Class: PHP Sodium Compat
Cryptographic functions of libsodium in pure PHP
Author: By
Last change:
Date: 7 months ago
Size: 747 bytes
 

Contents

Class file image Download
<?php

class CompatTest extends PHPUnit_Framework_TestCase
{
    public function
setUp()
    {
       
ParagonIE_Sodium_Compat::$disableFallbackForUnitTests = true;
    }

    public function
testIncrement()
    {
       
$string = "\x00\x00\x00\x00\x00\x00\x00\x00";

       
ParagonIE_Sodium_Compat::increment($string);
       
$this->assertSame("0100000000000000", ParagonIE_Sodium_Core_Util::bin2hex($string));

       
ParagonIE_Sodium_Compat::increment($string);
       
$this->assertSame("0200000000000000", ParagonIE_Sodium_Core_Util::bin2hex($string));

       
$string = "\xff\xff\x01\x20";
       
ParagonIE_Sodium_Compat::increment($string);
       
$this->assertSame("00000220", ParagonIE_Sodium_Core_Util::bin2hex($string));
    }
}