mirror of
https://github.com/phabelio/PHP-Parser.git
synced 2024-12-02 09:27:58 +01:00
Bump phpunit version (#381)
This commit is contained in:
parent
8635365a30
commit
3c44785e82
@ -14,7 +14,7 @@
|
|||||||
"ext-tokenizer": "*"
|
"ext-tokenizer": "*"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"phpunit/phpunit": "~5.0"
|
"phpunit/phpunit": "^6"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
|
@ -4,7 +4,10 @@ namespace PhpParser;
|
|||||||
|
|
||||||
/* The autoloader is already active at this point, so we only check effects here. */
|
/* 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() {
|
public function testClassExists() {
|
||||||
$this->assertTrue(class_exists('PhpParser\NodeVisitorAbstract'));
|
$this->assertTrue(class_exists('PhpParser\NodeVisitorAbstract'));
|
||||||
$this->assertFalse(class_exists('PHPParser_NodeVisitor_NameResolver'));
|
$this->assertFalse(class_exists('PHPParser_NodeVisitor_NameResolver'));
|
||||||
|
@ -6,8 +6,9 @@ use PhpParser\Comment;
|
|||||||
use PhpParser\Node;
|
use PhpParser\Node;
|
||||||
use PhpParser\Node\Name;
|
use PhpParser\Node\Name;
|
||||||
use PhpParser\Node\Stmt;
|
use PhpParser\Node\Stmt;
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class ClassTest extends \PHPUnit_Framework_TestCase
|
class ClassTest extends TestCase
|
||||||
{
|
{
|
||||||
protected function createClassBuilder($class) {
|
protected function createClassBuilder($class) {
|
||||||
return new Class_($class);
|
return new Class_($class);
|
||||||
|
@ -8,8 +8,9 @@ use PhpParser\Node\Expr\Print_;
|
|||||||
use PhpParser\Node\Expr\Variable;
|
use PhpParser\Node\Expr\Variable;
|
||||||
use PhpParser\Node\Scalar\String_;
|
use PhpParser\Node\Scalar\String_;
|
||||||
use PhpParser\Node\Stmt;
|
use PhpParser\Node\Stmt;
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class FunctionTest extends \PHPUnit_Framework_TestCase
|
class FunctionTest extends TestCase
|
||||||
{
|
{
|
||||||
public function createFunctionBuilder($name) {
|
public function createFunctionBuilder($name) {
|
||||||
return new Function_($name);
|
return new Function_($name);
|
||||||
|
@ -6,8 +6,9 @@ use PhpParser\Comment;
|
|||||||
use PhpParser\Node;
|
use PhpParser\Node;
|
||||||
use PhpParser\Node\Scalar\DNumber;
|
use PhpParser\Node\Scalar\DNumber;
|
||||||
use PhpParser\Node\Stmt;
|
use PhpParser\Node\Stmt;
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class InterfaceTest extends \PHPUnit_Framework_TestCase
|
class InterfaceTest extends TestCase
|
||||||
{
|
{
|
||||||
/** @var Interface_ */
|
/** @var Interface_ */
|
||||||
protected $builder;
|
protected $builder;
|
||||||
|
@ -8,8 +8,9 @@ use PhpParser\Node\Expr\Print_;
|
|||||||
use PhpParser\Node\Expr\Variable;
|
use PhpParser\Node\Expr\Variable;
|
||||||
use PhpParser\Node\Scalar\String_;
|
use PhpParser\Node\Scalar\String_;
|
||||||
use PhpParser\Node\Stmt;
|
use PhpParser\Node\Stmt;
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class MethodTest extends \PHPUnit_Framework_TestCase
|
class MethodTest extends TestCase
|
||||||
{
|
{
|
||||||
public function createMethodBuilder($name) {
|
public function createMethodBuilder($name) {
|
||||||
return new Method($name);
|
return new Method($name);
|
||||||
|
@ -4,8 +4,9 @@ namespace PhpParser\Builder;
|
|||||||
|
|
||||||
use PhpParser\Node;
|
use PhpParser\Node;
|
||||||
use PhpParser\Node\Stmt;
|
use PhpParser\Node\Stmt;
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class NamespaceTest extends \PHPUnit_Framework_TestCase
|
class NamespaceTest extends TestCase
|
||||||
{
|
{
|
||||||
protected function createNamespaceBuilder($fqn) {
|
protected function createNamespaceBuilder($fqn) {
|
||||||
return new Namespace_($fqn);
|
return new Namespace_($fqn);
|
||||||
|
@ -5,8 +5,9 @@ namespace PhpParser\Builder;
|
|||||||
use PhpParser\Node;
|
use PhpParser\Node;
|
||||||
use PhpParser\Node\Expr;
|
use PhpParser\Node\Expr;
|
||||||
use PhpParser\Node\Scalar;
|
use PhpParser\Node\Scalar;
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class ParamTest extends \PHPUnit_Framework_TestCase
|
class ParamTest extends TestCase
|
||||||
{
|
{
|
||||||
public function createParamBuilder($name) {
|
public function createParamBuilder($name) {
|
||||||
return new Param($name);
|
return new Param($name);
|
||||||
|
@ -7,8 +7,9 @@ use PhpParser\Node\Expr;
|
|||||||
use PhpParser\Node\Name;
|
use PhpParser\Node\Name;
|
||||||
use PhpParser\Node\Scalar;
|
use PhpParser\Node\Scalar;
|
||||||
use PhpParser\Node\Stmt;
|
use PhpParser\Node\Stmt;
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class PropertyTest extends \PHPUnit_Framework_TestCase
|
class PropertyTest extends TestCase
|
||||||
{
|
{
|
||||||
public function createPropertyBuilder($name) {
|
public function createPropertyBuilder($name) {
|
||||||
return new Property($name);
|
return new Property($name);
|
||||||
|
@ -4,8 +4,9 @@ namespace PhpParser\Builder;
|
|||||||
|
|
||||||
use PhpParser\Comment;
|
use PhpParser\Comment;
|
||||||
use PhpParser\Node\Stmt;
|
use PhpParser\Node\Stmt;
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class TraitTest extends \PHPUnit_Framework_TestCase
|
class TraitTest extends TestCase
|
||||||
{
|
{
|
||||||
protected function createTraitBuilder($class) {
|
protected function createTraitBuilder($class) {
|
||||||
return new Trait_($class);
|
return new Trait_($class);
|
||||||
|
@ -3,8 +3,9 @@
|
|||||||
use PhpParser\Builder;
|
use PhpParser\Builder;
|
||||||
use PhpParser\Node\Name;
|
use PhpParser\Node\Name;
|
||||||
use PhpParser\Node\Stmt;
|
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) {
|
protected function createUseBuilder($name, $type = Stmt\Use_::TYPE_NORMAL) {
|
||||||
return new Builder\Use_($name, $type);
|
return new Builder\Use_($name, $type);
|
||||||
@ -28,7 +29,8 @@ class UseTest extends \PHPUnit_Framework_TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function testNonExistingMethod() {
|
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 = $this->createUseBuilder('Test');
|
||||||
$builder->foo();
|
$builder->foo();
|
||||||
}
|
}
|
||||||
|
@ -5,8 +5,9 @@ namespace PhpParser;
|
|||||||
use PhpParser\Node\Expr;
|
use PhpParser\Node\Expr;
|
||||||
use PhpParser\Node\Expr\BinaryOp\Concat;
|
use PhpParser\Node\Expr\BinaryOp\Concat;
|
||||||
use PhpParser\Node\Scalar\String_;
|
use PhpParser\Node\Scalar\String_;
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class BuilderFactoryTest extends \PHPUnit_Framework_TestCase
|
class BuilderFactoryTest extends TestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @dataProvider provideTestFactory
|
* @dataProvider provideTestFactory
|
||||||
@ -31,7 +32,8 @@ class BuilderFactoryTest extends \PHPUnit_Framework_TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function testNonExistingMethod() {
|
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 = new BuilderFactory();
|
||||||
$factory->foo();
|
$factory->foo();
|
||||||
}
|
}
|
||||||
|
@ -2,9 +2,11 @@
|
|||||||
|
|
||||||
namespace PhpParser;
|
namespace PhpParser;
|
||||||
|
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
require_once __DIR__ . '/CodeTestParser.php';
|
require_once __DIR__ . '/CodeTestParser.php';
|
||||||
|
|
||||||
abstract class CodeTestAbstract extends \PHPUnit_Framework_TestCase
|
abstract class CodeTestAbstract extends TestCase
|
||||||
{
|
{
|
||||||
protected function getTests($directory, $fileExtension, $chunksPerTest = 2) {
|
protected function getTests($directory, $fileExtension, $chunksPerTest = 2) {
|
||||||
$parser = new CodeTestParser;
|
$parser = new CodeTestParser;
|
||||||
|
@ -2,7 +2,9 @@
|
|||||||
|
|
||||||
namespace PhpParser;
|
namespace PhpParser;
|
||||||
|
|
||||||
class CommentTest extends \PHPUnit_Framework_TestCase
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
|
class CommentTest extends TestCase
|
||||||
{
|
{
|
||||||
public function testGetSet() {
|
public function testGetSet() {
|
||||||
$comment = new Comment('/* Some comment */', 1, 10);
|
$comment = new Comment('/* Some comment */', 1, 10);
|
||||||
@ -70,4 +72,4 @@ class CommentTest extends \PHPUnit_Framework_TestCase
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,8 +3,10 @@
|
|||||||
namespace PhpParser\ErrorHandler;
|
namespace PhpParser\ErrorHandler;
|
||||||
|
|
||||||
use PhpParser\Error;
|
use PhpParser\Error;
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class CollectingTest extends \PHPUnit_Framework_TestCase {
|
class CollectingTest extends TestCase
|
||||||
|
{
|
||||||
public function testHandleError() {
|
public function testHandleError() {
|
||||||
$errorHandler = new Collecting();
|
$errorHandler = new Collecting();
|
||||||
$this->assertFalse($errorHandler->hasErrors());
|
$this->assertFalse($errorHandler->hasErrors());
|
||||||
@ -19,4 +21,4 @@ class CollectingTest extends \PHPUnit_Framework_TestCase {
|
|||||||
$this->assertFalse($errorHandler->hasErrors());
|
$this->assertFalse($errorHandler->hasErrors());
|
||||||
$this->assertEmpty($errorHandler->getErrors());
|
$this->assertEmpty($errorHandler->getErrors());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,8 +3,10 @@
|
|||||||
namespace PhpParser\ErrorHandler;
|
namespace PhpParser\ErrorHandler;
|
||||||
|
|
||||||
use PhpParser\Error;
|
use PhpParser\Error;
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class ThrowingTest extends \PHPUnit_Framework_TestCase {
|
class ThrowingTest extends TestCase
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* @expectedException \PhpParser\Error
|
* @expectedException \PhpParser\Error
|
||||||
* @expectedExceptionMessage Test
|
* @expectedExceptionMessage Test
|
||||||
@ -13,4 +15,4 @@ class ThrowingTest extends \PHPUnit_Framework_TestCase {
|
|||||||
$errorHandler = new Throwing();
|
$errorHandler = new Throwing();
|
||||||
$errorHandler->handleError(new Error('Test'));
|
$errorHandler->handleError(new Error('Test'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,9 @@
|
|||||||
|
|
||||||
namespace PhpParser;
|
namespace PhpParser;
|
||||||
|
|
||||||
class ErrorTest extends \PHPUnit_Framework_TestCase
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
|
class ErrorTest extends TestCase
|
||||||
{
|
{
|
||||||
public function testConstruct() {
|
public function testConstruct() {
|
||||||
$attributes = array(
|
$attributes = array(
|
||||||
|
@ -3,8 +3,9 @@
|
|||||||
namespace PhpParser;
|
namespace PhpParser;
|
||||||
|
|
||||||
use PhpParser\Parser\Tokens;
|
use PhpParser\Parser\Tokens;
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class LexerTest extends \PHPUnit_Framework_TestCase
|
class LexerTest extends TestCase
|
||||||
{
|
{
|
||||||
/* To allow overwriting in parent class */
|
/* To allow overwriting in parent class */
|
||||||
protected function getLexer(array $options = array()) {
|
protected function getLexer(array $options = array()) {
|
||||||
|
@ -2,7 +2,9 @@
|
|||||||
|
|
||||||
namespace PhpParser\Node;
|
namespace PhpParser\Node;
|
||||||
|
|
||||||
class NameTest extends \PHPUnit_Framework_TestCase
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
|
class NameTest extends TestCase
|
||||||
{
|
{
|
||||||
public function testConstruct() {
|
public function testConstruct() {
|
||||||
$name = new Name(array('foo', 'bar'));
|
$name = new Name(array('foo', 'bar'));
|
||||||
@ -131,4 +133,4 @@ class NameTest extends \PHPUnit_Framework_TestCase
|
|||||||
public function testInvalidArg() {
|
public function testInvalidArg() {
|
||||||
Name::concat('foo', new \stdClass);
|
Name::concat('foo', new \stdClass);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,10 @@
|
|||||||
|
|
||||||
namespace PhpParser\Node\Scalar;
|
namespace PhpParser\Node\Scalar;
|
||||||
|
|
||||||
class MagicConstTest extends \PHPUnit_Framework_TestCase {
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
|
class MagicConstTest extends TestCase
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* @dataProvider provideTestGetName
|
* @dataProvider provideTestGetName
|
||||||
*/
|
*/
|
||||||
@ -22,4 +25,4 @@ class MagicConstTest extends \PHPUnit_Framework_TestCase {
|
|||||||
array(new MagicConst\Trait_, '__TRAIT__'),
|
array(new MagicConst\Trait_, '__TRAIT__'),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,9 @@
|
|||||||
|
|
||||||
namespace PhpParser\Node\Scalar;
|
namespace PhpParser\Node\Scalar;
|
||||||
|
|
||||||
class StringTest extends \PHPUnit_Framework_TestCase
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
|
class StringTest extends TestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @dataProvider provideTestParseEscapeSequences
|
* @dataProvider provideTestParseEscapeSequences
|
||||||
|
@ -2,7 +2,9 @@
|
|||||||
|
|
||||||
namespace PhpParser\Node\Stmt;
|
namespace PhpParser\Node\Stmt;
|
||||||
|
|
||||||
class ClassConstTest extends \PHPUnit_Framework_TestCase
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
|
class ClassConstTest extends TestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @dataProvider provideModifiers
|
* @dataProvider provideModifiers
|
||||||
@ -31,4 +33,4 @@ class ClassConstTest extends \PHPUnit_Framework_TestCase
|
|||||||
array('private'),
|
array('private'),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,9 @@
|
|||||||
|
|
||||||
namespace PhpParser\Node\Stmt;
|
namespace PhpParser\Node\Stmt;
|
||||||
|
|
||||||
class ClassMethodTest extends \PHPUnit_Framework_TestCase
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
|
class ClassMethodTest extends TestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @dataProvider provideModifiers
|
* @dataProvider provideModifiers
|
||||||
|
@ -2,7 +2,9 @@
|
|||||||
|
|
||||||
namespace PhpParser\Node\Stmt;
|
namespace PhpParser\Node\Stmt;
|
||||||
|
|
||||||
class ClassTest extends \PHPUnit_Framework_TestCase
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
|
class ClassTest extends TestCase
|
||||||
{
|
{
|
||||||
public function testIsAbstract() {
|
public function testIsAbstract() {
|
||||||
$class = new Class_('Foo', array('type' => Class_::MODIFIER_ABSTRACT));
|
$class = new Class_('Foo', array('type' => Class_::MODIFIER_ABSTRACT));
|
||||||
|
@ -3,8 +3,9 @@
|
|||||||
namespace PhpParser\Node\Stmt;
|
namespace PhpParser\Node\Stmt;
|
||||||
|
|
||||||
use PhpParser\Node;
|
use PhpParser\Node;
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class InterfaceTest extends \PHPUnit_Framework_TestCase
|
class InterfaceTest extends TestCase
|
||||||
{
|
{
|
||||||
public function testGetMethods() {
|
public function testGetMethods() {
|
||||||
$methods = array(
|
$methods = array(
|
||||||
|
@ -2,7 +2,9 @@
|
|||||||
|
|
||||||
namespace PhpParser\Node\Stmt;
|
namespace PhpParser\Node\Stmt;
|
||||||
|
|
||||||
class PropertyTest extends \PHPUnit_Framework_TestCase
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
|
class PropertyTest extends TestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @dataProvider provideModifiers
|
* @dataProvider provideModifiers
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
namespace PhpParser;
|
namespace PhpParser;
|
||||||
|
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class DummyNode extends NodeAbstract {
|
class DummyNode extends NodeAbstract {
|
||||||
public $subNode1;
|
public $subNode1;
|
||||||
public $subNode2;
|
public $subNode2;
|
||||||
@ -22,7 +24,7 @@ class DummyNode extends NodeAbstract {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class NodeAbstractTest extends \PHPUnit_Framework_TestCase
|
class NodeAbstractTest extends TestCase
|
||||||
{
|
{
|
||||||
public function provideNodes() {
|
public function provideNodes() {
|
||||||
$attributes = array(
|
$attributes = array(
|
||||||
|
@ -2,7 +2,9 @@
|
|||||||
|
|
||||||
namespace PhpParser;
|
namespace PhpParser;
|
||||||
|
|
||||||
class NodeDumperTest extends \PHPUnit_Framework_TestCase
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
|
class NodeDumperTest extends TestCase
|
||||||
{
|
{
|
||||||
private function canonicalize($string) {
|
private function canonicalize($string) {
|
||||||
return str_replace("\r\n", "\n", $string);
|
return str_replace("\r\n", "\n", $string);
|
||||||
|
@ -3,8 +3,10 @@
|
|||||||
namespace PhpParser;
|
namespace PhpParser;
|
||||||
|
|
||||||
use PhpParser\Node\Expr;
|
use PhpParser\Node\Expr;
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class NodeFinderTest extends \PHPUnit_Framework_TestCase {
|
class NodeFinderTest extends TestCase
|
||||||
|
{
|
||||||
private function getStmtsAndVars() {
|
private function getStmtsAndVars() {
|
||||||
$assign = new Expr\Assign(new Expr\Variable('a'), new Expr\BinaryOp\Concat(
|
$assign = new Expr\Assign(new Expr\Variable('a'), new Expr\BinaryOp\Concat(
|
||||||
new Expr\Variable('b'), new Expr\Variable('c')
|
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($vars[0], $finder->findFirstInstanceOf($stmts[0], Expr\Variable::class));
|
||||||
$this->assertSame(null, $finder->findFirstInstanceOf($stmts, Expr\BinaryOp\Mul::class));
|
$this->assertSame(null, $finder->findFirstInstanceOf($stmts, Expr\BinaryOp\Mul::class));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,8 +4,9 @@ namespace PhpParser;
|
|||||||
|
|
||||||
use PhpParser\Node\Expr;
|
use PhpParser\Node\Expr;
|
||||||
use PhpParser\Node\Scalar\String_;
|
use PhpParser\Node\Scalar\String_;
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class NodeTraverserTest extends \PHPUnit_Framework_TestCase
|
class NodeTraverserTest extends TestCase
|
||||||
{
|
{
|
||||||
public function testNonModifying() {
|
public function testNonModifying() {
|
||||||
$str1Node = new String_('Foo');
|
$str1Node = new String_('Foo');
|
||||||
@ -253,7 +254,8 @@ class NodeTraverserTest extends \PHPUnit_Framework_TestCase
|
|||||||
* @dataProvider provideTestInvalidReturn
|
* @dataProvider provideTestInvalidReturn
|
||||||
*/
|
*/
|
||||||
public function testInvalidReturn($visitor, $message) {
|
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)));
|
$stmts = array(new Node\Expr\UnaryMinus(new Node\Scalar\LNumber(42)));
|
||||||
|
|
||||||
|
@ -5,8 +5,10 @@ namespace PhpParser\NodeVisitor;
|
|||||||
use PhpParser\Node;
|
use PhpParser\Node;
|
||||||
use PhpParser\Node\Expr;
|
use PhpParser\Node\Expr;
|
||||||
use PhpParser\NodeTraverser;
|
use PhpParser\NodeTraverser;
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class FindingVisitorTest extends \PHPUnit_Framework_TestCase {
|
class FindingVisitorTest extends TestCase
|
||||||
|
{
|
||||||
public function testFindVariables() {
|
public function testFindVariables() {
|
||||||
$traverser = new NodeTraverser();
|
$traverser = new NodeTraverser();
|
||||||
$visitor = new FindingVisitor(function(Node $node) {
|
$visitor = new FindingVisitor(function(Node $node) {
|
||||||
@ -49,4 +51,4 @@ class FindingVisitorTest extends \PHPUnit_Framework_TestCase {
|
|||||||
$assign->expr->right,
|
$assign->expr->right,
|
||||||
], $visitor->getFoundNodes());
|
], $visitor->getFoundNodes());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,8 +5,9 @@ namespace PhpParser\NodeVisitor;
|
|||||||
use PhpParser\Node;
|
use PhpParser\Node;
|
||||||
use PhpParser\Node\Expr;
|
use PhpParser\Node\Expr;
|
||||||
use PhpParser\NodeTraverser;
|
use PhpParser\NodeTraverser;
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class FirstFindingVisitorTest extends \PHPUnit_Framework_TestCase
|
class FirstFindingVisitorTest extends TestCase
|
||||||
{
|
{
|
||||||
public function testFindFirstVariable() {
|
public function testFindFirstVariable() {
|
||||||
$traverser = new NodeTraverser();
|
$traverser = new NodeTraverser();
|
||||||
@ -35,4 +36,4 @@ class FirstFindingVisitorTest extends \PHPUnit_Framework_TestCase
|
|||||||
$traverser->traverse($stmts);
|
$traverser->traverse($stmts);
|
||||||
$this->assertSame(null, $visitor->getFoundNode());
|
$this->assertSame(null, $visitor->getFoundNode());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,8 +7,9 @@ use PhpParser\Node;
|
|||||||
use PhpParser\Node\Expr;
|
use PhpParser\Node\Expr;
|
||||||
use PhpParser\Node\Name;
|
use PhpParser\Node\Name;
|
||||||
use PhpParser\Node\Stmt;
|
use PhpParser\Node\Stmt;
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class NameResolverTest extends \PHPUnit_Framework_TestCase
|
class NameResolverTest extends TestCase
|
||||||
{
|
{
|
||||||
private function canonicalize($string) {
|
private function canonicalize($string) {
|
||||||
return str_replace("\r\n", "\n", $string);
|
return str_replace("\r\n", "\n", $string);
|
||||||
@ -346,7 +347,8 @@ EOC;
|
|||||||
* @dataProvider provideTestError
|
* @dataProvider provideTestError
|
||||||
*/
|
*/
|
||||||
public function testError(Node $stmt, $errorMsg) {
|
public function testError(Node $stmt, $errorMsg) {
|
||||||
$this->setExpectedException('PhpParser\Error', $errorMsg);
|
$this->expectException('PhpParser\Error');
|
||||||
|
$this->expectExceptionMessage($errorMsg);
|
||||||
|
|
||||||
$traverser = new PhpParser\NodeTraverser;
|
$traverser = new PhpParser\NodeTraverser;
|
||||||
$traverser->addVisitor(new NameResolver);
|
$traverser->addVisitor(new NameResolver);
|
||||||
|
@ -78,7 +78,8 @@ class MultipleTest extends ParserTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function testThrownError() {
|
public function testThrownError() {
|
||||||
$this->setExpectedException('PhpParser\Error', 'FAIL A');
|
$this->expectException('PhpParser\Error');
|
||||||
|
$this->expectExceptionMessage('FAIL A');
|
||||||
|
|
||||||
$parserA = $this->getMockBuilder('PhpParser\Parser')->getMock();
|
$parserA = $this->getMockBuilder('PhpParser\Parser')->getMock();
|
||||||
$parserA->expects($this->at(0))
|
$parserA->expects($this->at(0))
|
||||||
@ -91,4 +92,4 @@ class MultipleTest extends ParserTest {
|
|||||||
$parser = new Multiple([$parserA, $parserB]);
|
$parser = new Multiple([$parserA, $parserB]);
|
||||||
$parser->parse('dummy');
|
$parser->parse('dummy');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,10 @@ namespace PhpParser;
|
|||||||
|
|
||||||
/* This test is very weak, because PHPUnit's assertEquals assertion is way too slow dealing with the
|
/* 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. */
|
* 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 */
|
/** @dataProvider provideTestCreate */
|
||||||
public function testCreate($kind, $lexer, $expected) {
|
public function testCreate($kind, $lexer, $expected) {
|
||||||
$this->assertInstanceOf($expected, (new ParserFactory)->create($kind, $lexer));
|
$this->assertInstanceOf($expected, (new ParserFactory)->create($kind, $lexer));
|
||||||
@ -31,4 +34,4 @@ class ParserFactoryTest extends \PHPUnit_Framework_TestCase {
|
|||||||
]
|
]
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,8 +6,9 @@ use PhpParser\Comment;
|
|||||||
use PhpParser\Node\Expr;
|
use PhpParser\Node\Expr;
|
||||||
use PhpParser\Node\Scalar;
|
use PhpParser\Node\Scalar;
|
||||||
use PhpParser\Node\Scalar\String_;
|
use PhpParser\Node\Scalar\String_;
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
abstract class ParserTest extends \PHPUnit_Framework_TestCase
|
abstract class ParserTest extends TestCase
|
||||||
{
|
{
|
||||||
/** @returns Parser */
|
/** @returns Parser */
|
||||||
abstract protected function getParser(Lexer $lexer);
|
abstract protected function getParser(Lexer $lexer);
|
||||||
|
Loading…
Reference in New Issue
Block a user