Completed
Push — api ( cecea0...116a36 )
by Kamil
29:57 queued 30s
created

it_completes_payment()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
c 0
b 0
f 0
rs 9.9332
cc 1
nc 1
nop 3
1
<?php
2
3
/*
4
 * This file is part of the Sylius package.
5
 *
6
 * (c) Paweł Jędrzejewski
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace spec\Sylius\Bundle\ApiBundle\Applicator;
15
16
use PhpSpec\ObjectBehavior;
17
use SM\Factory\FactoryInterface as StateMachineFactoryInterface;
18
use SM\StateMachine\StateMachine;
19
use Sylius\Component\Core\Model\PaymentInterface;
20
use Sylius\Component\Payment\PaymentTransitions;
21
22
final class PaymentStateMachineTransitionApplicatorSpec extends ObjectBehavior
23
{
24
    function let(StateMachineFactoryInterface $stateMachineFactory)
25
    {
26
        $this->beConstructedWith($stateMachineFactory);
27
    }
28
29
    function it_completes_payment(
30
        StateMachineFactoryInterface $stateMachineFactory,
31
        PaymentInterface $payment,
32
        StateMachine $stateMachine
33
    ): void {
34
        $stateMachineFactory->get($payment, PaymentTransitions::GRAPH)->willReturn($stateMachine);
35
        $stateMachine->apply(PaymentTransitions::TRANSITION_COMPLETE)->shouldBeCalled();
36
37
        $this->complete($payment);
38
    }
39
}
40