4 * This file is part of Psy Shell.
6 * (c) 2012-2018 Justin Hileman
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Psy\Test\Reflection;
14 use Psy\Reflection\ReflectionLanguageConstruct;
15 use Psy\Reflection\ReflectionLanguageConstructParameter;
17 class ReflectionLanguageConstructParameterTest extends \PHPUnit\Framework\TestCase
19 public function testOptions()
21 $keyword = new ReflectionLanguageConstruct('die');
23 $refl = new ReflectionLanguageConstructParameter($keyword, 'one', [
25 'defaultValue' => null,
26 'isOptional' => false,
27 'isPassedByReference' => false,
30 $this->assertNull($refl->getClass());
31 $this->assertEquals('one', $refl->getName());
32 $this->assertFalse($refl->isArray());
33 $this->assertTrue($refl->isDefaultValueAvailable());
34 $this->assertNull($refl->getDefaultValue());
35 $this->assertFalse($refl->isOptional());
36 $this->assertFalse($refl->isPassedByReference());
38 $reflTwo = new ReflectionLanguageConstructParameter($keyword, 'two', [
41 'isPassedByReference' => true,
44 $this->assertNull($refl->getClass());
45 $this->assertEquals('two', $reflTwo->getName());
46 $this->assertTrue($reflTwo->isArray());
47 $this->assertFalse($reflTwo->isDefaultValueAvailable());
48 $this->assertNull($reflTwo->getDefaultValue());
49 $this->assertTrue($reflTwo->isOptional());
50 $this->assertTrue($reflTwo->isPassedByReference());
52 $refl = new ReflectionLanguageConstructParameter($keyword, 'three', [
56 $this->assertNull($refl->getClass());
57 $this->assertEquals('three', $refl->getName());
58 $this->assertFalse($refl->isArray());
59 $this->assertTrue($refl->isDefaultValueAvailable());
60 $this->assertEquals(3, $refl->getDefaultValue());
61 $this->assertFalse($refl->isOptional());
62 $this->assertFalse($refl->isPassedByReference());