| @@ 23-35 (lines=13) @@ | ||
| 20 | protected $simpleItem = ['foo' => 'bar']; | |
| 21 | protected $simpleCollection = [['foo' => 'bar']]; | |
| 22 | ||
| 23 | public function testEmbedChildScope() | |
| 24 |     { | |
| 25 | $manager = new Manager(); | |
| 26 | ||
| 27 |         $resource = new Item(['foo' => 'bar'], function () { | |
| 28 | }); | |
| 29 | ||
| 30 | $scope = new Scope($manager, $resource, 'book'); | |
| 31 | $this->assertSame($scope->getScopeIdentifier(), 'book'); | |
| 32 |         $childScope = $scope->embedChildScope('author', $resource); | |
| 33 | ||
| 34 |         $this->assertInstanceOf('League\Fractal\Scope', $childScope); | |
| 35 | } | |
| 36 | ||
| 37 | public function testGetManager() | |
| 38 |     { | |
| @@ 567-583 (lines=17) @@ | ||
| 564 | * @covers \League\Fractal\Scope::toArray | |
| 565 | * @dataProvider fieldsetsProvider | |
| 566 | */ | |
| 567 | public function testToArrayWithFieldsets($fieldsetsToParse, $expected) | |
| 568 |     { | |
| 569 | $manager = new Manager(); | |
| 570 | ||
| 571 | $resource = new Item( | |
| 572 | ['foo' => 'bar', 'baz' => 'qux'], | |
| 573 |             function ($data) { | |
| 574 | return $data; | |
| 575 | }, | |
| 576 | 'resourceName' | |
| 577 | ); | |
| 578 | ||
| 579 | $scope = new Scope($manager, $resource); | |
| 580 | ||
| 581 | $manager->parseFieldsets($fieldsetsToParse); | |
| 582 | $this->assertSame($expected, $scope->toArray()); | |
| 583 | } | |
| 584 | ||
| 585 | public function fieldsetsProvider() | |
| 586 |     { | |