|
@@ 134-149 (lines=16) @@
|
| 131 |
|
$this->assertSame($expected, $scope->toJson(JSON_PRETTY_PRINT)); |
| 132 |
|
} |
| 133 |
|
|
| 134 |
|
public function testGetCurrentScope() |
| 135 |
|
{ |
| 136 |
|
$manager = new Manager(); |
| 137 |
|
|
| 138 |
|
$resource = new Item(['name' => 'Larry Ullman'], function () { |
| 139 |
|
}); |
| 140 |
|
|
| 141 |
|
$scope = new Scope($manager, $resource, 'book'); |
| 142 |
|
$this->assertSame('book', $scope->getScopeIdentifier()); |
| 143 |
|
|
| 144 |
|
$childScope = $scope->embedChildScope('author', $resource); |
| 145 |
|
$this->assertSame('author', $childScope->getScopeIdentifier()); |
| 146 |
|
|
| 147 |
|
$grandChildScope = $childScope->embedChildScope('profile', $resource); |
| 148 |
|
$this->assertSame('profile', $grandChildScope->getScopeIdentifier()); |
| 149 |
|
} |
| 150 |
|
|
| 151 |
|
public function testGetIdentifier() |
| 152 |
|
{ |
|
@@ 151-166 (lines=16) @@
|
| 148 |
|
$this->assertSame('profile', $grandChildScope->getScopeIdentifier()); |
| 149 |
|
} |
| 150 |
|
|
| 151 |
|
public function testGetIdentifier() |
| 152 |
|
{ |
| 153 |
|
$manager = new Manager(); |
| 154 |
|
|
| 155 |
|
$resource = new Item(['name' => 'Larry Ullman'], function () { |
| 156 |
|
}); |
| 157 |
|
|
| 158 |
|
$scope = new Scope($manager, $resource, 'book'); |
| 159 |
|
$this->assertSame('book', $scope->getIdentifier()); |
| 160 |
|
|
| 161 |
|
$childScope = $scope->embedChildScope('author', $resource); |
| 162 |
|
$this->assertSame('book.author', $childScope->getIdentifier()); |
| 163 |
|
|
| 164 |
|
$grandChildScope = $childScope->embedChildScope('profile', $resource); |
| 165 |
|
$this->assertSame('book.author.profile', $grandChildScope->getIdentifier()); |
| 166 |
|
} |
| 167 |
|
|
| 168 |
|
public function testGetParentScopes() |
| 169 |
|
{ |