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

FirstDataFacadeCancelTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 20
dl 0
loc 49
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 5 1
A testExecuteCancelPreAuthOmsCommandSuccessCase() 0 20 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\FirstDataApiRequestTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...tDataApiRequestTransfer 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
12
/**
13
 * Auto-generated group annotations
14
 *
15
 * @group SprykerEcoTest
16
 * @group Zed
17
 * @group FirstData
18
 * @group Business
19
 * @group Facade
20
 * @group FirstDataFacadeCancelTest
21
 */
22
class FirstDataFacadeCancelTest extends AbstractFirstDataFacadeTest
23
{
24
    public const REQUEST_TYPE = 'VoidTransaction';
25
26
    public const TRANSACTION_TYPE = 'VOID';
27
28
    /**
29
     * @var \SprykerEcoTest\Zed\FirstData\FirstDataBusinessTester
30
     */
31
    protected $tester;
32
33
    /**
34
     * @var array
35
     */
36
    protected $clientResponse;
37
38
    /**
39
     * @return void
40
     */
41
    public function setUp(): void
42
    {
43
        parent::setUp();
44
45
        $this->clientResponse = $this->tester->getClientResponse();
46
    }
47
48
    /**
49
     * @return void
50
     */
51
    public function testExecuteCancelPreAuthOmsCommandSuccessCase(): void
52
    {
53
        //Arrange
54
        $clientResponse = $this->clientResponse;
55
        $clientResponse['transactionType'] = static::TRANSACTION_TYPE;
56
        $firstDataApiRequestTransfer = new FirstDataApiRequestTransfer();
57
        $firstDataApiRequestTransfer->setTransactionId($clientResponse['orderId']);
58
        $firstDataApiRequestTransfer->setRequestType(static::REQUEST_TYPE);
59
60
        //Act
61
        $response = $this->tester
62
            ->getFirstDataFacade($this->getFirstDataBusinessFactoryMock($clientResponse))
63
            ->executeCancelOmsCommand($firstDataApiRequestTransfer);
64
65
        //Assert
66
        $this->assertTrue($response->getIsSuccess());
67
        $this->assertNull($response->getError());
68
        $this->assertNotEmpty($response->getClientResponse());
69
        $this->assertEquals($firstDataApiRequestTransfer->getTransactionId(), $response->getClientResponse()->getOrderId());
70
        $this->assertEquals(static::TRANSACTION_TYPE, $response->getClientResponse()->getTransactionType());
71
    }
72
}
73