-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathSyncActionTest.php
53 lines (42 loc) · 1.31 KB
/
SyncActionTest.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
53
<?php
declare(strict_types=1);
namespace Ekyna\Component\Payum\Payzen\Tests\Action;
use Ekyna\Component\Payum\Payzen\Action\SyncAction;
use Ekyna\Component\Payum\Payzen\Request\Response;
use Payum\Core\Bridge\Spl\ArrayObject;
use Payum\Core\Request\Sync;
use PHPUnit\Framework\Constraint\IsInstanceOf;
/**
* Class SyncActionTest
* @package Ekyna\Component\Payum\Payzen\Tests\Action
* @author Étienne Dauvergne <contact@ekyna.com>
*/
class SyncActionTest extends AbstractActionTest
{
protected $requestClass = Sync::class;
protected $actionClass = SyncAction::class;
/**
* @test
*/
public function should_execute_response_with_model(): void
{
$assert = function(Response $request) {
$expected = new ArrayObject([
'vads_trans_id' => '001',
]);
$this->assertEquals($expected, $request->getModel());
};
$gateway = $this->createGatewayMock();
$gateway
->expects(self::at(0))
->method('execute')
->with(new IsInstanceOf(Response::class))
->willReturnCallback($assert);
$action = new SyncAction();
$action->setGateway($gateway);
$request = new Sync([
'vads_trans_id' => '001',
]);
$action->execute($request);
}
}