xref: /plugin/today/_test/ActionTest.php (revision 6fbe93960df735a9983404b33ba7853b0dcd1fd0)
1<?php
2
3declare(strict_types=1);
4
5namespace dokuwiki\plugin\today\test;
6
7use DokuWikiTest;
8use TestRequest;
9
10/**
11 * Tests for the `?do=today&namespace=foo:bar` action component of the today plugin
12 *
13 * @group plugin_today
14 * @group plugins
15 */
16final class ActionTest extends DokuWikiTest {
17    protected $pluginsEnabled = ['today'];
18
19    public function testRedirect(): void
20    {
21        $request = new TestRequest();
22        $response = $request->get(['do' => 'today', 'namespace' => 'foo:bar']);
23
24        $actualUrl = $response->getData('send_redirect')[0];
25        $expectedUrl = '/doku.php?id=foo:bar:' . date('Y-m-d');
26        $this->assertSame( $expectedUrl, $actualUrl);
27    }
28}
29