| @@ 17-29 (lines=13) @@ | ||
| 14 | protected $simpleItem = ['foo' => 'bar']; |
|
| 15 | protected $simpleCollection = [['foo' => 'bar']]; |
|
| 16 | ||
| 17 | public function testEmbedChildScope() |
|
| 18 | { |
|
| 19 | $manager = new Manager(); |
|
| 20 | ||
| 21 | $resource = new Item(['foo' => 'bar'], function () { |
|
| 22 | }); |
|
| 23 | ||
| 24 | $scope = new Scope($manager, $resource, 'book'); |
|
| 25 | $this->assertSame($scope->getScopeIdentifier(), 'book'); |
|
| 26 | $childScope = $scope->embedChildScope('author', $resource); |
|
| 27 | ||
| 28 | $this->assertInstanceOf('League\Fractal\Scope', $childScope); |
|
| 29 | } |
|
| 30 | ||
| 31 | public function testGetManager() |
|
| 32 | { |
|
| @@ 435-451 (lines=17) @@ | ||
| 432 | * @covers League\Fractal\Scope::toArray |
|
| 433 | * @dataProvider fieldsetsProvider |
|
| 434 | */ |
|
| 435 | public function testToArrayWithFieldsets($fieldsetsToParse, $expected) |
|
| 436 | { |
|
| 437 | $manager = new Manager(); |
|
| 438 | ||
| 439 | $resource = new Item( |
|
| 440 | ['foo' => 'bar', 'baz' => 'qux'], |
|
| 441 | function ($data) { |
|
| 442 | return $data; |
|
| 443 | }, |
|
| 444 | 'resourceName' |
|
| 445 | ); |
|
| 446 | ||
| 447 | $scope = new Scope($manager, $resource); |
|
| 448 | ||
| 449 | $manager->parseFieldsets($fieldsetsToParse); |
|
| 450 | $this->assertSame($expected, $scope->toArray()); |
|
| 451 | } |
|
| 452 | ||
| 453 | public function fieldsetsProvider() |
|
| 454 | { |
|