];
}
- /**
- * @expectedException \LogicException
- * @expectedExceptionMessage Cannot pretty-print AST with Error nodes
- */
public function testPrettyPrintWithError() {
+ $this->expectException(\LogicException::class);
+ $this->expectExceptionMessage('Cannot pretty-print AST with Error nodes');
$stmts = [new Stmt\Expression(
new Expr\PropertyFetch(new Expr\Variable('a'), new Expr\Error())
)];
$prettyPrinter->prettyPrint($stmts);
}
- /**
- * @expectedException \LogicException
- * @expectedExceptionMessage Cannot pretty-print AST with Error nodes
- */
public function testPrettyPrintWithErrorInClassConstFetch() {
+ $this->expectException(\LogicException::class);
+ $this->expectExceptionMessage('Cannot pretty-print AST with Error nodes');
$stmts = [new Stmt\Expression(
new Expr\ClassConstFetch(new Name('Foo'), new Expr\Error())
)];
$prettyPrinter->prettyPrint($stmts);
}
+ public function testPrettyPrintEncapsedStringPart() {
+ $this->expectException(\LogicException::class);
+ $this->expectExceptionMessage('Cannot directly print EncapsedStringPart');
+ $expr = new Node\Scalar\EncapsedStringPart('foo');
+ $prettyPrinter = new PrettyPrinter\Standard;
+ $prettyPrinter->prettyPrintExpr($expr);
+ }
+
/**
* @dataProvider provideTestFormatPreservingPrint
* @covers \PhpParser\PrettyPrinter\Standard<extended>