示例#1
0
 public function testViewNotFound()
 {
     $data = self::$objects;
     try {
         $a = \JsonApiBuilder::setData([$data['user']])->entity('auth.show1')->relationships(['comments', 'posts'])->included(['interests']);
     } catch (\Exception $e) {
         $this->assertEquals($e->getCode(), 0);
         $this->assertEquals($e->getMessage(), "View [auth.show1] not found.");
     }
 }
示例#2
0
 public function testWith()
 {
     $default = self::$objects;
     $data = ['version' => '1.0', 'copyright' => 'ducl'];
     $a = \JsonApiBuilder::json()->meta($data)->response();
     $res = json_decode($a->content(), true);
     foreach ($res['meta'] as $key => $value) {
         $this->assertEquals($data[$key], $value);
     }
 }