Esempio n. 1
0
 /**
  *
  * @param  string  $jsonString
  * @return boolean
  */
 public function parseTradeMessage($jsonString)
 {
     // TODO: Usually we'd use some sort of tradeMessage model here to validate
     // the data structure
     $messageData = Places\Transform::jsonToArray($jsonString);
     // TODO: We should also sanitize the content of the JSON by checking for expected types
     return $this->passMessageToSocketServer($messageData);
 }
Esempio n. 2
0
 /**
  * 
  * @dataProvider getJsonTestData
  * @test
  */
 public function jsonToArrayTest($testJson, $expectedPass)
 {
     $array = \PlaceFinder\Places\Transform::jsonToArray($testJson);
     if (!$expectedPass) {
         $this->assertEmpty($array);
     } else {
         $this->assertCount(1, $array);
     }
 }