Passed
Pull Request — master (#17)
by Stanislav
10:22
created

FirstDataFacadeRefundTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 22
dl 0
loc 42
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A testExecuteRefundOmsCommandMustUpdateStatusAfterSuccessRequest() 0 29 1
1
<?php
2
3
/**
4
 * MIT License
5
 * For full license information, please view the LICENSE file that was distributed with this source code.
6
 */
7
8
namespace SprykerEcoTest\Zed\FirstData\Business;
9
10
use Generated\Shared\Transfer\FirstDataOmsCommandRequestTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...sCommandRequestTransfer 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...
11
use Generated\Shared\Transfer\OrderTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfer\OrderTransfer 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...
12
13
/**
14
 * Auto-generated group annotations
15
 *
16
 * @group SprykerEcoTest
17
 * @group Zed
18
 * @group FirstData
19
 * @group Business
20
 * @group Facade
21
 * @group FirstDataFacadeRefundTest
22
 */
23
class FirstDataFacadeRefundTest extends AbstractFirstDataFacadeTest
24
{
25
    protected const TEST_APPROVED_STATUS = 'TEST_APPROVED_STATUS';
26
    protected const OMS_STATUS_REFUNDED = 'refunded';
27
28
    /**
29
     * @var \SprykerEcoTest\Zed\FirstData\FirstDataBusinessTester
30
     */
31
    protected $tester;
32
33
    /**
34
     * @return void
35
     */
36
    public function testExecuteRefundOmsCommandMustUpdateStatusAfterSuccessRequest(): void
37
    {
38
        //Arrange
39
        $clientResponse = $this->tester->getClientResponse();
40
        $salesOrderEntity = $this->tester->createTestSalesOrderEntity();
41
        $salesOrderItemEntity = $this->tester->createTestSalesOrderItemEntity($salesOrderEntity);
42
        $paymentFirstDataEntity = $this->tester->createTestPaymentFirstDataEntity($salesOrderEntity);
43
        $paymentFirstDataItemEntity = $this->tester->createTestPaymentFirstDataItemEntity(
44
            $paymentFirstDataEntity,
45
            $salesOrderItemEntity,
46
            static::TEST_APPROVED_STATUS
47
        );
48
49
        $firstDataOmsCommandRequestTransfer = (new FirstDataOmsCommandRequestTransfer())
50
            ->setSalesOrderItemIds([$salesOrderItemEntity->getIdSalesOrderItem()])
51
            ->setOrder(
52
                (new OrderTransfer())->fromArray($salesOrderEntity->toArray(), true)
53
            );
54
55
        //Act
56
        $this->tester
57
            ->getFirstDataFacade($this->getFirstDataBusinessFactoryMock($clientResponse))
58
            ->executeRefundOmsCommand($firstDataOmsCommandRequestTransfer);
59
60
        $paymentFirstDataItemEntityAfterRefund = $this->tester
61
            ->findTestPaymentFirstDataItemEntityById($paymentFirstDataItemEntity->getIdPaymentFirstDataItem());
62
63
        //Assert
64
        $this->assertSame(static::OMS_STATUS_REFUNDED, $paymentFirstDataItemEntityAfterRefund->getStatus());
65
    }
66
}
67