diff options
Diffstat (limited to 'tests/front/controller/visitor/FeedControllerTest.php')
-rw-r--r-- | tests/front/controller/visitor/FeedControllerTest.php | 38 |
1 files changed, 22 insertions, 16 deletions
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); | |||
4 | 4 | ||
5 | namespace Shaarli\Front\Controller\Visitor; | 5 | namespace Shaarli\Front\Controller\Visitor; |
6 | 6 | ||
7 | use PHPUnit\Framework\TestCase; | ||
8 | use Shaarli\Feed\FeedBuilder; | 7 | use Shaarli\Feed\FeedBuilder; |
8 | use Shaarli\TestCase; | ||
9 | use Slim\Http\Request; | 9 | use Slim\Http\Request; |
10 | use Slim\Http\Response; | 10 | use Slim\Http\Response; |
11 | 11 | ||
@@ -45,14 +45,16 @@ class FeedControllerTest extends TestCase | |||
45 | 45 | ||
46 | // Make sure that PluginManager hook is triggered | 46 | // Make sure that PluginManager hook is triggered |
47 | $this->container->pluginManager | 47 | $this->container->pluginManager |
48 | ->expects(static::at(0)) | 48 | ->expects(static::atLeastOnce()) |
49 | ->method('executeHooks') | 49 | ->method('executeHooks') |
50 | ->withConsecutive(['render_feed']) | ||
50 | ->willReturnCallback(function (string $hook, array $data, array $param): void { | 51 | ->willReturnCallback(function (string $hook, array $data, array $param): void { |
51 | static::assertSame('render_feed', $hook); | 52 | if ('render_feed' === $hook) { |
52 | static::assertSame('data', $data['content']); | 53 | static::assertSame('data', $data['content']); |
53 | 54 | ||
54 | static::assertArrayHasKey('loggedin', $param); | 55 | static::assertArrayHasKey('loggedin', $param); |
55 | static::assertSame('feed.rss', $param['target']); | 56 | static::assertSame('feed.rss', $param['target']); |
57 | } | ||
56 | }) | 58 | }) |
57 | ; | 59 | ; |
58 | 60 | ||
@@ -84,14 +86,16 @@ class FeedControllerTest extends TestCase | |||
84 | 86 | ||
85 | // Make sure that PluginManager hook is triggered | 87 | // Make sure that PluginManager hook is triggered |
86 | $this->container->pluginManager | 88 | $this->container->pluginManager |
87 | ->expects(static::at(0)) | 89 | ->expects(static::atLeastOnce()) |
88 | ->method('executeHooks') | 90 | ->method('executeHooks') |
91 | ->withConsecutive(['render_feed']) | ||
89 | ->willReturnCallback(function (string $hook, array $data, array $param): void { | 92 | ->willReturnCallback(function (string $hook, array $data, array $param): void { |
90 | static::assertSame('render_feed', $hook); | 93 | if ('render_feed' === $hook) { |
91 | static::assertSame('data', $data['content']); | 94 | static::assertSame('data', $data['content']); |
92 | 95 | ||
93 | static::assertArrayHasKey('loggedin', $param); | 96 | static::assertArrayHasKey('loggedin', $param); |
94 | static::assertSame('feed.atom', $param['target']); | 97 | static::assertSame('feed.atom', $param['target']); |
98 | } | ||
95 | }) | 99 | }) |
96 | ; | 100 | ; |
97 | 101 | ||
@@ -124,14 +128,16 @@ class FeedControllerTest extends TestCase | |||
124 | 128 | ||
125 | // Make sure that PluginManager hook is triggered | 129 | // Make sure that PluginManager hook is triggered |
126 | $this->container->pluginManager | 130 | $this->container->pluginManager |
127 | ->expects(static::at(0)) | 131 | ->expects(static::atLeastOnce()) |
128 | ->method('executeHooks') | 132 | ->method('executeHooks') |
133 | ->withConsecutive(['render_feed']) | ||
129 | ->willReturnCallback(function (string $hook, array $data, array $param): void { | 134 | ->willReturnCallback(function (string $hook, array $data, array $param): void { |
130 | static::assertSame('render_feed', $hook); | 135 | if ('render_feed' === $hook) { |
131 | static::assertSame('data', $data['content']); | 136 | static::assertSame('data', $data['content']); |
132 | 137 | ||
133 | static::assertArrayHasKey('loggedin', $param); | 138 | static::assertArrayHasKey('loggedin', $param); |
134 | static::assertSame('feed.atom', $param['target']); | 139 | static::assertSame('feed.atom', $param['target']); |
140 | } | ||
135 | }) | 141 | }) |
136 | ; | 142 | ; |
137 | 143 | ||