Mercurial > hg > isophonics-drupal-site
comparison vendor/psy/psysh/test/Reflection/ReflectionLanguageConstructParameterTest.php @ 16:c2387f117808
Routine composer update
author | Chris Cannam |
---|---|
date | Tue, 10 Jul 2018 15:07:59 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
15:e200cb7efeb3 | 16:c2387f117808 |
---|---|
1 <?php | |
2 | |
3 /* | |
4 * This file is part of Psy Shell. | |
5 * | |
6 * (c) 2012-2018 Justin Hileman | |
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 Psy\Test\Reflection; | |
13 | |
14 use Psy\Reflection\ReflectionLanguageConstruct; | |
15 use Psy\Reflection\ReflectionLanguageConstructParameter; | |
16 | |
17 class ReflectionLanguageConstructParameterTest extends \PHPUnit\Framework\TestCase | |
18 { | |
19 public function testOptions() | |
20 { | |
21 $keyword = new ReflectionLanguageConstruct('die'); | |
22 | |
23 $refl = new ReflectionLanguageConstructParameter($keyword, 'one', [ | |
24 'isArray' => false, | |
25 'defaultValue' => null, | |
26 'isOptional' => false, | |
27 'isPassedByReference' => false, | |
28 ]); | |
29 | |
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()); | |
37 | |
38 $reflTwo = new ReflectionLanguageConstructParameter($keyword, 'two', [ | |
39 'isArray' => true, | |
40 'isOptional' => true, | |
41 'isPassedByReference' => true, | |
42 ]); | |
43 | |
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()); | |
51 | |
52 $refl = new ReflectionLanguageConstructParameter($keyword, 'three', [ | |
53 'defaultValue' => 3, | |
54 ]); | |
55 | |
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()); | |
63 } | |
64 } |