Skip to content

Commit 7e28ba3

Browse files
committed
added phpspec test for status action
1 parent 72d5e10 commit 7e28ba3

File tree

2 files changed

+48
-2
lines changed

2 files changed

+48
-2
lines changed

phpspec.yml.dist

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
suites:
22
main:
3-
namespace: Acme\SyliusExamplePlugin
4-
psr4_prefix: Acme\SyliusExamplePlugin
3+
namespace: Locastic\SyliusHTPayWayPlugin
4+
psr4_prefix: Locastic\SyliusHTPayWayPlugin

spec/Action/StatusActionSpec.php

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?php
2+
3+
namespace spec\Locastic\SyliusHTPayWayPlugin\Action;
4+
5+
use Locastic\SyliusHTPayWayPlugin\Action\StatusAction;
6+
use Payum\Core\Action\ActionInterface;
7+
use Payum\Core\ApiAwareInterface;
8+
use Payum\Core\Request\GetStatusInterface;
9+
use PhpSpec\ObjectBehavior;
10+
11+
class StatusActionSpec extends ObjectBehavior
12+
{
13+
function it_is_initializable()
14+
{
15+
$this->shouldHaveType(StatusAction::class);
16+
}
17+
18+
function it_implements_action_interface(): void
19+
{
20+
$this->shouldHaveType(ActionInterface::class);
21+
}
22+
23+
function it_implements_api_aware_interface(): void
24+
{
25+
$this->shouldHaveType(ApiAwareInterface::class);
26+
}
27+
28+
function it_executes(
29+
GetStatusInterface $request,
30+
\ArrayAccess $arrayAccess
31+
): void {
32+
$request->getModel()->willReturn($arrayAccess);
33+
34+
$request->markNew()->shouldBeCalled();
35+
36+
$this->execute($request);
37+
}
38+
39+
function it_supports_only_get_status_request_and_array_access(
40+
GetStatusInterface $request,
41+
\ArrayAccess $arrayAccess
42+
): void {
43+
$request->getModel()->willReturn($arrayAccess);
44+
$this->supports($request)->shouldReturn(true);
45+
}
46+
}

0 commit comments

Comments
 (0)