GlobalStateTest::setUp()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
c 0
b 0
f 0
dl 0
loc 4
rs 10
cc 2
nc 2
nop 0
1
<?php
2
3
namespace Zenstruck\Foundry\Tests\Functional;
4
5
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
6
use Zenstruck\Foundry\Test\Factories;
7
use Zenstruck\Foundry\Test\ResetDatabase;
8
use Zenstruck\Foundry\Tests\Fixtures\Factories\TagFactory;
9
use Zenstruck\Foundry\Tests\Fixtures\Stories\TagStory;
10
11
/**
12
 * @author Kevin Bond <[email protected]>
13
 */
14
final class GlobalStateTest extends KernelTestCase
15
{
16
    use Factories, ResetDatabase;
17
18
    protected function setUp(): void
19
    {
20
        if (false === \getenv('DATABASE_URL')) {
21
            self::markTestSkipped('doctrine/orm not enabled.');
22
        }
23
    }
24
25
    /**
26
     * @test
27
     */
28
    public function tag_story_is_added_as_global_state(): void
29
    {
30
        TagFactory::repository()->assert()->count(2);
31
        TagFactory::repository()->assert()->exists(['name' => 'dev']);
32
        TagFactory::repository()->assert()->exists(['name' => 'design']);
33
    }
34
35
    /**
36
     * @test
37
     */
38
    public function ensure_global_story_is_not_loaded_again(): void
39
    {
40
        TagStory::load();
41
        TagStory::load();
42
43
        TagFactory::repository()->assert()->count(2);
44
    }
45
}
46