-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTrashFacade.php
More file actions
44 lines (34 loc) · 1.38 KB
/
TrashFacade.php
File metadata and controls
44 lines (34 loc) · 1.38 KB
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
/**
* @copyright Copyright (C) Ibexa AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
declare(strict_types=1);
namespace Ibexa\Behat\API\Facade;
use Ibexa\Contracts\Core\Repository\LocationService;
use Ibexa\Contracts\Core\Repository\TrashService;
use Ibexa\Contracts\Core\Repository\URLAliasService;
use Ibexa\Contracts\Core\Repository\Values\Content\URLAlias;
use PHPUnit\Framework\Assert;
class TrashFacade
{
/** @var \Ibexa\Contracts\Core\Repository\LocationService */
private $locationService;
/** @var \Ibexa\Contracts\Core\Repository\URLAliasService */
private $urlAliasService;
/** @var \Ibexa\Contracts\Core\Repository\TrashService */
private $trashService;
public function __construct(LocationService $locationService, URLAliasService $urlAliasService, TrashService $trashService)
{
$this->locationService = $locationService;
$this->urlAliasService = $urlAliasService;
$this->trashService = $trashService;
}
public function trash(string $locationURL)
{
$urlAlias = $this->urlAliasService->lookup($locationURL);
Assert::assertEquals(URLAlias::LOCATION, $urlAlias->type);
$location = $this->locationService->loadLocation((int) $urlAlias->destination);
$this->trashService->trash($location);
}
}