|
1 | 1 | <?php
|
2 | 2 |
|
| 3 | +/* |
| 4 | + * This file is part of the Symfony package. |
| 5 | + * |
| 6 | + * (c) Fabien Potencier <[email protected]> |
| 7 | + * |
| 8 | + * For the full copyright and license information, please view the LICENSE |
| 9 | + * file that was distributed with this source code. |
| 10 | + */ |
| 11 | + |
3 | 12 | namespace Symfony\Bridge\Doctrine\Tests\ArgumentResolver;
|
4 | 13 |
|
5 | 14 | use Doctrine\DBAL\Types\ConversionException;
|
@@ -214,6 +223,21 @@ public function testApplyWithId(string|int $id)
|
214 | 223 | $this->assertYieldEquals([$object], $ret);
|
215 | 224 | }
|
216 | 225 |
|
| 226 | + public function testApplyWithNullId() |
| 227 | + { |
| 228 | + $registry = $this->getMockBuilder(ManagerRegistry::class)->getMock(); |
| 229 | + $converter = new EntityValueResolver($registry); |
| 230 | + |
| 231 | + $request = new Request(); |
| 232 | + $request->attributes->set('id', null); |
| 233 | + |
| 234 | + $argument = $this->createArgument(isNullable: true); |
| 235 | + |
| 236 | + $ret = $converter->resolve($request, $argument); |
| 237 | + |
| 238 | + $this->assertYieldEquals([null], $ret); |
| 239 | + } |
| 240 | + |
217 | 241 | public function testApplyWithConversionFailedException()
|
218 | 242 | {
|
219 | 243 | $registry = $this->getMockBuilder(ManagerRegistry::class)->getMock();
|
@@ -276,7 +300,7 @@ public function testApplyGuessOptional()
|
276 | 300 | $converter = new EntityValueResolver($registry);
|
277 | 301 |
|
278 | 302 | $request = new Request();
|
279 |
| - $request->attributes->set('arg', null); |
| 303 | + $request->attributes->set('guess', null); |
280 | 304 |
|
281 | 305 | $argument = $this->createArgument('stdClass', new MapEntity(), 'arg', true);
|
282 | 306 |
|
|
0 commit comments