3 declare(strict_types
=1);
5 namespace Shaarli\Front\Controller\Visitor
;
9 use Slim\Http\Response
;
11 class OpenSearchControllerTest
extends TestCase
13 use FrontControllerMockHelper
;
15 /** @var OpenSearchController */
16 protected $controller;
18 public function setUp(): void
20 $this->createContainer();
22 $this->controller
= new OpenSearchController($this->container
);
25 public function testOpenSearchController(): void
27 $request = $this->createMock(Request
::class);
28 $response = new Response();
30 // Save RainTPL assigned variables
31 $assignedVariables = [];
32 $this->assignTemplateVars($assignedVariables);
34 $result = $this->controller
->index($request, $response);
36 static::assertSame(200, $result->getStatusCode());
37 static::assertStringContainsString(
38 'application/opensearchdescription+xml',
39 $result->getHeader('Content-Type')[0]
41 static::assertSame('opensearch', (string) $result->getBody());
42 static::assertSame('http://shaarli/subfolder/', $assignedVariables['serverurl']);