Mercurial > hg > isophonics-drupal-site
comparison vendor/nikic/php-parser/test/PhpParser/Node/Stmt/PropertyTest.php @ 0:4c8ae668cc8c
Initial import (non-working)
author | Chris Cannam |
---|---|
date | Wed, 29 Nov 2017 16:09:58 +0000 |
parents | |
children | 5fb285c0d0e3 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:4c8ae668cc8c |
---|---|
1 <?php | |
2 | |
3 namespace PhpParser\Node\Stmt; | |
4 | |
5 class PropertyTest extends \PHPUnit_Framework_TestCase | |
6 { | |
7 /** | |
8 * @dataProvider provideModifiers | |
9 */ | |
10 public function testModifiers($modifier) { | |
11 $node = new Property( | |
12 constant('PhpParser\Node\Stmt\Class_::MODIFIER_' . strtoupper($modifier)), | |
13 array() // invalid | |
14 ); | |
15 | |
16 $this->assertTrue($node->{'is' . $modifier}()); | |
17 } | |
18 | |
19 public function testNoModifiers() { | |
20 $node = new Property(0, array()); | |
21 | |
22 $this->assertTrue($node->isPublic()); | |
23 $this->assertFalse($node->isProtected()); | |
24 $this->assertFalse($node->isPrivate()); | |
25 $this->assertFalse($node->isStatic()); | |
26 } | |
27 | |
28 public function testStaticImplicitlyPublic() { | |
29 $node = new Property(Class_::MODIFIER_STATIC, array()); | |
30 $this->assertTrue($node->isPublic()); | |
31 $this->assertFalse($node->isProtected()); | |
32 $this->assertFalse($node->isPrivate()); | |
33 $this->assertTrue($node->isStatic()); | |
34 } | |
35 | |
36 public function provideModifiers() { | |
37 return array( | |
38 array('public'), | |
39 array('protected'), | |
40 array('private'), | |
41 array('static'), | |
42 ); | |
43 } | |
44 } |