Esempio n. 1
0
 /**
  * Two dimensions mixed array
  *
  * @group Core
  * @group API
  * @group API_ResponseBuilder
  */
 public function testConvertMultiDimensionalMixedArrayToJson()
 {
     $input = array("firstElement" => "isFirst", array("firstElement", "secondElement"), "thirdElement" => array("firstElement" => "isFirst", "secondElement" => "isSecond"));
     $expected = json_encode($input);
     $actual = Piwik_API_ResponseBuilder::convertMultiDimensionalArrayToJson($input);
     $this->assertEquals($expected, $actual);
 }
Esempio n. 2
0
 function test_convertMultiDimensionalArrayToJson()
 {
     // Two dimensions standard array
     $input = array("firstElement", array("firstElement", "secondElement"), "thirdElement");
     $this->assertEqual(Piwik_API_ResponseBuilder::convertMultiDimensionalArrayToJson($input), json_encode($input));
     // Two dimensions associative array
     $input = array("firstElement" => "isFirst", "secondElement" => array("firstElement" => "isFirst", "secondElement" => "isSecond"), "thirdElement" => "isThird");
     $this->assertEqual(Piwik_API_ResponseBuilder::convertMultiDimensionalArrayToJson($input), json_encode($input));
     // Two dimensions mixed array
     $input = array("firstElement" => "isFirst", array("firstElement", "secondElement"), "thirdElement" => array("firstElement" => "isFirst", "secondElement" => "isSecond"));
     $this->assertEqual(Piwik_API_ResponseBuilder::convertMultiDimensionalArrayToJson($input), json_encode($input));
 }