@@ 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 |
|
@@ 251-263 (lines=13) @@ | ||
248 | * @covers Netdudes\DataSourceryBundle\DataSource\Util\ChoicesBuilder::build |
|
249 | * @covers Netdudes\DataSourceryBundle\DataSource\Util\ChoicesBuilder::getChoicesFromCallable |
|
250 | */ |
|
251 | public function testBuildingChoicesFromCallableWhenResultIsNotAnArray() |
|
252 | { |
|
253 | $aCallable = function () { |
|
254 | return 'not an array'; |
|
255 | }; |
|
256 | ||
257 | $emMock = $this->prepareEntityManagerMock(); |
|
258 | ||
259 | $builder = new ChoicesBuilder($emMock); |
|
260 | ||
261 | $this->setExpectedException('Exception', 'Choices callback defined in table configurations must return array'); |
|
262 | $builder->build($aCallable); |
|
263 | } |
|
264 | ||
265 | /** |
|
266 | * @return \PHPUnit_Framework_MockObject_MockObject |