Mercurial > hg > isophonics-drupal-site
annotate vendor/nikic/php-parser/test/PhpParser/Node/Stmt/ClassConstTest.php @ 13:5fb285c0d0e3
Update Drupal core to 8.4.7 via Composer. Security update; I *think* we've
been lucky to get away with this so far, as we don't support self-registration
which seems to be used by the so-called "drupalgeddon 2" attack that 8.4.5
was vulnerable to.
author | Chris Cannam |
---|---|
date | Mon, 23 Apr 2018 09:33:26 +0100 |
parents | 4c8ae668cc8c |
children | 129ea1e6d783 |
rev | line source |
---|---|
Chris@13 | 1 <?php declare(strict_types=1); |
Chris@0 | 2 |
Chris@0 | 3 namespace PhpParser\Node\Stmt; |
Chris@0 | 4 |
Chris@13 | 5 use PHPUnit\Framework\TestCase; |
Chris@13 | 6 |
Chris@13 | 7 class ClassConstTest extends TestCase |
Chris@0 | 8 { |
Chris@0 | 9 /** |
Chris@0 | 10 * @dataProvider provideModifiers |
Chris@0 | 11 */ |
Chris@0 | 12 public function testModifiers($modifier) { |
Chris@0 | 13 $node = new ClassConst( |
Chris@13 | 14 [], // invalid |
Chris@0 | 15 constant('PhpParser\Node\Stmt\Class_::MODIFIER_' . strtoupper($modifier)) |
Chris@0 | 16 ); |
Chris@0 | 17 |
Chris@0 | 18 $this->assertTrue($node->{'is' . $modifier}()); |
Chris@0 | 19 } |
Chris@0 | 20 |
Chris@0 | 21 public function testNoModifiers() { |
Chris@13 | 22 $node = new ClassConst([], 0); |
Chris@0 | 23 |
Chris@0 | 24 $this->assertTrue($node->isPublic()); |
Chris@0 | 25 $this->assertFalse($node->isProtected()); |
Chris@0 | 26 $this->assertFalse($node->isPrivate()); |
Chris@0 | 27 } |
Chris@0 | 28 |
Chris@0 | 29 public function provideModifiers() { |
Chris@13 | 30 return [ |
Chris@13 | 31 ['public'], |
Chris@13 | 32 ['protected'], |
Chris@13 | 33 ['private'], |
Chris@13 | 34 ]; |
Chris@0 | 35 } |
Chris@13 | 36 } |