Security update for Core, with self-updated composer
[yaffs-website] / vendor / symfony / http-kernel / Tests / ControllerMetadata / ArgumentMetadataTest.php
1 <?php
2
3 /*
4  * This file is part of the Symfony package.
5  *
6  * (c) Fabien Potencier <fabien@symfony.com>
7  *
8  * For the full copyright and license information, please view the LICENSE
9  * file that was distributed with this source code.
10  */
11
12 namespace Symfony\Component\HttpKernel\Tests\ControllerMetadata;
13
14 use PHPUnit\Framework\TestCase;
15 use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadata;
16
17 class ArgumentMetadataTest extends TestCase
18 {
19     public function testWithBcLayerWithDefault()
20     {
21         $argument = new ArgumentMetadata('foo', 'string', false, true, 'default value');
22
23         $this->assertFalse($argument->isNullable());
24     }
25
26     public function testDefaultValueAvailable()
27     {
28         $argument = new ArgumentMetadata('foo', 'string', false, true, 'default value', true);
29
30         $this->assertTrue($argument->isNullable());
31         $this->assertTrue($argument->hasDefaultValue());
32         $this->assertSame('default value', $argument->getDefaultValue());
33     }
34
35     /**
36      * @expectedException \LogicException
37      */
38     public function testDefaultValueUnavailable()
39     {
40         $argument = new ArgumentMetadata('foo', 'string', false, false, null, false);
41
42         $this->assertFalse($argument->isNullable());
43         $this->assertFalse($argument->hasDefaultValue());
44         $argument->getDefaultValue();
45     }
46 }