Example #1
0
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  */
 protected function setUp()
 {
     # Set up the encryption parameters
     Arc4::setKey("0123456789abcdeffedcba9876543210");
     Arc4::setMagic("MAGIC");
     Arc4::useCompression("true");
 }
Example #2
0
 /**
  * @covers Cougar\Util\Arc4::setMagic
  * @covers Cougar\Util\Arc4::useCompression
  * @covers Cougar\Util\Arc4::setKey
  * @covers Cougar\Util\Arc4::encode
  */
 public function testEncodeDecodeWithCompressionAndMagic()
 {
     Arc4::setKey(bin2hex("d8vsR7nnKmG4FwKgX82gzW58QtDWiZGnjVedrZsNnG"));
     Arc4::setMagic("Magic string");
     Arc4::useCompression(true);
     # Define a list of strings
     $strings = array("Hello", "Hello World!", "Attack at dawn", "The quick brown fox jumps over the lazy dog.");
     # Go through each string and encode/decode
     foreach ($strings as $string) {
         $encoded_string = Arc4::encode($string);
         $decoded_string = Arc4::decode($encoded_string);
         $this->assertEquals($string, $decoded_string);
     }
 }