fixed some PHPUnit assertions

This commit is contained in:
Fabien Potencier
2019-02-15 07:19:24 +01:00
parent 3ea04337b7
commit 40c6f1d1b9
4 changed files with 11 additions and 11 deletions
+1 -1
View File
@@ -149,7 +149,7 @@ class Twig_Tests_Loader_FilesystemTest extends \PHPUnit\Framework\TestCase
try {
$loader->getSourceContext('@named/nowhere.html');
} catch (\Exception $e) {
$this->assertInstanceof('Twig_Error_Loader', $e);
$this->assertInstanceOf('Twig_Error_Loader', $e);
$this->assertContains('Unable to find template "@named/nowhere.html"', $e->getMessage());
}
}
+1 -1
View File
@@ -26,7 +26,7 @@ class Twig_Tests_Node_ForTest extends Twig_Test_NodeTestCase
$this->assertEquals($valueTarget, $node->getNode('value_target'));
$this->assertEquals($seq, $node->getNode('seq'));
$this->assertTrue($node->getAttribute('ifexpr'));
$this->assertEquals('Twig_Node_If', \get_class($node->getNode('body')));
$this->assertInstanceOf('Twig_Node_If', $node->getNode('body'));
$this->assertEquals($body, $node->getNode('body')->getNode('tests')->getNode(1)->getNode(0));
$this->assertFalse($node->hasNode('else'));
@@ -18,7 +18,7 @@ class Twig_Tests_NodeVisitor_OptimizerTest extends \PHPUnit\Framework\TestCase
$node = $stream->getNode('body')->getNode(0);
$this->assertEquals('Twig_Node_Expression_BlockReference', \get_class($node));
$this->assertInstanceOf('Twig_Node_Expression_BlockReference', $node);
$this->assertTrue($node->getAttribute('output'));
}
@@ -30,7 +30,7 @@ class Twig_Tests_NodeVisitor_OptimizerTest extends \PHPUnit\Framework\TestCase
$node = $stream->getNode('blocks')->getNode('content')->getNode(0)->getNode('body');
$this->assertEquals('Twig_Node_Expression_Parent', \get_class($node));
$this->assertInstanceOf('Twig_Node_Expression_Parent', $node);
$this->assertTrue($node->getAttribute('output'));
}
@@ -45,7 +45,7 @@ class Twig_Tests_NodeVisitor_OptimizerTest extends \PHPUnit\Framework\TestCase
$node = $stream->getNode('body')->getNode(0)->getNode(1);
$this->assertEquals('Twig_Node_Expression_BlockReference', \get_class($node));
$this->assertInstanceOf('Twig_Node_Expression_BlockReference', $node);
$this->assertTrue($node->getAttribute('output'));
}
+6 -6
View File
@@ -120,13 +120,13 @@ class Twig_Tests_TemplateTest extends \PHPUnit\Framework\TestCase
$template = new Twig_TemplateTest($twig, 'index.twig');
$template1 = new Twig_TemplateTest($twig, 'index1.twig');
$this->assertInstanceof('Twig_Markup', $template->getAttribute($template1, 'string'));
$this->assertInstanceOf('Twig_Markup', $template->getAttribute($template1, 'string'));
$this->assertEquals('some_string', $template->getAttribute($template1, 'string'));
$this->assertInstanceof('Twig_Markup', $template->getAttribute($template1, 'true'));
$this->assertInstanceOf('Twig_Markup', $template->getAttribute($template1, 'true'));
$this->assertEquals('1', $template->getAttribute($template1, 'true'));
$this->assertInstanceof('Twig_Markup', $template->getAttribute($template1, 'zero'));
$this->assertInstanceOf('Twig_Markup', $template->getAttribute($template1, 'zero'));
$this->assertEquals('0', $template->getAttribute($template1, 'zero'));
$this->assertNotInstanceof('Twig_Markup', $template->getAttribute($template1, 'empty'));
@@ -168,13 +168,13 @@ class Twig_Tests_TemplateTest extends \PHPUnit\Framework\TestCase
$template = new Twig_TemplateTest($twig, 'index.twig');
$template1 = new Twig_TemplateTest($twig, 'index1.twig');
$this->assertInstanceof('Twig_Markup', $template->getAttribute($template1, 'string'));
$this->assertInstanceOf('Twig_Markup', $template->getAttribute($template1, 'string'));
$this->assertEquals('some_string', $template->getAttribute($template1, 'string'));
$this->assertInstanceof('Twig_Markup', $template->getAttribute($template1, 'true'));
$this->assertInstanceOf('Twig_Markup', $template->getAttribute($template1, 'true'));
$this->assertEquals('1', $template->getAttribute($template1, 'true'));
$this->assertInstanceof('Twig_Markup', $template->getAttribute($template1, 'zero'));
$this->assertInstanceOf('Twig_Markup', $template->getAttribute($template1, 'zero'));
$this->assertEquals('0', $template->getAttribute($template1, 'zero'));
$this->assertNotInstanceof('Twig_Markup', $template->getAttribute($template1, 'empty'));