Commit 77279171 authored by Thomas Löffler's avatar Thomas Löffler
Browse files

Fix unit tests after upgrading nikic/php-parser

parent c6555fe3
...@@ -47,7 +47,7 @@ class ArrayAssurer extends \PhpParser\NodeVisitorAbstract ...@@ -47,7 +47,7 @@ class ArrayAssurer extends \PhpParser\NodeVisitorAbstract
} }
} }
// We must not have another assignment // We must not have another assignment
throw new \UnexpectedValueException(); return \PhpParser\NodeTraverser::REMOVE_NODE;
} }
if (!( if (!(
$node instanceof Node\Name $node instanceof Node\Name
...@@ -57,9 +57,10 @@ class ArrayAssurer extends \PhpParser\NodeVisitorAbstract ...@@ -57,9 +57,10 @@ class ArrayAssurer extends \PhpParser\NodeVisitorAbstract
|| $node instanceof Expr\ArrayItem || $node instanceof Expr\ArrayItem
|| $node instanceof Expr\ConstFetch || $node instanceof Expr\ConstFetch
|| $node instanceof Expr\Variable || $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 ...@@ -73,10 +73,9 @@ class ArchiveUtilityTest extends \Nimut\TestingFramework\TestCase\UnitTestCase
/** /**
* @test * @test
*/ */
public function extractEmConfReturnsSaveArrayOnlyForInvalidNodeFunction() public function extractEmConfReturnsNullForInvalidNodeFunction()
{ {
$code = '<?php $EM_CONF[$_EXTKEY] = array(\'bar\' => \'baz\'); function foo() {} ?>'; $code = '<?php $EM_CONF[$_EXTKEY] = array(\'bar\' => \'baz\'); function foo() {} ?>';
$expected = ['bar' => 'baz'];
$subject = $this->getAccessibleMock( $subject = $this->getAccessibleMock(
\T3o\TerFe2\Utility\ArchiveUtility::class, \T3o\TerFe2\Utility\ArchiveUtility::class,
...@@ -84,8 +83,7 @@ class ArchiveUtilityTest extends \Nimut\TestingFramework\TestCase\UnitTestCase ...@@ -84,8 +83,7 @@ class ArchiveUtilityTest extends \Nimut\TestingFramework\TestCase\UnitTestCase
); );
$emConf = $subject->_call('extractEmConf', $code); $emConf = $subject->_call('extractEmConf', $code);
$this->assertNotNull($emConf); $this->assertNull($emConf);
$this->assertSame($expected, $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