From 2ac01444bcf2c33182d568ed593bea0e39788d9e Mon Sep 17 00:00:00 2001 From: Jonathan Flueren Date: Tue, 3 May 2022 21:46:38 +0200 Subject: [PATCH] Change test request creation to work with Nextcloud 24 --- .../Controller/EpisodeActionControllerTest.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/Integration/Controller/EpisodeActionControllerTest.php b/tests/Integration/Controller/EpisodeActionControllerTest.php index 9cb6070..a45373b 100644 --- a/tests/Integration/Controller/EpisodeActionControllerTest.php +++ b/tests/Integration/Controller/EpisodeActionControllerTest.php @@ -3,7 +3,6 @@ declare(strict_types=1); namespace tests\Integration\Controller; -use OC\AppFramework\Http\Request; use OC\Security\SecureRandom; use OCA\GPodderSync\Controller\EpisodeActionController; use OCA\GPodderSync\Core\EpisodeAction\EpisodeActionSaver; @@ -14,6 +13,7 @@ use OCA\GPodderSync\Db\EpisodeAction\EpisodeActionWriter; use OCP\AppFramework\App; use OCP\AppFramework\IAppContainer; use OCP\IConfig; +use OCP\IRequest; use Test\TestCase; use tests\Helper\DatabaseTransaction; @@ -49,7 +49,7 @@ class EpisodeActionControllerTest extends TestCase $userId = uniqid("test_user"); $episodeActionController = new EpisodeActionController( "gpoddersync", - new Request([], new SecureRandom(), self::getMockBuilder(IConfig::class)->getMock()), + $this->createMock(IRequest::class), $userId, $this->container->get(EpisodeActionRepository::class), $this->container->get(EpisodeActionSaver::class) @@ -102,8 +102,10 @@ class EpisodeActionControllerTest extends TestCase "total": 500 } ]', true, 512, JSON_THROW_ON_ERROR); - $request = new Request([], new SecureRandom(), $this->getMockBuilder(IConfig::class)->getMock()); - $request->setUrlParameters($payload); + $request = $this->createMock(IRequest::class); + $request->expects($this->once()) + ->method('getParams') + ->will($this->returnValue($payload)); $episodeActionController = new EpisodeActionController( "gpoddersync", $request,