Skip to content

Commit 5b935b8

Browse files
committed
-
1 parent c0b9f13 commit 5b935b8

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/DoctrineChoiceLoaderTest.php

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,6 @@ public function testLoadValuesForChoicesDoesNotLoadIfEmptyChoices()
152152

153153
public function testLoadValuesForChoicesDoesNotLoadIfSingleIntId()
154154
{
155-
$this->expectException(LogicException::class);
156-
$this->expectExceptionMessage('Not defining the IdReader explicitly as a value callback when the query can be optimized is not supported.');
157-
158155
$loader = new DoctrineChoiceLoader(
159156
$this->om,
160157
$this->class,
@@ -169,7 +166,10 @@ public function testLoadValuesForChoicesDoesNotLoadIfSingleIntId()
169166
->with($this->obj2)
170167
->willReturn('2');
171168

172-
$this->assertSame(['2'], $loader->loadValuesForChoices([$this->obj2]));
169+
$this->expectException(LogicException::class);
170+
$this->expectExceptionMessage('Not defining the IdReader explicitly as a value callback when the query can be optimized is not supported.');
171+
172+
$loader->loadValuesForChoices([$this->obj2]);
173173
}
174174

175175
public function testLoadValuesForChoicesDoesNotLoadIfSingleIntIdAndValueGiven()
@@ -253,18 +253,13 @@ public function testLoadChoicesForValuesDoesNotLoadIfEmptyValues()
253253

254254
public function testLegacyLoadChoicesForValuesLoadsOnlyChoicesIfValueUseIdReader()
255255
{
256-
$this->expectException(LogicException::class);
257-
$this->expectExceptionMessage('Not defining the IdReader explicitly as a value callback when the query can be optimized is not supported.');
258-
259256
$loader = new DoctrineChoiceLoader(
260257
$this->om,
261258
$this->class,
262259
$this->idReader,
263260
$this->objectLoader
264261
);
265262

266-
$choices = [$this->obj2, $this->obj3];
267-
268263
$this->idReader->expects($this->any())
269264
->method('getIdField')
270265
->willReturn('idField');
@@ -275,10 +270,10 @@ public function testLegacyLoadChoicesForValuesLoadsOnlyChoicesIfValueUseIdReader
275270
$this->objectLoader->expects($this->never())
276271
->method('getEntitiesByIds');
277272

278-
$this->assertSame(
279-
[4 => $this->obj3, 7 => $this->obj2],
280-
$loader->loadChoicesForValues([4 => '3', 7 => '2'])
281-
);
273+
$this->expectException(LogicException::class);
274+
$this->expectExceptionMessage('Not defining the IdReader explicitly as a value callback when the query can be optimized is not supported.');
275+
276+
$loader->loadChoicesForValues([4 => '3', 7 => '2']);
282277
}
283278

284279
public function testLoadChoicesForValuesLoadsOnlyChoicesIfValueUseIdReader()

0 commit comments

Comments
 (0)