@@ 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 |
@@ 503-519 (lines=17) @@ | ||
500 | ); |
|
501 | } |
|
502 | ||
503 | public function testMandatoryConstraintsAreAutomaticallyAllowed() |
|
504 | { |
|
505 | $container = new Container([ |
|
506 | 'resources' => [ |
|
507 | 'foo' => [ |
|
508 | 'constraints' => [ |
|
509 | 'mandatory' => [ 'mandatory_property' ], |
|
510 | ] |
|
511 | ], |
|
512 | ], |
|
513 | ]); |
|
514 | ||
515 | $this->assertEquals( |
|
516 | [ 'mandatory_property' ], |
|
517 | $container->allowed('foo') |
|
518 | ); |
|
519 | } |
|
520 | ||
521 | /** |
|
522 | * @expectedException Sensorario\Resources\Exceptions\UnexpectedValueException |