-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathPhp85ApplicationTest.php
More file actions
55 lines (42 loc) · 1.6 KB
/
Php85ApplicationTest.php
File metadata and controls
55 lines (42 loc) · 1.6 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
45
46
47
48
49
50
51
52
53
54
55
<?php
declare(strict_types=1);
namespace Sofascore\PurgatoryBundle\Tests\Application;
use Doctrine\ORM\EntityManagerInterface;
use PHPUnit\Framework\Attributes\RequiresFunction;
use PHPUnit\Framework\Attributes\RequiresPhp;
use Sofascore\PurgatoryBundle\Test\InteractsWithPurgatory;
use Sofascore\PurgatoryBundle\Tests\Functional\AbstractKernelTestCase;
use Sofascore\PurgatoryBundle\Tests\Functional\Php85TestApplication\Controller\PlantController;
use Sofascore\PurgatoryBundle\Tests\Functional\Php85TestApplication\Entity\Plant;
#[RequiresPhp('>= 8.5')]
#[RequiresFunction('\Opis\Closure\serialize')]
final class Php85ApplicationTest extends AbstractKernelTestCase
{
use InteractsWithPurgatory;
private EntityManagerInterface $entityManager;
protected function setUp(): void
{
self::initializeApplication(['test_case' => 'Php85TestApplication', 'config' => 'app_config.yaml']);
$this->entityManager = self::getContainer()->get('doctrine.orm.entity_manager');
}
protected function tearDown(): void
{
unset($this->entityManager);
parent::tearDown();
}
/**
* @see PlantController::dryPlantsAction
*/
public function testIfWithClosure(): void
{
$plant = new Plant(waterLevel: 0);
$this->entityManager->persist($plant);
$this->entityManager->flush();
self::assertUrlIsPurged('/plants/dry');
self::clearPurger();
$plant = new Plant(waterLevel: 1);
$this->entityManager->persist($plant);
$this->entityManager->flush();
self::assertUrlIsNotPurged('/plants/dry');
}
}