From a5a9cf23acd1248585173aa32757d9720b5f2d62 Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Tue, 29 Sep 2020 14:41:40 +0200 Subject: Compatibility with PHPUnit 9 --- .../controller/visitor/FeedControllerTest.php | 38 +++++++++++++--------- 1 file changed, 22 insertions(+), 16 deletions(-) (limited to 'tests/front/controller/visitor/FeedControllerTest.php') diff --git a/tests/front/controller/visitor/FeedControllerTest.php b/tests/front/controller/visitor/FeedControllerTest.php index 0a6b577f..4ae7c925 100644 --- a/tests/front/controller/visitor/FeedControllerTest.php +++ b/tests/front/controller/visitor/FeedControllerTest.php @@ -4,8 +4,8 @@ declare(strict_types=1); namespace Shaarli\Front\Controller\Visitor; -use PHPUnit\Framework\TestCase; use Shaarli\Feed\FeedBuilder; +use Shaarli\TestCase; use Slim\Http\Request; use Slim\Http\Response; @@ -45,14 +45,16 @@ class FeedControllerTest extends TestCase // Make sure that PluginManager hook is triggered $this->container->pluginManager - ->expects(static::at(0)) + ->expects(static::atLeastOnce()) ->method('executeHooks') + ->withConsecutive(['render_feed']) ->willReturnCallback(function (string $hook, array $data, array $param): void { - static::assertSame('render_feed', $hook); - static::assertSame('data', $data['content']); + if ('render_feed' === $hook) { + static::assertSame('data', $data['content']); - static::assertArrayHasKey('loggedin', $param); - static::assertSame('feed.rss', $param['target']); + static::assertArrayHasKey('loggedin', $param); + static::assertSame('feed.rss', $param['target']); + } }) ; @@ -84,14 +86,16 @@ class FeedControllerTest extends TestCase // Make sure that PluginManager hook is triggered $this->container->pluginManager - ->expects(static::at(0)) + ->expects(static::atLeastOnce()) ->method('executeHooks') + ->withConsecutive(['render_feed']) ->willReturnCallback(function (string $hook, array $data, array $param): void { - static::assertSame('render_feed', $hook); - static::assertSame('data', $data['content']); + if ('render_feed' === $hook) { + static::assertSame('data', $data['content']); - static::assertArrayHasKey('loggedin', $param); - static::assertSame('feed.atom', $param['target']); + static::assertArrayHasKey('loggedin', $param); + static::assertSame('feed.atom', $param['target']); + } }) ; @@ -124,14 +128,16 @@ class FeedControllerTest extends TestCase // Make sure that PluginManager hook is triggered $this->container->pluginManager - ->expects(static::at(0)) + ->expects(static::atLeastOnce()) ->method('executeHooks') + ->withConsecutive(['render_feed']) ->willReturnCallback(function (string $hook, array $data, array $param): void { - static::assertSame('render_feed', $hook); - static::assertSame('data', $data['content']); + if ('render_feed' === $hook) { + static::assertSame('data', $data['content']); - static::assertArrayHasKey('loggedin', $param); - static::assertSame('feed.atom', $param['target']); + static::assertArrayHasKey('loggedin', $param); + static::assertSame('feed.atom', $param['target']); + } }) ; -- cgit v1.2.3