@@ 12-22 (lines=11) @@ | ||
9 | /** |
|
10 | * @covers Netdudes\DataSourceryBundle\DataSource\Util\ChoicesBuilder::build |
|
11 | */ |
|
12 | public function testBuildingChoicesWithInvalidConfig() |
|
13 | { |
|
14 | $invalidConfig = 'invalid configuration'; |
|
15 | ||
16 | $emMock = $this->prepareEntityManagerMock(); |
|
17 | ||
18 | $builder = new ChoicesBuilder($emMock); |
|
19 | ||
20 | $this->setExpectedException('Exception', 'No usable configuration was found'); |
|
21 | $builder->build($invalidConfig); |
|
22 | } |
|
23 | ||
24 | /** |
|
25 | * @covers Netdudes\DataSourceryBundle\DataSource\Util\ChoicesBuilder::build |
|
@@ 226-238 (lines=13) @@ | ||
223 | * @covers Netdudes\DataSourceryBundle\DataSource\Util\ChoicesBuilder::build |
|
224 | * @covers Netdudes\DataSourceryBundle\DataSource\Util\ChoicesBuilder::getChoicesFromCallable |
|
225 | */ |
|
226 | public function testBuildingChoicesFromCallableWhenResultIsNotAnArray() |
|
227 | { |
|
228 | $aCallable = function () { |
|
229 | return 'not an array'; |
|
230 | }; |
|
231 | ||
232 | $emMock = $this->prepareEntityManagerMock(); |
|
233 | ||
234 | $builder = new ChoicesBuilder($emMock); |
|
235 | ||
236 | $this->setExpectedException('Exception', 'Choices callback defined in table configurations must return array'); |
|
237 | $builder->build($aCallable); |
|
238 | } |
|
239 | ||
240 | /** |
|
241 | * @return \PHPUnit_Framework_MockObject_MockObject |