示例#1
0
 /**
  * tests compile
  */
 public function test_compileAssociative()
 {
     $data = Hip::encode(array('who' => 'let the dogs out', 'theAnswerToLifeTheUniverseAndEverything' => 42));
     $this->assertEquals($this->getExpectedHip('associative'), $data);
     // more layers
     $data = Hip::encode(array('this' => array('is' => array('pretty' => array('high' => 'doe')))));
     $this->assertEquals($this->getExpectedHip('associative3D'), $data);
     // natives
     $data = Hip::encode(array('string' => 'string', 'int' => 42, 'float' => 3.14, 'true' => true, 'false' => false, 'null' => null));
     $this->assertEquals($this->getExpectedHip('associativeNatives'), $data);
 }
示例#2
0
 /**
  * Get an expected hip data string
  *
  * @dataProvider arrayDataProvider
  */
 public function testItAndIfAllWorkImHappy($array)
 {
     $hip = Hip::encode($array);
     // Debugging
     /*echo "\n";
     		echo var_dump( $array );
     		echo "\n";
     		
     		echo "\n".$hip."\n";
     		
     		echo "\n";
     		echo var_dump(  Hip::decode( $hip ) );
     		echo "\n";*/
     $this->assertEquals($array, Hip::decode($hip));
 }
示例#3
0
 /**
  * Test multiple arrays
  */
 public function test_multipleArrays()
 {
     // simple array
     $data = Hip::decode("'foo'\n\tyes\n'foo'\n\tyes\n");
     $this->assertEquals(array('foo', array(true), 'foo', array(true)), $data);
 }