-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathLocationTest.php
More file actions
34 lines (28 loc) · 1.27 KB
/
LocationTest.php
File metadata and controls
34 lines (28 loc) · 1.27 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
<?php
declare(strict_types=1);
namespace Netgen\IbexaScheduledVisibility\Tests\Integration;
use Netgen\Bundle\IbexaScheduledVisibilityBundle\Core\VisibilityHandler\Location;
use PHPUnit\Framework\Attributes\DataProvider;
final class LocationTest extends BaseTest
{
#[DataProvider('provideCases')]
public function testUpdateVisibility(array $configuration, bool $expectedHidden)
{
$scheduledVisibilityService = $this->getScheduledVisibilityService();
$content = $this->createContent($configuration['publish_from'], $configuration['publish_to']);
$handler = $this->getLocationHandler();
if ($scheduledVisibilityService->shouldBeHidden($content) && !$handler->isHidden($content)) {
$handler->hide($content);
}
if ($scheduledVisibilityService->shouldBeVisible($content) && $handler->isHidden($content)) {
$handler->reveal($content);
}
$content = $this->getRepository()->getContentService()->loadContent($content->contentInfo->id);
self::assertEquals($handler->isHidden($content), $expectedHidden);
}
private function getLocationHandler(): Location
{
$repository = $this->getRepository();
return new Location($repository, $repository->getLocationService());
}
}