Passed
Push — main ( 3c3fe2...9e797e )
by Gabriel
02:44
created

test_isValidNotification()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 9
rs 10
1
<?php
2
3
namespace ByTIC\Omnipay\PlatiOnline\Tests\Message;
4
5
use ByTIC\Omnipay\PlatiOnline\Message\ServerCompletePurchaseRequest;
6
use ByTIC\Omnipay\PlatiOnline\Message\ServerCompletePurchaseResponse;
7
use Symfony\Component\HttpFoundation\Request as HttpRequest;
8
9
/**
10
 * Class CompletePurchaseRequestTest
11
 * @package ByTIC\Omnipay\PlatiOnline\Tests\Message
12
 */
13
class ServerCompletePurchaseRequestTest extends AbstractRequestTest
14
{
15
    public function test_isValidNotification()
16
    {
17
        $httpRequest = HttpRequest::createFromGlobals();
18
        $httpRequest->request->add(require TEST_FIXTURE_PATH . '/requests/ServerCompletePurchase/authorised.php');
19
20
        /** @var ServerCompletePurchaseRequest $request */
21
        $request = $this->newRequestWithInitTest(ServerCompletePurchaseRequest::class, [], $httpRequest);
22
23
        self::assertTrue($request->isValidNotification());
24
    }
25
26
    public function test_send()
27
    {
28
        $httpRequest = HttpRequest::createFromGlobals();
29
        $httpRequest->request->add(require TEST_FIXTURE_PATH . '/requests/ServerCompletePurchase/authorised.php');
30
        $data = require TEST_FIXTURE_PATH . '/enviromentParams.php';
31
32
        /** @var ServerCompletePurchaseRequest $request */
33
        $request = $this->newRequestWithInitTest(ServerCompletePurchaseRequest::class, $data, $httpRequest);
34
        $response = $request->send();
35
36
        self::assertInstanceOf(ServerCompletePurchaseResponse::class, $response);
37
38
        self::assertFalse($response->isSuccessful());
39
        self::assertFalse($response->isPending());
40
        self::assertFalse($response->isCancelled());
41
42
        self::assertSame('6917422', $response->getTransactionReference());
43
        self::assertSame('172315', $response->getTransactionId());
44
    }
45
}