blob: 0f27ec2fd3d66f66090302cad3abf6df74ac671c (
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
45
46
47
|
<?php
declare(strict_types=1);
namespace Shaarli\Front\Controller\Admin\ManageShaareControllerTest;
use Shaarli\Front\Controller\Admin\FrontAdminControllerMockHelper;
use Shaarli\Front\Controller\Admin\ManageShaareController;
use Shaarli\Http\HttpAccess;
use Shaarli\TestCase;
use Slim\Http\Request;
use Slim\Http\Response;
class AddShaareTest extends TestCase
{
use FrontAdminControllerMockHelper;
/** @var ManageShaareController */
protected $controller;
public function setUp(): void
{
$this->createContainer();
$this->container->httpAccess = $this->createMock(HttpAccess::class);
$this->controller = new ManageShaareController($this->container);
}
/**
* Test displaying add link page
*/
public function testAddShaare(): void
{
$assignedVariables = [];
$this->assignTemplateVars($assignedVariables);
$request = $this->createMock(Request::class);
$response = new Response();
$result = $this->controller->addShaare($request, $response);
static::assertSame(200, $result->getStatusCode());
static::assertSame('addlink', (string) $result->getBody());
static::assertSame('Shaare a new link - Shaarli', $assignedVariables['pagetitle']);
}
}
|