4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Component\HttpKernel\Tests\ControllerMetadata;
14 use PHPUnit\Framework\TestCase;
15 use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadata;
17 class ArgumentMetadataTest extends TestCase
19 public function testWithBcLayerWithDefault()
21 $argument = new ArgumentMetadata('foo', 'string', false, true, 'default value');
23 $this->assertFalse($argument->isNullable());
26 public function testDefaultValueAvailable()
28 $argument = new ArgumentMetadata('foo', 'string', false, true, 'default value', true);
30 $this->assertTrue($argument->isNullable());
31 $this->assertTrue($argument->hasDefaultValue());
32 $this->assertSame('default value', $argument->getDefaultValue());
36 * @expectedException \LogicException
38 public function testDefaultValueUnavailable()
40 $argument = new ArgumentMetadata('foo', 'string', false, false, null, false);
42 $this->assertFalse($argument->isNullable());
43 $this->assertFalse($argument->hasDefaultValue());
44 $argument->getDefaultValue();