Change test request creation to work with Nextcloud 24

This commit is contained in:
Jonathan Flueren 2022-05-03 21:46:38 +02:00 committed by thrillfall
parent 99967b8769
commit 2ac01444bc

View File

@ -3,7 +3,6 @@ declare(strict_types=1);
namespace tests\Integration\Controller; namespace tests\Integration\Controller;
use OC\AppFramework\Http\Request;
use OC\Security\SecureRandom; use OC\Security\SecureRandom;
use OCA\GPodderSync\Controller\EpisodeActionController; use OCA\GPodderSync\Controller\EpisodeActionController;
use OCA\GPodderSync\Core\EpisodeAction\EpisodeActionSaver; use OCA\GPodderSync\Core\EpisodeAction\EpisodeActionSaver;
@ -14,6 +13,7 @@ use OCA\GPodderSync\Db\EpisodeAction\EpisodeActionWriter;
use OCP\AppFramework\App; use OCP\AppFramework\App;
use OCP\AppFramework\IAppContainer; use OCP\AppFramework\IAppContainer;
use OCP\IConfig; use OCP\IConfig;
use OCP\IRequest;
use Test\TestCase; use Test\TestCase;
use tests\Helper\DatabaseTransaction; use tests\Helper\DatabaseTransaction;
@ -49,7 +49,7 @@ class EpisodeActionControllerTest extends TestCase
$userId = uniqid("test_user"); $userId = uniqid("test_user");
$episodeActionController = new EpisodeActionController( $episodeActionController = new EpisodeActionController(
"gpoddersync", "gpoddersync",
new Request([], new SecureRandom(), self::getMockBuilder(IConfig::class)->getMock()), $this->createMock(IRequest::class),
$userId, $userId,
$this->container->get(EpisodeActionRepository::class), $this->container->get(EpisodeActionRepository::class),
$this->container->get(EpisodeActionSaver::class) $this->container->get(EpisodeActionSaver::class)
@ -102,8 +102,10 @@ class EpisodeActionControllerTest extends TestCase
"total": 500 "total": 500
} }
]', true, 512, JSON_THROW_ON_ERROR); ]', true, 512, JSON_THROW_ON_ERROR);
$request = new Request([], new SecureRandom(), $this->getMockBuilder(IConfig::class)->getMock()); $request = $this->createMock(IRequest::class);
$request->setUrlParameters($payload); $request->expects($this->once())
->method('getParams')
->will($this->returnValue($payload));
$episodeActionController = new EpisodeActionController( $episodeActionController = new EpisodeActionController(
"gpoddersync", "gpoddersync",
$request, $request,