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

PaymentStateMachineTransitionApplicatorSpec   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
dl 0
loc 18
c 0
b 0
f 0
wmc 2
lcom 0
cbo 3
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A let() 0 4 1
A it_completes_payment() 0 10 1
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