Mercurial > hg > isophonics-drupal-site
comparison vendor/nikic/php-parser/test/PhpParser/Builder/TraitTest.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\Builder; | 3 namespace PhpParser\Builder; |
4 | 4 |
5 use PhpParser\Comment; | 5 use PhpParser\Comment; |
6 use PhpParser\Node\Name; | 6 use PhpParser\Node\Name; |
7 use PhpParser\Node\Stmt; | 7 use PhpParser\Node\Stmt; |
8 use PHPUnit\Framework\TestCase; | |
8 | 9 |
9 class TraitTest extends \PHPUnit_Framework_TestCase | 10 class TraitTest extends TestCase |
10 { | 11 { |
11 protected function createTraitBuilder($class) { | 12 protected function createTraitBuilder($class) { |
12 return new Trait_($class); | 13 return new Trait_($class); |
13 } | 14 } |
14 | 15 |
15 public function testStmtAddition() { | 16 public function testStmtAddition() { |
16 $method1 = new Stmt\ClassMethod('test1'); | 17 $method1 = new Stmt\ClassMethod('test1'); |
17 $method2 = new Stmt\ClassMethod('test2'); | 18 $method2 = new Stmt\ClassMethod('test2'); |
18 $method3 = new Stmt\ClassMethod('test3'); | 19 $method3 = new Stmt\ClassMethod('test3'); |
19 $prop = new Stmt\Property(Stmt\Class_::MODIFIER_PUBLIC, array( | 20 $prop = new Stmt\Property(Stmt\Class_::MODIFIER_PUBLIC, [ |
20 new Stmt\PropertyProperty('test') | 21 new Stmt\PropertyProperty('test') |
21 )); | 22 ]); |
22 $use = new Stmt\TraitUse([new Name('OtherTrait')]); | 23 $use = new Stmt\TraitUse([new Name('OtherTrait')]); |
23 $trait = $this->createTraitBuilder('TestTrait') | 24 $trait = $this->createTraitBuilder('TestTrait') |
24 ->setDocComment('/** Nice trait */') | 25 ->setDocComment('/** Nice trait */') |
25 ->addStmt($method1) | 26 ->addStmt($method1) |
26 ->addStmts([$method2, $method3]) | 27 ->addStmts([$method2, $method3]) |
40 * @expectedException \LogicException | 41 * @expectedException \LogicException |
41 * @expectedExceptionMessage Unexpected node of type "Stmt_Echo" | 42 * @expectedExceptionMessage Unexpected node of type "Stmt_Echo" |
42 */ | 43 */ |
43 public function testInvalidStmtError() { | 44 public function testInvalidStmtError() { |
44 $this->createTraitBuilder('Test') | 45 $this->createTraitBuilder('Test') |
45 ->addStmt(new Stmt\Echo_(array())) | 46 ->addStmt(new Stmt\Echo_([])) |
46 ; | 47 ; |
47 } | 48 } |
48 } | 49 } |