Commit 4a737c92 authored by Thomas Löffler's avatar Thomas Löffler

Fix unit tests after upgrading nikic/php-parser

parent 6c5cca58
Pipeline #7437 passed with stages
in 3 minutes and 20 seconds
......@@ -47,7 +47,7 @@ class ArrayAssurer extends \PhpParser\NodeVisitorAbstract
}
}
// We must not have another assignment
throw new \UnexpectedValueException();
return \PhpParser\NodeTraverser::REMOVE_NODE;
}
if (!(
$node instanceof Node\Name
......@@ -57,9 +57,10 @@ class ArrayAssurer extends \PhpParser\NodeVisitorAbstract
|| $node instanceof Expr\ArrayItem
|| $node instanceof Expr\ConstFetch
|| $node instanceof Expr\Variable
|| $node instanceof Node\Stmt\Expression
)
) {
return false;
return \PhpParser\NodeTraverser::REMOVE_NODE;
}
}
}
......@@ -73,10 +73,9 @@ class ArchiveUtilityTest extends \Nimut\TestingFramework\TestCase\UnitTestCase
/**
* @test
*/
public function extractEmConfReturnsSaveArrayOnlyForInvalidNodeFunction()
public function extractEmConfReturnsNullForInvalidNodeFunction()
{
$code = '<?php $EM_CONF[$_EXTKEY] = array(\'bar\' => \'baz\'); function foo() {} ?>';
$expected = ['bar' => 'baz'];
$subject = $this->getAccessibleMock(
\T3o\TerFe2\Utility\ArchiveUtility::class,
......@@ -84,8 +83,7 @@ class ArchiveUtilityTest extends \Nimut\TestingFramework\TestCase\UnitTestCase
);
$emConf = $subject->_call('extractEmConf', $code);
$this->assertNotNull($emConf);
$this->assertSame($expected, $emConf);
$this->assertNull($emConf);
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment