[TASK] Adapt ArrayConstraints in IndexerTest 89/19489/2
authorSteffen Ritter <info@rs-websystems.de>
Mon, 1 Apr 2013 13:04:19 +0000 (15:04 +0200)
committerOliver Hader <oliver.hader@typo3.org>
Mon, 1 Apr 2013 13:43:11 +0000 (15:43 +0200)
The tests for a parameter array check for equality of
the parameter array and the according value.
Instead we only wanna know if two keys are present and
set correctly and we do not care about other array values.

This refactors the Test to be more polite and is a follow-up
for #46596.

Change-Id: Ia7b4a0521b1d11b9494de2ff766f11b3c8bd1f60
Releases: 6.0, 6.1
Related: #46596
Reviewed-on: https://review.typo3.org/19487
Reviewed-by: Oliver Hader
Tested-by: Oliver Hader
Reviewed-on: https://review.typo3.org/19489

typo3/sysext/core/Tests/Unit/Resource/Service/IndexerServiceTest.php

index 9fa262e..ffae44b 100644 (file)
@@ -105,10 +105,14 @@ class IndexerServiceTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                $fixture->expects($this->any())->method('getRepository')->will($this->returnValue($repositoryMock));
 
                $GLOBALS['TYPO3_DB'] = $this->getMock('TYPO3\\CMS\\Core\\Database\\DatabaseConnection', array(), array(), '', FALSE);
-               $GLOBALS['TYPO3_DB']->expects($this->once())->method('exec_INSERTquery')->with($this->anything(), $this->equalTo(array(
-                       'crdate' => $GLOBALS['EXEC_TIME'],
-                       'tstamp' => $GLOBALS['EXEC_TIME']
-               )));
+
+               $arrayConstraint = $this->logicalAnd(
+                       $this->arrayHasKey('crdate'),
+                       $this->arrayHasKey('tstamp'),
+                       $this->contains($GLOBALS['EXEC_TIME'])
+               );
+
+               $GLOBALS['TYPO3_DB']->expects($this->once())->method('exec_INSERTquery')->with($this->anything(), $arrayConstraint);
 
                $mockedFile = $this->getMock('TYPO3\\CMS\\Core\\Resource\\File', array(), array(), '', FALSE);