comparison 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
comparison
equal deleted inserted replaced
12:7a779792577d 13:5fb285c0d0e3
1 <?php 1 <?php declare(strict_types=1);
2 2
3 namespace PhpParser\Node\Stmt; 3 namespace PhpParser\Node\Stmt;
4 4
5 class PropertyTest extends \PHPUnit_Framework_TestCase 5 use PHPUnit\Framework\TestCase;
6
7 class PropertyTest extends TestCase
6 { 8 {
7 /** 9 /**
8 * @dataProvider provideModifiers 10 * @dataProvider provideModifiers
9 */ 11 */
10 public function testModifiers($modifier) { 12 public function testModifiers($modifier) {
11 $node = new Property( 13 $node = new Property(
12 constant('PhpParser\Node\Stmt\Class_::MODIFIER_' . strtoupper($modifier)), 14 constant('PhpParser\Node\Stmt\Class_::MODIFIER_' . strtoupper($modifier)),
13 array() // invalid 15 [] // invalid
14 ); 16 );
15 17
16 $this->assertTrue($node->{'is' . $modifier}()); 18 $this->assertTrue($node->{'is' . $modifier}());
17 } 19 }
18 20
19 public function testNoModifiers() { 21 public function testNoModifiers() {
20 $node = new Property(0, array()); 22 $node = new Property(0, []);
21 23
22 $this->assertTrue($node->isPublic()); 24 $this->assertTrue($node->isPublic());
23 $this->assertFalse($node->isProtected()); 25 $this->assertFalse($node->isProtected());
24 $this->assertFalse($node->isPrivate()); 26 $this->assertFalse($node->isPrivate());
25 $this->assertFalse($node->isStatic()); 27 $this->assertFalse($node->isStatic());
26 } 28 }
27 29
28 public function testStaticImplicitlyPublic() { 30 public function testStaticImplicitlyPublic() {
29 $node = new Property(Class_::MODIFIER_STATIC, array()); 31 $node = new Property(Class_::MODIFIER_STATIC, []);
30 $this->assertTrue($node->isPublic()); 32 $this->assertTrue($node->isPublic());
31 $this->assertFalse($node->isProtected()); 33 $this->assertFalse($node->isProtected());
32 $this->assertFalse($node->isPrivate()); 34 $this->assertFalse($node->isPrivate());
33 $this->assertTrue($node->isStatic()); 35 $this->assertTrue($node->isStatic());
34 } 36 }
35 37
36 public function provideModifiers() { 38 public function provideModifiers() {
37 return array( 39 return [
38 array('public'), 40 ['public'],
39 array('protected'), 41 ['protected'],
40 array('private'), 42 ['private'],
41 array('static'), 43 ['static'],
42 ); 44 ];
43 } 45 }
44 } 46 }