PaymentAuthorizedMessageCest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 11
dl 0
loc 42
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A _before() 0 4 1
A testPaymentAuthorizedMessageIsSuccessfullyHandled() 0 14 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
declare(strict_types = 1);
9
10
namespace PyzTest\Zed\MessageBroker\MessageHandlers\Payment\Presentation;
11
12
use Generated\Shared\Transfer\PaymentAuthorizedTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...ymentAuthorizedTransfer was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
13
use PyzTest\Zed\MessageBroker\PaymentPresentationTester;
14
15
/**
16
 * Auto-generated group annotations
17
 *
18
 * @group PyzTest
19
 * @group Zed
20
 * @group MessageBroker
21
 * @group MessageHandlers
22
 * @group Payment
23
 * @group Presentation
24
 * @group PaymentAuthorizedMessageCest
25
 * Add your own group annotations below this line
26
 */
27
class PaymentAuthorizedMessageCest
28
{
29
    /**
30
     * @var string
31
     */
32
    protected const INITIAL_ITEM_STATE = 'payment pending';
33
34
    /**
35
     * @var string
36
     */
37
    public const FINAL_ITEM_STATE = 'payment authorized';
38
39
    /**
40
     * @param \PyzTest\Zed\MessageBroker\PaymentPresentationTester $i
41
     *
42
     * @return void
43
     */
44
    public function _before(PaymentPresentationTester $i): void
45
    {
46
        $i->amZed();
47
        $i->amLoggedInUser();
48
    }
49
50
    /**
51
     * @param \PyzTest\Zed\MessageBroker\PaymentPresentationTester $I
52
     *
53
     * @return void
54
     */
55
    public function testPaymentAuthorizedMessageIsSuccessfullyHandled(PaymentPresentationTester $I): void
56
    {
57
        // Arrange
58
        $salesOrderEntity = $I->haveSalesOrder(static::INITIAL_ITEM_STATE);
59
        $paymentAuthorizedTransfer = $I->havePaymentMessageTransfer(
60
            PaymentAuthorizedTransfer::class,
61
            $salesOrderEntity,
62
        );
63
64
        // Act
65
        $I->handlePaymentMessageTransfer($paymentAuthorizedTransfer);
66
67
        // Assert
68
        $I->assertOrderHasCorrectState($salesOrderEntity, static::FINAL_ITEM_STATE);
69
    }
70
}
71