annotate vendor/nikic/php-parser/test/PhpParser/Node/Stmt/PropertyTest.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 PropertyTest 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 Property(
Chris@0 14 constant('PhpParser\Node\Stmt\Class_::MODIFIER_' . strtoupper($modifier)),
Chris@13 15 [] // invalid
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 Property(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 $this->assertFalse($node->isStatic());
Chris@0 28 }
Chris@0 29
Chris@0 30 public function testStaticImplicitlyPublic() {
Chris@13 31 $node = new Property(Class_::MODIFIER_STATIC, []);
Chris@0 32 $this->assertTrue($node->isPublic());
Chris@0 33 $this->assertFalse($node->isProtected());
Chris@0 34 $this->assertFalse($node->isPrivate());
Chris@0 35 $this->assertTrue($node->isStatic());
Chris@0 36 }
Chris@0 37
Chris@0 38 public function provideModifiers() {
Chris@13 39 return [
Chris@13 40 ['public'],
Chris@13 41 ['protected'],
Chris@13 42 ['private'],
Chris@13 43 ['static'],
Chris@13 44 ];
Chris@0 45 }
Chris@0 46 }