1
0
mirror of https://github.com/danog/PHP-Parser.git synced 2024-11-30 04:19:30 +01:00

Refactoring tests

This commit is contained in:
Gabriel Caruso 2017-12-12 09:02:49 -02:00 committed by Nikita Popov
parent 4dbb02c57b
commit 83b958763f
4 changed files with 9 additions and 9 deletions

View File

@ -49,7 +49,7 @@ class ErrorTest extends TestCase
'endFilePos' => $endPos,
]);
$this->assertSame(true, $error->hasColumnInfo());
$this->assertTrue($error->hasColumnInfo());
$this->assertSame($startColumn, $error->getStartColumn($code));
$this->assertSame($endColumn, $error->getEndColumn($code));
@ -79,7 +79,7 @@ class ErrorTest extends TestCase
public function testNoColumnInfo() {
$error = new Error('Some error', 3);
$this->assertSame(false, $error->hasColumnInfo());
$this->assertFalse($error->hasColumnInfo());
try {
$error->getStartColumn('');
$this->fail('Expected RuntimeException');

View File

@ -27,7 +27,7 @@ class LexerTest extends TestCase
$lexer->startLexing($code, $errorHandler);
$errors = $errorHandler->getErrors();
$this->assertSame(count($messages), count($errors));
$this->assertCount(count($messages), $errors);
for ($i = 0; $i < count($messages); $i++) {
$this->assertSame($messages[$i], $errors[$i]->getMessageWithColumnInfo($code));
}

View File

@ -64,9 +64,9 @@ class NodeAbstractTest extends TestCase
$this->assertSame('/** doc comment */', $node->getDocComment()->getText());
$this->assertSame('value1', $node->subNode1);
$this->assertSame('value2', $node->subNode2);
$this->assertTrue(isset($node->subNode1));
$this->assertTrue(isset($node->subNode2));
$this->assertFalse(isset($node->subNode3));
$this->assertObjectHasAttribute('subNode1', $node);
$this->assertObjectHasAttribute('subNode2', $node);
$this->assertObjectNotHasAttribute('subNode3', $node);
$this->assertSame($attributes, $node->getAttributes());
$this->assertSame($attributes['comments'], $node->getComments());
@ -126,7 +126,7 @@ class NodeAbstractTest extends TestCase
// removal
unset($node->subNode);
$this->assertFalse(isset($node->subNode));
$this->assertObjectNotHasAttribute('subNode', $node);
}
/**

View File

@ -47,7 +47,7 @@ class NodeFinderTest extends TestCase
$this->assertSame($vars[0], $finder->findFirst($stmts[0], $varFilter));
$noneFilter = function () { return false; };
$this->assertSame(null, $finder->findFirst($stmts, $noneFilter));
$this->assertNull($finder->findFirst($stmts, $noneFilter));
}
public function testFindFirstInstanceOf() {
@ -55,6 +55,6 @@ class NodeFinderTest extends TestCase
list($stmts, $vars) = $this->getStmtsAndVars();
$this->assertSame($vars[0], $finder->findFirstInstanceOf($stmts, 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->assertNull($finder->findFirstInstanceOf($stmts, Expr\BinaryOp\Mul::class));
}
}