Issues (3641)

Log/Processor/EnvironmentProcessorTest.php (1 issue)

1
<?php
2
3
/**
4
 * Copyright © 2016-present Spryker Systems GmbH. All rights reserved.
5
 * Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file.
6
 */
7
8
namespace SprykerTest\Shared\Application\Log\Processor;
9
10
use Codeception\Test\Unit;
11
use Spryker\Shared\Application\Log\Processor\EnvironmentProcessor;
12
use SprykerTest\Shared\Application\ApplicationSharedTester;
13
14
/**
15
 * Auto-generated group annotations
16
 *
17
 * @group SprykerTest
18
 * @group Shared
19
 * @group Application
20
 * @group Log
21
 * @group Processor
22
 * @group EnvironmentProcessorTest
23
 * Add your own group annotations below this line
24
 */
25
class EnvironmentProcessorTest extends Unit
26
{
27
    /**
28
     * @var \SprykerTest\Shared\Application\ApplicationSharedTester
29
     */
30
    protected ApplicationSharedTester $tester;
31
32
    /**
33
     * @return void
34
     */
35
    public function testInvokeShouldAddEnvironmentInformationToRecordsExtra(): void
36
    {
37
        $processor = new EnvironmentProcessor();
0 ignored issues
show
Deprecated Code introduced by
The class Spryker\Shared\Applicati...or\EnvironmentProcessor has been deprecated: Use `EnvironmentProcessor` of Log module instead. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

37
        $processor = /** @scrutinizer ignore-deprecated */ new EnvironmentProcessor();
Loading history...
38
        $result = $processor([$this->tester::EXTRA]);
39
40
        $this->assertArrayHasKey(EnvironmentProcessor::EXTRA, $result['extra']);
41
    }
42
43
    /**
44
     * @return void
45
     */
46
    public function testInvokeAddsStoreAndLocaleDataWhenDynamicStoreEnabled(): void
47
    {
48
        if (!$this->tester->isDynamicStoreEnabled()) {
49
            $this->markTestSkipped('Test is valid for Dynamic Store on-mode only.');
50
        }
51
52
        // Arrange
53
        $processor = new EnvironmentProcessor();
54
55
        // Act
56
        $result = $processor([$this->tester::EXTRA]);
57
58
        // Assert
59
        $this->assertArrayNotHasKey(EnvironmentProcessor::STORE, $result[$this->tester::EXTRA][EnvironmentProcessor::EXTRA]);
60
        $this->assertArrayNotHasKey(EnvironmentProcessor::LOCALE, $result[$this->tester::EXTRA][EnvironmentProcessor::EXTRA]);
61
    }
62
63
    /**
64
     * @return void
65
     */
66
    public function testInvokeAddsStoreAndLocaleDataWhenDynamicStoreDisabled(): void
67
    {
68
        if ($this->tester->isDynamicStoreEnabled()) {
69
            $this->markTestSkipped('Test is valid for disabled Dynamic Store on-mode only.');
70
        }
71
        // Arrange
72
        $processor = new EnvironmentProcessor();
73
74
        // Act
75
        $result = $processor([$this->tester::EXTRA]);
76
77
        // Assert
78
        $this->assertArrayHasKey(EnvironmentProcessor::STORE, $result[$this->tester::EXTRA][EnvironmentProcessor::EXTRA]);
79
        $this->assertArrayHasKey(EnvironmentProcessor::LOCALE, $result[$this->tester::EXTRA][EnvironmentProcessor::EXTRA]);
80
        $this->assertIsString($result[$this->tester::EXTRA][EnvironmentProcessor::EXTRA][EnvironmentProcessor::STORE]);
81
        $this->assertIsString($result[$this->tester::EXTRA][EnvironmentProcessor::EXTRA][EnvironmentProcessor::LOCALE]);
82
    }
83
}
84