From 3c44785e82699049f703fa5ad54a76f1ebf30768 Mon Sep 17 00:00:00 2001 From: Ekin Date: Thu, 27 Apr 2017 19:14:07 +0300 Subject: [PATCH] Bump phpunit version (#381) --- composer.json | 2 +- test/PhpParser/AutoloaderTest.php | 5 ++++- test/PhpParser/Builder/ClassTest.php | 3 ++- test/PhpParser/Builder/FunctionTest.php | 3 ++- test/PhpParser/Builder/InterfaceTest.php | 3 ++- test/PhpParser/Builder/MethodTest.php | 3 ++- test/PhpParser/Builder/NamespaceTest.php | 3 ++- test/PhpParser/Builder/ParamTest.php | 3 ++- test/PhpParser/Builder/PropertyTest.php | 3 ++- test/PhpParser/Builder/TraitTest.php | 3 ++- test/PhpParser/Builder/UseTest.php | 6 ++++-- test/PhpParser/BuilderFactoryTest.php | 6 ++++-- test/PhpParser/CodeTestAbstract.php | 4 +++- test/PhpParser/CommentTest.php | 6 ++++-- test/PhpParser/ErrorHandler/CollectingTest.php | 6 ++++-- test/PhpParser/ErrorHandler/ThrowingTest.php | 6 ++++-- test/PhpParser/ErrorTest.php | 4 +++- test/PhpParser/LexerTest.php | 3 ++- test/PhpParser/Node/NameTest.php | 6 ++++-- test/PhpParser/Node/Scalar/MagicConstTest.php | 7 +++++-- test/PhpParser/Node/Scalar/StringTest.php | 4 +++- test/PhpParser/Node/Stmt/ClassConstTest.php | 6 ++++-- test/PhpParser/Node/Stmt/ClassMethodTest.php | 4 +++- test/PhpParser/Node/Stmt/ClassTest.php | 4 +++- test/PhpParser/Node/Stmt/InterfaceTest.php | 3 ++- test/PhpParser/Node/Stmt/PropertyTest.php | 4 +++- test/PhpParser/NodeAbstractTest.php | 4 +++- test/PhpParser/NodeDumperTest.php | 4 +++- test/PhpParser/NodeFinderTest.php | 6 ++++-- test/PhpParser/NodeTraverserTest.php | 6 ++++-- test/PhpParser/NodeVisitor/FindingVisitorTest.php | 6 ++++-- test/PhpParser/NodeVisitor/FirstFindingVisitorTest.php | 5 +++-- test/PhpParser/NodeVisitor/NameResolverTest.php | 6 ++++-- test/PhpParser/Parser/MultipleTest.php | 5 +++-- test/PhpParser/ParserFactoryTest.php | 7 +++++-- test/PhpParser/ParserTest.php | 3 ++- 36 files changed, 111 insertions(+), 51 deletions(-) diff --git a/composer.json b/composer.json index ca9281ae..cbc6a389 100644 --- a/composer.json +++ b/composer.json @@ -14,7 +14,7 @@ "ext-tokenizer": "*" }, "require-dev": { - "phpunit/phpunit": "~5.0" + "phpunit/phpunit": "^6" }, "autoload": { "psr-4": { diff --git a/test/PhpParser/AutoloaderTest.php b/test/PhpParser/AutoloaderTest.php index 8eeded83..4cbaf233 100644 --- a/test/PhpParser/AutoloaderTest.php +++ b/test/PhpParser/AutoloaderTest.php @@ -4,7 +4,10 @@ namespace PhpParser; /* The autoloader is already active at this point, so we only check effects here. */ -class AutoloaderTest extends \PHPUnit_Framework_TestCase { +use PHPUnit\Framework\TestCase; + +class AutoloaderTest extends TestCase +{ public function testClassExists() { $this->assertTrue(class_exists('PhpParser\NodeVisitorAbstract')); $this->assertFalse(class_exists('PHPParser_NodeVisitor_NameResolver')); diff --git a/test/PhpParser/Builder/ClassTest.php b/test/PhpParser/Builder/ClassTest.php index 0f741821..f3bc7c5d 100644 --- a/test/PhpParser/Builder/ClassTest.php +++ b/test/PhpParser/Builder/ClassTest.php @@ -6,8 +6,9 @@ use PhpParser\Comment; use PhpParser\Node; use PhpParser\Node\Name; use PhpParser\Node\Stmt; +use PHPUnit\Framework\TestCase; -class ClassTest extends \PHPUnit_Framework_TestCase +class ClassTest extends TestCase { protected function createClassBuilder($class) { return new Class_($class); diff --git a/test/PhpParser/Builder/FunctionTest.php b/test/PhpParser/Builder/FunctionTest.php index 56797f95..1851f63c 100644 --- a/test/PhpParser/Builder/FunctionTest.php +++ b/test/PhpParser/Builder/FunctionTest.php @@ -8,8 +8,9 @@ use PhpParser\Node\Expr\Print_; use PhpParser\Node\Expr\Variable; use PhpParser\Node\Scalar\String_; use PhpParser\Node\Stmt; +use PHPUnit\Framework\TestCase; -class FunctionTest extends \PHPUnit_Framework_TestCase +class FunctionTest extends TestCase { public function createFunctionBuilder($name) { return new Function_($name); diff --git a/test/PhpParser/Builder/InterfaceTest.php b/test/PhpParser/Builder/InterfaceTest.php index 72c58668..baf6f52f 100644 --- a/test/PhpParser/Builder/InterfaceTest.php +++ b/test/PhpParser/Builder/InterfaceTest.php @@ -6,8 +6,9 @@ use PhpParser\Comment; use PhpParser\Node; use PhpParser\Node\Scalar\DNumber; use PhpParser\Node\Stmt; +use PHPUnit\Framework\TestCase; -class InterfaceTest extends \PHPUnit_Framework_TestCase +class InterfaceTest extends TestCase { /** @var Interface_ */ protected $builder; diff --git a/test/PhpParser/Builder/MethodTest.php b/test/PhpParser/Builder/MethodTest.php index d875bb8d..45b74131 100644 --- a/test/PhpParser/Builder/MethodTest.php +++ b/test/PhpParser/Builder/MethodTest.php @@ -8,8 +8,9 @@ use PhpParser\Node\Expr\Print_; use PhpParser\Node\Expr\Variable; use PhpParser\Node\Scalar\String_; use PhpParser\Node\Stmt; +use PHPUnit\Framework\TestCase; -class MethodTest extends \PHPUnit_Framework_TestCase +class MethodTest extends TestCase { public function createMethodBuilder($name) { return new Method($name); diff --git a/test/PhpParser/Builder/NamespaceTest.php b/test/PhpParser/Builder/NamespaceTest.php index 54e8c93d..8dd726b5 100644 --- a/test/PhpParser/Builder/NamespaceTest.php +++ b/test/PhpParser/Builder/NamespaceTest.php @@ -4,8 +4,9 @@ namespace PhpParser\Builder; use PhpParser\Node; use PhpParser\Node\Stmt; +use PHPUnit\Framework\TestCase; -class NamespaceTest extends \PHPUnit_Framework_TestCase +class NamespaceTest extends TestCase { protected function createNamespaceBuilder($fqn) { return new Namespace_($fqn); diff --git a/test/PhpParser/Builder/ParamTest.php b/test/PhpParser/Builder/ParamTest.php index 47bbfaab..886603f8 100644 --- a/test/PhpParser/Builder/ParamTest.php +++ b/test/PhpParser/Builder/ParamTest.php @@ -5,8 +5,9 @@ namespace PhpParser\Builder; use PhpParser\Node; use PhpParser\Node\Expr; use PhpParser\Node\Scalar; +use PHPUnit\Framework\TestCase; -class ParamTest extends \PHPUnit_Framework_TestCase +class ParamTest extends TestCase { public function createParamBuilder($name) { return new Param($name); diff --git a/test/PhpParser/Builder/PropertyTest.php b/test/PhpParser/Builder/PropertyTest.php index de8f4ce6..145da143 100644 --- a/test/PhpParser/Builder/PropertyTest.php +++ b/test/PhpParser/Builder/PropertyTest.php @@ -7,8 +7,9 @@ use PhpParser\Node\Expr; use PhpParser\Node\Name; use PhpParser\Node\Scalar; use PhpParser\Node\Stmt; +use PHPUnit\Framework\TestCase; -class PropertyTest extends \PHPUnit_Framework_TestCase +class PropertyTest extends TestCase { public function createPropertyBuilder($name) { return new Property($name); diff --git a/test/PhpParser/Builder/TraitTest.php b/test/PhpParser/Builder/TraitTest.php index fffccb74..40944109 100644 --- a/test/PhpParser/Builder/TraitTest.php +++ b/test/PhpParser/Builder/TraitTest.php @@ -4,8 +4,9 @@ namespace PhpParser\Builder; use PhpParser\Comment; use PhpParser\Node\Stmt; +use PHPUnit\Framework\TestCase; -class TraitTest extends \PHPUnit_Framework_TestCase +class TraitTest extends TestCase { protected function createTraitBuilder($class) { return new Trait_($class); diff --git a/test/PhpParser/Builder/UseTest.php b/test/PhpParser/Builder/UseTest.php index adaeb3a5..30790747 100644 --- a/test/PhpParser/Builder/UseTest.php +++ b/test/PhpParser/Builder/UseTest.php @@ -3,8 +3,9 @@ use PhpParser\Builder; use PhpParser\Node\Name; use PhpParser\Node\Stmt; +use PHPUnit\Framework\TestCase; -class UseTest extends \PHPUnit_Framework_TestCase +class UseTest extends TestCase { protected function createUseBuilder($name, $type = Stmt\Use_::TYPE_NORMAL) { return new Builder\Use_($name, $type); @@ -28,7 +29,8 @@ class UseTest extends \PHPUnit_Framework_TestCase } public function testNonExistingMethod() { - $this->setExpectedException('LogicException', 'Method "foo" does not exist'); + $this->expectException('LogicException'); + $this->expectExceptionMessage('Method "foo" does not exist'); $builder = $this->createUseBuilder('Test'); $builder->foo(); } diff --git a/test/PhpParser/BuilderFactoryTest.php b/test/PhpParser/BuilderFactoryTest.php index f4c74ea2..1d33836a 100644 --- a/test/PhpParser/BuilderFactoryTest.php +++ b/test/PhpParser/BuilderFactoryTest.php @@ -5,8 +5,9 @@ namespace PhpParser; use PhpParser\Node\Expr; use PhpParser\Node\Expr\BinaryOp\Concat; use PhpParser\Node\Scalar\String_; +use PHPUnit\Framework\TestCase; -class BuilderFactoryTest extends \PHPUnit_Framework_TestCase +class BuilderFactoryTest extends TestCase { /** * @dataProvider provideTestFactory @@ -31,7 +32,8 @@ class BuilderFactoryTest extends \PHPUnit_Framework_TestCase } public function testNonExistingMethod() { - $this->setExpectedException('LogicException', 'Method "foo" does not exist'); + $this->expectException('LogicException'); + $this->expectExceptionMessage('Method "foo" does not exist'); $factory = new BuilderFactory(); $factory->foo(); } diff --git a/test/PhpParser/CodeTestAbstract.php b/test/PhpParser/CodeTestAbstract.php index 344298ee..055f82fc 100644 --- a/test/PhpParser/CodeTestAbstract.php +++ b/test/PhpParser/CodeTestAbstract.php @@ -2,9 +2,11 @@ namespace PhpParser; +use PHPUnit\Framework\TestCase; + require_once __DIR__ . '/CodeTestParser.php'; -abstract class CodeTestAbstract extends \PHPUnit_Framework_TestCase +abstract class CodeTestAbstract extends TestCase { protected function getTests($directory, $fileExtension, $chunksPerTest = 2) { $parser = new CodeTestParser; diff --git a/test/PhpParser/CommentTest.php b/test/PhpParser/CommentTest.php index 081dd57b..cdddfa95 100644 --- a/test/PhpParser/CommentTest.php +++ b/test/PhpParser/CommentTest.php @@ -2,7 +2,9 @@ namespace PhpParser; -class CommentTest extends \PHPUnit_Framework_TestCase +use PHPUnit\Framework\TestCase; + +class CommentTest extends TestCase { public function testGetSet() { $comment = new Comment('/* Some comment */', 1, 10); @@ -70,4 +72,4 @@ class CommentTest extends \PHPUnit_Framework_TestCase ), ); } -} \ No newline at end of file +} diff --git a/test/PhpParser/ErrorHandler/CollectingTest.php b/test/PhpParser/ErrorHandler/CollectingTest.php index 37429817..848d27fd 100644 --- a/test/PhpParser/ErrorHandler/CollectingTest.php +++ b/test/PhpParser/ErrorHandler/CollectingTest.php @@ -3,8 +3,10 @@ namespace PhpParser\ErrorHandler; use PhpParser\Error; +use PHPUnit\Framework\TestCase; -class CollectingTest extends \PHPUnit_Framework_TestCase { +class CollectingTest extends TestCase +{ public function testHandleError() { $errorHandler = new Collecting(); $this->assertFalse($errorHandler->hasErrors()); @@ -19,4 +21,4 @@ class CollectingTest extends \PHPUnit_Framework_TestCase { $this->assertFalse($errorHandler->hasErrors()); $this->assertEmpty($errorHandler->getErrors()); } -} \ No newline at end of file +} diff --git a/test/PhpParser/ErrorHandler/ThrowingTest.php b/test/PhpParser/ErrorHandler/ThrowingTest.php index d7df7c26..f3a1eb3e 100644 --- a/test/PhpParser/ErrorHandler/ThrowingTest.php +++ b/test/PhpParser/ErrorHandler/ThrowingTest.php @@ -3,8 +3,10 @@ namespace PhpParser\ErrorHandler; use PhpParser\Error; +use PHPUnit\Framework\TestCase; -class ThrowingTest extends \PHPUnit_Framework_TestCase { +class ThrowingTest extends TestCase +{ /** * @expectedException \PhpParser\Error * @expectedExceptionMessage Test @@ -13,4 +15,4 @@ class ThrowingTest extends \PHPUnit_Framework_TestCase { $errorHandler = new Throwing(); $errorHandler->handleError(new Error('Test')); } -} \ No newline at end of file +} diff --git a/test/PhpParser/ErrorTest.php b/test/PhpParser/ErrorTest.php index 59e880c3..242d6dc4 100644 --- a/test/PhpParser/ErrorTest.php +++ b/test/PhpParser/ErrorTest.php @@ -2,7 +2,9 @@ namespace PhpParser; -class ErrorTest extends \PHPUnit_Framework_TestCase +use PHPUnit\Framework\TestCase; + +class ErrorTest extends TestCase { public function testConstruct() { $attributes = array( diff --git a/test/PhpParser/LexerTest.php b/test/PhpParser/LexerTest.php index d2f570e1..31ceb733 100644 --- a/test/PhpParser/LexerTest.php +++ b/test/PhpParser/LexerTest.php @@ -3,8 +3,9 @@ namespace PhpParser; use PhpParser\Parser\Tokens; +use PHPUnit\Framework\TestCase; -class LexerTest extends \PHPUnit_Framework_TestCase +class LexerTest extends TestCase { /* To allow overwriting in parent class */ protected function getLexer(array $options = array()) { diff --git a/test/PhpParser/Node/NameTest.php b/test/PhpParser/Node/NameTest.php index 76a89c3e..bb93da62 100644 --- a/test/PhpParser/Node/NameTest.php +++ b/test/PhpParser/Node/NameTest.php @@ -2,7 +2,9 @@ namespace PhpParser\Node; -class NameTest extends \PHPUnit_Framework_TestCase +use PHPUnit\Framework\TestCase; + +class NameTest extends TestCase { public function testConstruct() { $name = new Name(array('foo', 'bar')); @@ -131,4 +133,4 @@ class NameTest extends \PHPUnit_Framework_TestCase public function testInvalidArg() { Name::concat('foo', new \stdClass); } -} \ No newline at end of file +} diff --git a/test/PhpParser/Node/Scalar/MagicConstTest.php b/test/PhpParser/Node/Scalar/MagicConstTest.php index 3141f563..752ca112 100644 --- a/test/PhpParser/Node/Scalar/MagicConstTest.php +++ b/test/PhpParser/Node/Scalar/MagicConstTest.php @@ -2,7 +2,10 @@ namespace PhpParser\Node\Scalar; -class MagicConstTest extends \PHPUnit_Framework_TestCase { +use PHPUnit\Framework\TestCase; + +class MagicConstTest extends TestCase +{ /** * @dataProvider provideTestGetName */ @@ -22,4 +25,4 @@ class MagicConstTest extends \PHPUnit_Framework_TestCase { array(new MagicConst\Trait_, '__TRAIT__'), ); } -} \ No newline at end of file +} diff --git a/test/PhpParser/Node/Scalar/StringTest.php b/test/PhpParser/Node/Scalar/StringTest.php index be390357..a2150c6e 100644 --- a/test/PhpParser/Node/Scalar/StringTest.php +++ b/test/PhpParser/Node/Scalar/StringTest.php @@ -2,7 +2,9 @@ namespace PhpParser\Node\Scalar; -class StringTest extends \PHPUnit_Framework_TestCase +use PHPUnit\Framework\TestCase; + +class StringTest extends TestCase { /** * @dataProvider provideTestParseEscapeSequences diff --git a/test/PhpParser/Node/Stmt/ClassConstTest.php b/test/PhpParser/Node/Stmt/ClassConstTest.php index 877d67e1..aa0adec4 100644 --- a/test/PhpParser/Node/Stmt/ClassConstTest.php +++ b/test/PhpParser/Node/Stmt/ClassConstTest.php @@ -2,7 +2,9 @@ namespace PhpParser\Node\Stmt; -class ClassConstTest extends \PHPUnit_Framework_TestCase +use PHPUnit\Framework\TestCase; + +class ClassConstTest extends TestCase { /** * @dataProvider provideModifiers @@ -31,4 +33,4 @@ class ClassConstTest extends \PHPUnit_Framework_TestCase array('private'), ); } -} \ No newline at end of file +} diff --git a/test/PhpParser/Node/Stmt/ClassMethodTest.php b/test/PhpParser/Node/Stmt/ClassMethodTest.php index d1edce99..dda99fef 100644 --- a/test/PhpParser/Node/Stmt/ClassMethodTest.php +++ b/test/PhpParser/Node/Stmt/ClassMethodTest.php @@ -2,7 +2,9 @@ namespace PhpParser\Node\Stmt; -class ClassMethodTest extends \PHPUnit_Framework_TestCase +use PHPUnit\Framework\TestCase; + +class ClassMethodTest extends TestCase { /** * @dataProvider provideModifiers diff --git a/test/PhpParser/Node/Stmt/ClassTest.php b/test/PhpParser/Node/Stmt/ClassTest.php index 643b15cb..e2f049a8 100644 --- a/test/PhpParser/Node/Stmt/ClassTest.php +++ b/test/PhpParser/Node/Stmt/ClassTest.php @@ -2,7 +2,9 @@ namespace PhpParser\Node\Stmt; -class ClassTest extends \PHPUnit_Framework_TestCase +use PHPUnit\Framework\TestCase; + +class ClassTest extends TestCase { public function testIsAbstract() { $class = new Class_('Foo', array('type' => Class_::MODIFIER_ABSTRACT)); diff --git a/test/PhpParser/Node/Stmt/InterfaceTest.php b/test/PhpParser/Node/Stmt/InterfaceTest.php index c4990582..56a94e3e 100644 --- a/test/PhpParser/Node/Stmt/InterfaceTest.php +++ b/test/PhpParser/Node/Stmt/InterfaceTest.php @@ -3,8 +3,9 @@ namespace PhpParser\Node\Stmt; use PhpParser\Node; +use PHPUnit\Framework\TestCase; -class InterfaceTest extends \PHPUnit_Framework_TestCase +class InterfaceTest extends TestCase { public function testGetMethods() { $methods = array( diff --git a/test/PhpParser/Node/Stmt/PropertyTest.php b/test/PhpParser/Node/Stmt/PropertyTest.php index bcfc0c6b..bafbae45 100644 --- a/test/PhpParser/Node/Stmt/PropertyTest.php +++ b/test/PhpParser/Node/Stmt/PropertyTest.php @@ -2,7 +2,9 @@ namespace PhpParser\Node\Stmt; -class PropertyTest extends \PHPUnit_Framework_TestCase +use PHPUnit\Framework\TestCase; + +class PropertyTest extends TestCase { /** * @dataProvider provideModifiers diff --git a/test/PhpParser/NodeAbstractTest.php b/test/PhpParser/NodeAbstractTest.php index 38a23c3d..1d5f0c7f 100644 --- a/test/PhpParser/NodeAbstractTest.php +++ b/test/PhpParser/NodeAbstractTest.php @@ -2,6 +2,8 @@ namespace PhpParser; +use PHPUnit\Framework\TestCase; + class DummyNode extends NodeAbstract { public $subNode1; public $subNode2; @@ -22,7 +24,7 @@ class DummyNode extends NodeAbstract { } } -class NodeAbstractTest extends \PHPUnit_Framework_TestCase +class NodeAbstractTest extends TestCase { public function provideNodes() { $attributes = array( diff --git a/test/PhpParser/NodeDumperTest.php b/test/PhpParser/NodeDumperTest.php index 479c0039..cb6604c9 100644 --- a/test/PhpParser/NodeDumperTest.php +++ b/test/PhpParser/NodeDumperTest.php @@ -2,7 +2,9 @@ namespace PhpParser; -class NodeDumperTest extends \PHPUnit_Framework_TestCase +use PHPUnit\Framework\TestCase; + +class NodeDumperTest extends TestCase { private function canonicalize($string) { return str_replace("\r\n", "\n", $string); diff --git a/test/PhpParser/NodeFinderTest.php b/test/PhpParser/NodeFinderTest.php index 26092205..52bdebac 100644 --- a/test/PhpParser/NodeFinderTest.php +++ b/test/PhpParser/NodeFinderTest.php @@ -3,8 +3,10 @@ namespace PhpParser; use PhpParser\Node\Expr; +use PHPUnit\Framework\TestCase; -class NodeFinderTest extends \PHPUnit_Framework_TestCase { +class NodeFinderTest extends TestCase +{ private function getStmtsAndVars() { $assign = new Expr\Assign(new Expr\Variable('a'), new Expr\BinaryOp\Concat( new Expr\Variable('b'), new Expr\Variable('c') @@ -55,4 +57,4 @@ class NodeFinderTest extends \PHPUnit_Framework_TestCase { $this->assertSame($vars[0], $finder->findFirstInstanceOf($stmts[0], Expr\Variable::class)); $this->assertSame(null, $finder->findFirstInstanceOf($stmts, Expr\BinaryOp\Mul::class)); } -} \ No newline at end of file +} diff --git a/test/PhpParser/NodeTraverserTest.php b/test/PhpParser/NodeTraverserTest.php index 5b1dcc42..2723f795 100644 --- a/test/PhpParser/NodeTraverserTest.php +++ b/test/PhpParser/NodeTraverserTest.php @@ -4,8 +4,9 @@ namespace PhpParser; use PhpParser\Node\Expr; use PhpParser\Node\Scalar\String_; +use PHPUnit\Framework\TestCase; -class NodeTraverserTest extends \PHPUnit_Framework_TestCase +class NodeTraverserTest extends TestCase { public function testNonModifying() { $str1Node = new String_('Foo'); @@ -253,7 +254,8 @@ class NodeTraverserTest extends \PHPUnit_Framework_TestCase * @dataProvider provideTestInvalidReturn */ public function testInvalidReturn($visitor, $message) { - $this->setExpectedException(\LogicException::class, $message); + $this->expectException(\LogicException::class); + $this->expectExceptionMessage($message); $stmts = array(new Node\Expr\UnaryMinus(new Node\Scalar\LNumber(42))); diff --git a/test/PhpParser/NodeVisitor/FindingVisitorTest.php b/test/PhpParser/NodeVisitor/FindingVisitorTest.php index 32381479..2fe6646d 100644 --- a/test/PhpParser/NodeVisitor/FindingVisitorTest.php +++ b/test/PhpParser/NodeVisitor/FindingVisitorTest.php @@ -5,8 +5,10 @@ namespace PhpParser\NodeVisitor; use PhpParser\Node; use PhpParser\Node\Expr; use PhpParser\NodeTraverser; +use PHPUnit\Framework\TestCase; -class FindingVisitorTest extends \PHPUnit_Framework_TestCase { +class FindingVisitorTest extends TestCase +{ public function testFindVariables() { $traverser = new NodeTraverser(); $visitor = new FindingVisitor(function(Node $node) { @@ -49,4 +51,4 @@ class FindingVisitorTest extends \PHPUnit_Framework_TestCase { $assign->expr->right, ], $visitor->getFoundNodes()); } -} \ No newline at end of file +} diff --git a/test/PhpParser/NodeVisitor/FirstFindingVisitorTest.php b/test/PhpParser/NodeVisitor/FirstFindingVisitorTest.php index 76259d3f..9c29c482 100644 --- a/test/PhpParser/NodeVisitor/FirstFindingVisitorTest.php +++ b/test/PhpParser/NodeVisitor/FirstFindingVisitorTest.php @@ -5,8 +5,9 @@ namespace PhpParser\NodeVisitor; use PhpParser\Node; use PhpParser\Node\Expr; use PhpParser\NodeTraverser; +use PHPUnit\Framework\TestCase; -class FirstFindingVisitorTest extends \PHPUnit_Framework_TestCase +class FirstFindingVisitorTest extends TestCase { public function testFindFirstVariable() { $traverser = new NodeTraverser(); @@ -35,4 +36,4 @@ class FirstFindingVisitorTest extends \PHPUnit_Framework_TestCase $traverser->traverse($stmts); $this->assertSame(null, $visitor->getFoundNode()); } -} \ No newline at end of file +} diff --git a/test/PhpParser/NodeVisitor/NameResolverTest.php b/test/PhpParser/NodeVisitor/NameResolverTest.php index a0f3498f..fa0f6748 100644 --- a/test/PhpParser/NodeVisitor/NameResolverTest.php +++ b/test/PhpParser/NodeVisitor/NameResolverTest.php @@ -7,8 +7,9 @@ use PhpParser\Node; use PhpParser\Node\Expr; use PhpParser\Node\Name; use PhpParser\Node\Stmt; +use PHPUnit\Framework\TestCase; -class NameResolverTest extends \PHPUnit_Framework_TestCase +class NameResolverTest extends TestCase { private function canonicalize($string) { return str_replace("\r\n", "\n", $string); @@ -346,7 +347,8 @@ EOC; * @dataProvider provideTestError */ public function testError(Node $stmt, $errorMsg) { - $this->setExpectedException('PhpParser\Error', $errorMsg); + $this->expectException('PhpParser\Error'); + $this->expectExceptionMessage($errorMsg); $traverser = new PhpParser\NodeTraverser; $traverser->addVisitor(new NameResolver); diff --git a/test/PhpParser/Parser/MultipleTest.php b/test/PhpParser/Parser/MultipleTest.php index dd4c02e9..66751651 100644 --- a/test/PhpParser/Parser/MultipleTest.php +++ b/test/PhpParser/Parser/MultipleTest.php @@ -78,7 +78,8 @@ class MultipleTest extends ParserTest { } public function testThrownError() { - $this->setExpectedException('PhpParser\Error', 'FAIL A'); + $this->expectException('PhpParser\Error'); + $this->expectExceptionMessage('FAIL A'); $parserA = $this->getMockBuilder('PhpParser\Parser')->getMock(); $parserA->expects($this->at(0)) @@ -91,4 +92,4 @@ class MultipleTest extends ParserTest { $parser = new Multiple([$parserA, $parserB]); $parser->parse('dummy'); } -} \ No newline at end of file +} diff --git a/test/PhpParser/ParserFactoryTest.php b/test/PhpParser/ParserFactoryTest.php index 49c01115..3416dfe3 100644 --- a/test/PhpParser/ParserFactoryTest.php +++ b/test/PhpParser/ParserFactoryTest.php @@ -4,7 +4,10 @@ namespace PhpParser; /* This test is very weak, because PHPUnit's assertEquals assertion is way too slow dealing with the * large objects involved here. So we just do some basic instanceof tests instead. */ -class ParserFactoryTest extends \PHPUnit_Framework_TestCase { +use PHPUnit\Framework\TestCase; + +class ParserFactoryTest extends TestCase +{ /** @dataProvider provideTestCreate */ public function testCreate($kind, $lexer, $expected) { $this->assertInstanceOf($expected, (new ParserFactory)->create($kind, $lexer)); @@ -31,4 +34,4 @@ class ParserFactoryTest extends \PHPUnit_Framework_TestCase { ] ]; } -} \ No newline at end of file +} diff --git a/test/PhpParser/ParserTest.php b/test/PhpParser/ParserTest.php index 602f0b49..ada41912 100644 --- a/test/PhpParser/ParserTest.php +++ b/test/PhpParser/ParserTest.php @@ -6,8 +6,9 @@ use PhpParser\Comment; use PhpParser\Node\Expr; use PhpParser\Node\Scalar; use PhpParser\Node\Scalar\String_; +use PHPUnit\Framework\TestCase; -abstract class ParserTest extends \PHPUnit_Framework_TestCase +abstract class ParserTest extends TestCase { /** @returns Parser */ abstract protected function getParser(Lexer $lexer);