Passed
Pull Request — master (#213)
by Ruslan
18:45
created

SearchEndpointMessageTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 14
dl 0
loc 44
c 1
b 0
f 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testSearchEndpointAvailableMessageIsSuccessfullyHandled() 0 12 1
A testSearchEndpointRemovedMessageIsSuccessfullyHandled() 0 17 1
1
<?php
2
3
/**
4
 * This file is part of the Spryker Commerce OS.
5
 * For full license information, please view the LICENSE file that was distributed with this source code.
6
 */
7
8
namespace PyzTest\Zed\MessageBroker\MessageHandlers\SearchHttp\Communication;
9
10
use Codeception\Test\Unit;
11
use PyzTest\Zed\MessageBroker\SearchHttpCommunicationTester;
12
13
/**
14
 * Auto-generated group annotations
15
 *
16
 * @group PyzTest
17
 * @group Zed
18
 * @group MessageBroker
19
 * @group MessageHandlers
20
 * @group SearchHttp
21
 * @group Communication
22
 * @group SearchEndpointMessageTest
23
 * Add your own group annotations below this line
24
 */
25
class SearchEndpointMessageTest extends Unit
26
{
27
    /**
28
     * @var \PyzTest\Zed\MessageBroker\SearchHttpCommunicationTester
29
     */
30
    protected SearchHttpCommunicationTester $tester;
31
32
    /**
33
     * @return void
34
     */
35
    public function testSearchEndpointAvailableMessageIsSuccessfullyHandled(): void
36
    {
37
        // Arrange
38
        $storeTransfer = $this->tester->getAllowedStore();
39
        $this->tester->removeHttpConfigForStore($storeTransfer);
40
        $searchEndpointAvailableTransfer = $this->tester->buildSearchEndpointAvailableTransfer();
41
42
        // Act
43
        $this->tester->handleSearchMessage($searchEndpointAvailableTransfer);
44
45
        // Assert
46
        $this->tester->assertSearchHttpConfigExistsForStore($storeTransfer);
47
    }
48
49
    /**
50
     * @return void
51
     */
52
    public function testSearchEndpointRemovedMessageIsSuccessfullyHandled(): void
53
    {
54
        // Arrange
55
        $storeTransfer = $this->tester->getAllowedStore();
56
57
        $this->tester->removeHttpConfigForStore($storeTransfer);
58
        $this->tester->handleSearchMessage(
59
            $this->tester->buildSearchEndpointAvailableTransfer(),
60
        );
61
62
        $searchEndpointRemovedTransfer = $this->tester->buildSearchEndpointRemovedTransfer();
63
64
        // Act
65
        $this->tester->handleSearchMessage($searchEndpointRemovedTransfer);
66
67
        // Assert
68
        $this->tester->assertSearchHttpConfigIsRemovedForStore($storeTransfer);
69
    }
70
}
71