|
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\Product\Communication; |
|
9
|
|
|
|
|
10
|
|
|
use Codeception\Test\Unit; |
|
11
|
|
|
use Generated\Shared\Transfer\EventEntityTransfer; |
|
|
|
|
|
|
12
|
|
|
use Generated\Shared\Transfer\InitializeProductExportTransfer; |
|
|
|
|
|
|
13
|
|
|
use PyzTest\Zed\MessageBroker\ProductCommunicationTester; |
|
14
|
|
|
use Spryker\Zed\Product\Business\ProductBusinessFactory; |
|
15
|
|
|
use Spryker\Zed\Product\Dependency\Facade\ProductToEventInterface; |
|
16
|
|
|
use Spryker\Zed\Product\Dependency\ProductEvents; |
|
17
|
|
|
use Spryker\Zed\Product\ProductDependencyProvider; |
|
18
|
|
|
|
|
19
|
|
|
/** |
|
20
|
|
|
* Auto-generated group annotations |
|
21
|
|
|
* |
|
22
|
|
|
* @group PyzTest |
|
23
|
|
|
* @group Zed |
|
24
|
|
|
* @group MessageBroker |
|
25
|
|
|
* @group MessageHandlers |
|
26
|
|
|
* @group Product |
|
27
|
|
|
* @group Communication |
|
28
|
|
|
* @group InitializeProductExportMessageTest |
|
29
|
|
|
* Add your own group annotations below this line |
|
30
|
|
|
*/ |
|
31
|
|
|
class InitializeProductExportMessageTest extends Unit |
|
32
|
|
|
{ |
|
33
|
|
|
/** |
|
34
|
|
|
* @var \PyzTest\Zed\MessageBroker\ProductCommunicationTester |
|
35
|
|
|
*/ |
|
36
|
|
|
protected ProductCommunicationTester $tester; |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* @return void |
|
40
|
|
|
*/ |
|
41
|
|
|
public function testInitializeProductExportMessageIsSuccessfullyHandled(): void |
|
42
|
|
|
{ |
|
43
|
|
|
// Arrange |
|
44
|
|
|
$eventFacadeMock = $this->createMock(ProductToEventInterface::class); |
|
45
|
|
|
$this->tester->setDependency( |
|
46
|
|
|
ProductDependencyProvider::FACADE_EVENT, |
|
47
|
|
|
$eventFacadeMock, |
|
48
|
|
|
ProductBusinessFactory::class, |
|
49
|
|
|
); |
|
50
|
|
|
$this->tester->haveFullProduct(); |
|
51
|
|
|
$channelName = 'product-commands'; |
|
52
|
|
|
|
|
53
|
|
|
// Assert |
|
54
|
|
|
$eventFacadeMock->expects($this->atLeastOnce())->method('triggerBulk')->with( |
|
55
|
|
|
$this->identicalTo(ProductEvents::PRODUCT_CONCRETE_EXPORT), |
|
56
|
|
|
$this->callback(function (array $transfers) { |
|
57
|
|
|
$this->assertIsArray($transfers); |
|
58
|
|
|
$this->assertGreaterThanOrEqual(1, count($transfers)); |
|
59
|
|
|
$this->assertInstanceOf(EventEntityTransfer::class, $transfers[0]); |
|
60
|
|
|
|
|
61
|
|
|
return true; |
|
62
|
|
|
}), |
|
63
|
|
|
); |
|
64
|
|
|
|
|
65
|
|
|
// Act |
|
66
|
|
|
$this->tester->setupMessageBroker(InitializeProductExportTransfer::class, $channelName); |
|
67
|
|
|
$messageBrokerFacade = $this->tester->getLocator()->messageBroker()->facade(); |
|
68
|
|
|
$messageBrokerFacade->sendMessage( |
|
69
|
|
|
$this->tester->buildInitializeProductExportTransfer(), |
|
70
|
|
|
); |
|
71
|
|
|
$messageBrokerFacade->startWorker( |
|
72
|
|
|
$this->tester->buildMessageBrokerWorkerConfigTransfer([$channelName], 1), |
|
73
|
|
|
); |
|
74
|
|
|
} |
|
75
|
|
|
} |
|
76
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths