public function testConvertingToJsonJustReturnsIds() { $coll = new JitCollection([Post::create(['id' => 1]), Post::create(['id' => 2]), Post::create(['id' => 3]), Post::create(['id' => 4]), 5, 6, 7, 8, 9]); $this->assertEquals('[1,2,3,4,5,6,7,8,9]', json_encode($coll)); }
public function testJsonEncodingCollectionsEncodesModels() { $this->expectOutputString('[{"label":null,"created_date":null,"id":1}]'); $posts = new DynamicCollection('Efficio\\Tests\\Dataset\\Post'); $posts[] = \Efficio\Tests\Dataset\Post::create(['id' => 1]); echo json_encode($posts); }