[BUGFIX] Tests: Incomplete mocking in ext:scheduler 73/28273/2
authorChristian Kuhn <lolli@schwarzbu.ch>
Tue, 11 Mar 2014 19:47:34 +0000 (20:47 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Tue, 11 Mar 2014 20:19:45 +0000 (21:19 +0100)
Use getMock() instead of new() to create the test subject in order to
suppress execution of __construct() of parent AbstractTask.

Change-Id: Id0c297b845db7064b15a859eefa71830ab12074d
Resolves: #56787
Related: #51436
Releases: 6.2
Reviewed-on: https://review.typo3.org/28273
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
typo3/sysext/scheduler/Tests/Unit/Task/CachingFrameworkGarbageCollectionTest.php

index c30c366..f74e8e4 100644 (file)
@@ -68,9 +68,10 @@ class CachingFrameworkGarbageCollectionTest extends \TYPO3\CMS\Core\Tests\UnitTe
                                'backend' => 'TYPO3\\CMS\\Core\\Cache\\Backend\\AbstractBackend',
                        )
                );
-               $task = new \TYPO3\CMS\Scheduler\Task\CachingFrameworkGarbageCollectionTask();
-               $task->selectedBackends = array('TYPO3\\CMS\\Core\\Cache\\Backend\\AbstractBackend');
-               $task->execute();
+               /** @var \TYPO3\CMS\Scheduler\Task\CachingFrameworkGarbageCollectionTask|\PHPUnit_Framework_MockObject_MockObject $subject */
+               $subject = $this->getMock('TYPO3\\CMS\\Scheduler\\Task\\CachingFrameworkGarbageCollectionTask', array('dummy'), array(), '', FALSE);
+               $subject->selectedBackends = array('TYPO3\\CMS\\Core\\Cache\\Backend\\AbstractBackend');
+               $subject->execute();
        }
 
        /**
@@ -89,9 +90,10 @@ class CachingFrameworkGarbageCollectionTest extends \TYPO3\CMS\Core\Tests\UnitTe
                                'backend' => 'TYPO3\\CMS\\Core\\Cache\\Backend\\AbstractBackend',
                        )
                );
-               $task = new \TYPO3\CMS\Scheduler\Task\CachingFrameworkGarbageCollectionTask();
-               $task->selectedBackends = array('TYPO3\\CMS\\Core\\Cache\\Backend\\NullBackend');
-               $task->execute();
+               /** @var \TYPO3\CMS\Scheduler\Task\CachingFrameworkGarbageCollectionTask|\PHPUnit_Framework_MockObject_MockObject $subject */
+               $subject = $this->getMock('TYPO3\\CMS\\Scheduler\\Task\\CachingFrameworkGarbageCollectionTask', array('dummy'), array(), '', FALSE);
+               $subject->selectedBackends = array('TYPO3\\CMS\\Core\\Cache\\Backend\\NullBackend');
+               $subject->execute();
        }
 
 }