Fix test assertions that did not verify the intended behavior

This commit is contained in:
Fabien Potencier
2026-06-04 12:36:48 +02:00
parent 4b2e651dd5
commit 89e8699a73
3 changed files with 7 additions and 3 deletions
@@ -111,6 +111,8 @@ final class CorrectnessNodeVisitor implements NodeVisitorInterface
if ($node instanceof ModuleNode) {
$this->rootNodes = null;
$this->hasParent = false;
return $node;
}
if ($node instanceof BlockNode) {
--$this->blockDepth;
+2 -2
View File
@@ -45,8 +45,8 @@ class TextTest extends NodeTestCase
*/
public function testIsBlank($blank)
{
$this->isTrue((new TextNode($blank, 1))->isBlank());
$this->isTrue((new TextNode(\chr(0xEF).\chr(0xBB).\chr(0xBF).$blank, 1))->isBlank());
$this->assertTrue((new TextNode($blank, 1))->isBlank());
$this->assertTrue((new TextNode(\chr(0xEF).\chr(0xBB).\chr(0xBF).$blank, 1))->isBlank());
}
public static function getIsBlankData()
+3 -1
View File
@@ -75,7 +75,9 @@ class CorrectnessTest extends TestCase
{
$input = new TextNode(\chr(0xEF).\chr(0xBB).\chr(0xBF).$emptyText, 1);
$this->assertCount(0, $this->traverse($input, new EmptyNode()));
// a child template whose root content is only a BOM followed by blanks is valid:
// the visitor must accept it (no SyntaxError) and leave it untouched
$this->assertSame($input, $this->traverse($input, new EmptyNode()));
}
public static function getFilterBodyNodesWithBOMData()