summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2018-06-13 23:14:42 +0200
committerGitHub <noreply@github.com>2018-06-13 23:14:42 +0200
commite2795b02023501b158e92023fe2d57b08761639d (patch)
tree804cb7f0ee24fa60990b988c8a4571a049a0bd67
parent699049be1b24a9d2d357f1a51bc5bad6fe79eec8 (diff)
parente4db293cc17acb855c9cd50f5ab9d5c840fe6dc2 (diff)
downloadnextcloud-server-e2795b02023501b158e92023fe2d57b08761639d.tar.gz
nextcloud-server-e2795b02023501b158e92023fe2d57b08761639d.zip
Merge pull request #9859 from nextcloud/fix/noid/iconcontroller_timing_fix
Fix possible test timing issues in IconController
-rw-r--r--apps/theming/lib/Controller/IconController.php6
-rw-r--r--apps/theming/tests/Controller/IconControllerTest.php6
2 files changed, 4 insertions, 8 deletions
diff --git a/apps/theming/lib/Controller/IconController.php b/apps/theming/lib/Controller/IconController.php
index 13f385e0bd1..0caf9a2bc37 100644
--- a/apps/theming/lib/Controller/IconController.php
+++ b/apps/theming/lib/Controller/IconController.php
@@ -34,15 +34,12 @@ use OCP\AppFramework\Http\NotFoundResponse;
use OCP\AppFramework\Http\FileDisplayResponse;
use OCP\AppFramework\Http\DataDisplayResponse;
use OCP\AppFramework\Http\Response;
-use OCP\AppFramework\Utility\ITimeFactory;
use OCP\Files\NotFoundException;
use OCP\IRequest;
class IconController extends Controller {
/** @var ThemingDefaults */
private $themingDefaults;
- /** @var ITimeFactory */
- private $timeFactory;
/** @var IconBuilder */
private $iconBuilder;
/** @var ImageManager */
@@ -56,7 +53,6 @@ class IconController extends Controller {
* @param string $appName
* @param IRequest $request
* @param ThemingDefaults $themingDefaults
- * @param ITimeFactory $timeFactory
* @param IconBuilder $iconBuilder
* @param ImageManager $imageManager
* @param FileAccessHelper $fileAccessHelper
@@ -65,7 +61,6 @@ class IconController extends Controller {
$appName,
IRequest $request,
ThemingDefaults $themingDefaults,
- ITimeFactory $timeFactory,
IconBuilder $iconBuilder,
ImageManager $imageManager,
FileAccessHelper $fileAccessHelper
@@ -73,7 +68,6 @@ class IconController extends Controller {
parent::__construct($appName, $request);
$this->themingDefaults = $themingDefaults;
- $this->timeFactory = $timeFactory;
$this->iconBuilder = $iconBuilder;
$this->imageManager = $imageManager;
$this->fileAccessHelper = $fileAccessHelper;
diff --git a/apps/theming/tests/Controller/IconControllerTest.php b/apps/theming/tests/Controller/IconControllerTest.php
index f509005d32c..6d8ede159b3 100644
--- a/apps/theming/tests/Controller/IconControllerTest.php
+++ b/apps/theming/tests/Controller/IconControllerTest.php
@@ -64,19 +64,21 @@ class IconControllerTest extends TestCase {
public function setUp() {
$this->request = $this->createMock(IRequest::class);
$this->themingDefaults = $this->createMock(ThemingDefaults::class);
- $this->timeFactory = $this->createMock(ITimeFactory::class);
$this->iconBuilder = $this->createMock(IconBuilder::class);
$this->imageManager = $this->createMock(ImageManager::class);
$this->fileAccessHelper = $this->createMock(FileAccessHelper::class);
+
+ $this->timeFactory = $this->createMock(ITimeFactory::class);
$this->timeFactory->expects($this->any())
->method('getTime')
->willReturn(123);
+ $this->overwriteService(ITimeFactory::class, $this->timeFactory);
+
$this->iconController = new IconController(
'theming',
$this->request,
$this->themingDefaults,
- $this->timeFactory,
$this->iconBuilder,
$this->imageManager,
$this->fileAccessHelper