| @@ 158-182 (lines=25) @@ | ||
| 155 | ); |
|
| 156 | } |
|
| 157 | ||
| 158 | public function testCreationSucceedReturnsTrue() |
|
| 159 | { |
|
| 160 | $container = new Container([ |
|
| 161 | 'resources' => [ |
|
| 162 | 'foo' => [ |
|
| 163 | 'constraints' => [ |
|
| 164 | 'allowed' => [ |
|
| 165 | 'foo' |
|
| 166 | ] |
|
| 167 | ], |
|
| 168 | ], |
|
| 169 | ], |
|
| 170 | ]); |
|
| 171 | ||
| 172 | $creationSucceed = $container->create( |
|
| 173 | 'foo', [ |
|
| 174 | 'foo' => 'bar', |
|
| 175 | ] |
|
| 176 | ); |
|
| 177 | ||
| 178 | $this->assertSame( |
|
| 179 | true, |
|
| 180 | $creationSucceed |
|
| 181 | ); |
|
| 182 | } |
|
| 183 | } |
|
| 184 | ||
| @@ 417-433 (lines=17) @@ | ||
| 414 | ); |
|
| 415 | } |
|
| 416 | ||
| 417 | public function testMandatoryConstraintsAreAutomaticallyAllowed() |
|
| 418 | { |
|
| 419 | $container = new Container([ |
|
| 420 | 'resources' => [ |
|
| 421 | 'foo' => [ |
|
| 422 | 'constraints' => [ |
|
| 423 | 'mandatory' => [ 'mandatory_property' ], |
|
| 424 | ] |
|
| 425 | ], |
|
| 426 | ], |
|
| 427 | ]); |
|
| 428 | ||
| 429 | $this->assertEquals( |
|
| 430 | [ 'mandatory_property' ], |
|
| 431 | $container->allowed('foo') |
|
| 432 | ); |
|
| 433 | } |
|
| 434 | ||
| 435 | public function testPropertyType() |
|
| 436 | { |
|