コード例 #1
0
 public function testFullMethodsDataEntry()
 {
     $point = new Point();
     $point->setCityName('Barcelona')->setColor('ffffff')->setCssClass('mycss')->setCountryCode('ES')->setSize(8)->setLatitude('1.1')->setLongitude('2.2');
     $json = json_encode($point->toArray());
     $this->assertEquals('{"city":{"city_name":"Barcelona","country_code":"ES"},"latitude":"1.1","longitude":"2.2","size":8,"color":"ffffff","cssclass":"mycss"}', $json);
 }
コード例 #2
0
 public function testGetDataWithSomePoints()
 {
     $myMap = new Map();
     $point1 = new Point();
     $point1->setCityName('city 1');
     $point1->setColor('color 1');
     $point1->setCountryCode('ES');
     $point1->setSize(1);
     $point2 = new Point();
     $point2->setCityName('city 2');
     $point2->setColor('color 2');
     $point2->setCountryCode('ES');
     $point2->setSize(2);
     $myMap->addPoint($point1);
     $myMap->addPoint($point2);
     $expectedResult = array('points' => array('point' => array(array('city' => array('city_name' => $point1->getCityName(), 'country_code' => $point1->getCountryCode()), 'size' => $point1->getSize(), 'color' => $point1->getColor()), array('city' => array('city_name' => $point2->getCityName(), 'country_code' => $point2->getCountryCode()), 'size' => $point2->getSize(), 'color' => $point2->getColor()))));
     $this->assertSame($expectedResult, $myMap->getData());
 }