-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathNotifyActionTest.php
52 lines (42 loc) · 1.3 KB
/
NotifyActionTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
declare(strict_types=1);
namespace Ekyna\Component\Payum\Payzen\Tests\Action;
use Ekyna\Component\Payum\Payzen\Action\NotifyAction;
use Payum\Core\Bridge\Spl\ArrayObject;
use Payum\Core\Request\Notify;
use Payum\Core\Request\Sync;
use PHPUnit\Framework\Constraint\IsInstanceOf;
/**
* Class NotifyActionTest
* @package Ekyna\Component\Payum\Payzen\Tests\Action
* @author Étienne Dauvergne <contact@ekyna.com>
*/
class NotifyActionTest extends AbstractActionTest
{
protected $requestClass = Notify::class;
protected $actionClass = NotifyAction::class;
/**
* @test
*/
public function should_execute_sync_request_with_model_details(): void
{
$assert = function(Sync $request) {
$expected = new ArrayObject([
'vads_amount' => '1234',
]);
$this->assertEquals($expected, $request->getModel());
};
$gateway = $this->createGatewayMock();
$gateway
->expects(self::at(0))
->method('execute')
->with(new IsInstanceOf(Sync::class))
->willReturnCallback($assert);
$action = new NotifyAction();
$action->setGateway($gateway);
$request = new Notify([
'vads_amount' => '1234',
]);
$action->execute($request);
}
}