declare(strict_types=1);
-namespace Shaarli\Front\Controller\Admin\ManageShaareControllerTest;
+namespace Shaarli\Front\Controller\Admin\ShaareManageControllerTest;
use Shaarli\Bookmark\Bookmark;
use Shaarli\Bookmark\Exception\BookmarkNotFoundException;
use Shaarli\Formatter\BookmarkFormatter;
use Shaarli\Formatter\FormatterFactory;
use Shaarli\Front\Controller\Admin\FrontAdminControllerMockHelper;
-use Shaarli\Front\Controller\Admin\ManageShaareController;
+use Shaarli\Front\Controller\Admin\ShaareManageController;
use Shaarli\Http\HttpAccess;
use Shaarli\Security\SessionManager;
use Shaarli\TestCase;
{
use FrontAdminControllerMockHelper;
- /** @var ManageShaareController */
+ /** @var ShaareManageController */
protected $controller;
public function setUp(): void
$this->createContainer();
$this->container->httpAccess = $this->createMock(HttpAccess::class);
- $this->controller = new ManageShaareController($this->container);
+ $this->controller = new ShaareManageController($this->container);
}
/**
{
$parameters = ['id' => '123'];
+ $this->container->environment['HTTP_REFERER'] = 'http://shaarli/subfolder/shaare/abcdef';
+
$request = $this->createMock(Request::class);
$request
->method('getParam')
{
$parameters = ['id' => '123 456 789'];
+ $this->container->environment['HTTP_REFERER'] = 'http://shaarli/subfolder/?searchtags=abcdef';
+
$request = $this->createMock(Request::class);
$request
->method('getParam')
$result = $this->controller->deleteBookmark($request, $response);
static::assertSame(302, $result->getStatusCode());
- static::assertSame(['/subfolder/'], $result->getHeader('location'));
+ static::assertSame(['/subfolder/?searchtags=abcdef'], $result->getHeader('location'));
}
/**
;
$response = new Response();
+ $this->container->bookmarkService->method('get')->with('123')->willReturn(
+ (new Bookmark())->setId(123)->setUrl('http://domain.tld')->setTitle('Title 123')
+ );
+
$this->container->formatterFactory = $this->createMock(FormatterFactory::class);
$this->container->formatterFactory
->expects(static::once())