Esempio n. 1
0
 public function testSetItemsIsCollection()
 {
     $res = new Response();
     $res->setItems('items', array(array('some' => 'value', 'something' => 'else', 'another' => 'one'), array('some' => 'value2', 'something' => 'else2', 'another' => 'two')));
     $expected = array('entities' => array(array('properties' => array('some' => 'value', 'something' => 'else', 'another' => 'one')), array('properties' => array('some' => 'value2', 'something' => 'else2', 'another' => 'two'))));
     $format = new Formatter\Siren($res);
     $this->assertEquals($expected, $format->toArray());
 }
Esempio n. 2
0
 public function testSetItemsIsCollection()
 {
     $res = new Response();
     $res->setItems('items', array(array('some' => 'value', 'something' => 'else', 'another' => 'one'), array('some' => 'value2', 'something' => 'else2', 'another' => 'two')));
     $res->setItems('users', array(array('name' => 'Chester Tester', 'username' => 'test')));
     $expected = array('_embedded' => array('items' => array(array('some' => 'value', 'something' => 'else', 'another' => 'one'), array('some' => 'value2', 'something' => 'else2', 'another' => 'two')), 'users' => array(array('name' => 'Chester Tester', 'username' => 'test'))));
     $format = new Formatter\Hal($res);
     $this->assertEquals($expected, $format->toArray());
 }