couldBeConstructedWithoutAnyArguments()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
dl 0
loc 4
rs 10
c 1
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
4
namespace PTS\Paysera\Tests\Action;
5
6
use Payum\Core\GatewayAwareInterface;
7
use Payum\Core\Request\GetHttpRequest;
8
use Payum\Core\Request\Notify;
9
use Payum\Core\Tests\GenericActionTest;
10
use PTS\Paysera\Action\NotifyAction;
11
use PTS\Paysera\Api;
12
13
class NotifyActionTest extends GenericActionTest
14
{
15
    protected $requestClass = 'Payum\Core\Request\Notify';
16
    protected $actionClass = NotifyAction::class;
17
18
    /**
19
     * @test
20
     */
21
    public function shouldBeSubClassOfGatewayAwareAction()
22
    {
23
        $rc = new \ReflectionClass(NotifyAction::class);
24
        $this->assertTrue($rc->isSubclassOf(GatewayAwareInterface::class));
25
    }
26
27
    /**
28
     * @test
29
     */
30
    public function shouldThrowExceptionWithWrongParams()
31
    {
32
        $this->expectException(\WebToPayException::class);
33
        $expectedModel = array('foo' => 'fooVal');
34
35
        $apiMock = $this->createMock(Api::class);
36
        $action = new NotifyAction();
37
        $gatewayMock = $this->createGatewayMock();
38
        $gatewayMock
39
            ->expects($this->once())
40
            ->method('execute')
41
            ->with($this->isInstanceOf(GetHttpRequest::class));
42
        $apiMock
43
            ->expects($this->once())
44
            ->method('doNotify');
45
46
        $action->setGateway($gatewayMock);
47
        $action->setApi($apiMock);
48
49
        $action->execute(new Notify($expectedModel));
50
    }
51
52
    /**
53
     * @test
54
     */
55
    public function couldBeConstructedWithoutAnyArguments()
56
    {
57
        $this->expectNotToPerformAssertions();
58
        new $this->actionClass();
59
    }
60
61
}