blob: 5f9f5b1285c42eb72200710a24d8f2fa26c0cd7e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
<?php
declare(strict_types=1);
namespace Shaarli\Front\Controller\Visitor;
use PHPUnit\Framework\TestCase;
use Slim\Http\Request;
use Slim\Http\Response;
class OpenSearchControllerTest extends TestCase
{
use FrontControllerMockHelper;
/** @var OpenSearchController */
protected $controller;
public function setUp(): void
{
$this->createContainer();
$this->controller = new OpenSearchController($this->container);
}
public function testOpenSearchController(): void
{
$request = $this->createMock(Request::class);
$response = new Response();
// Save RainTPL assigned variables
$assignedVariables = [];
$this->assignTemplateVars($assignedVariables);
$result = $this->controller->index($request, $response);
static::assertSame(200, $result->getStatusCode());
static::assertStringContainsString(
'application/opensearchdescription+xml',
$result->getHeader('Content-Type')[0]
);
static::assertSame('opensearch', (string) $result->getBody());
static::assertSame('http://shaarli', $assignedVariables['serverurl']);
}
}
|