| @@ 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 | ||
| @@ 518-534 (lines=17) @@ | ||
| 515 | ); |
|
| 516 | } |
|
| 517 | ||
| 518 | public function testMandatoryConstraintsAreAutomaticallyAllowed() |
|
| 519 | { |
|
| 520 | $container = new Container([ |
|
| 521 | 'resources' => [ |
|
| 522 | 'foo' => [ |
|
| 523 | 'constraints' => [ |
|
| 524 | 'mandatory' => [ 'mandatory_property' ], |
|
| 525 | ] |
|
| 526 | ], |
|
| 527 | ], |
|
| 528 | ]); |
|
| 529 | ||
| 530 | $this->assertEquals( |
|
| 531 | [ 'mandatory_property' ], |
|
| 532 | $container->allowed('foo') |
|
| 533 | ); |
|
| 534 | } |
|
| 535 | ||
| 536 | public function testPropertyType() |
|
| 537 | { |
|