|
@@ 124-139 (lines=16) @@
|
| 121 |
|
$this->assertSame('book.author.profile', $grandChildScope->getIdentifier()); |
| 122 |
|
} |
| 123 |
|
|
| 124 |
|
public function testGetParentScopes() |
| 125 |
|
{ |
| 126 |
|
$manager = new Manager(); |
| 127 |
|
|
| 128 |
|
$resource = new Item(['name' => 'Larry Ullman'], function () { |
| 129 |
|
}); |
| 130 |
|
|
| 131 |
|
$scope = new Scope($manager, $resource, 'book'); |
| 132 |
|
|
| 133 |
|
$childScope = $scope->embedChildScope('author', $resource); |
| 134 |
|
|
| 135 |
|
$this->assertSame(['book'], $childScope->getParentScopes()); |
| 136 |
|
|
| 137 |
|
$grandChildScope = $childScope->embedChildScope('profile', $resource); |
| 138 |
|
$this->assertSame(['book', 'author'], $grandChildScope->getParentScopes()); |
| 139 |
|
} |
| 140 |
|
|
| 141 |
|
public function testIsRequested() |
| 142 |
|
{ |
|
@@ 515-531 (lines=17) @@
|
| 512 |
|
/** |
| 513 |
|
* @dataProvider fieldsetsWithIncludesProvider |
| 514 |
|
*/ |
| 515 |
|
public function testToArrayWithIncludesAndFieldsets($fieldsetsToParse, $expected) |
| 516 |
|
{ |
| 517 |
|
$transformer = $this->createTransformerWithIncludedResource('book', ['book' => ['yin' => 'yang']]); |
| 518 |
|
|
| 519 |
|
$resource = new Item( |
| 520 |
|
['foo' => 'bar', 'baz' => 'qux'], |
| 521 |
|
$transformer, |
| 522 |
|
'resourceName' |
| 523 |
|
); |
| 524 |
|
$manager = new Manager(); |
| 525 |
|
$scope = new Scope($manager, $resource); |
| 526 |
|
|
| 527 |
|
$manager->parseIncludes('book'); |
| 528 |
|
|
| 529 |
|
$manager->parseFieldsets($fieldsetsToParse); |
| 530 |
|
$this->assertSame($expected, $scope->toArray()); |
| 531 |
|
} |
| 532 |
|
|
| 533 |
|
public function fieldsetsWithIncludesProvider() |
| 534 |
|
{ |