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
|
|
|
namespace spec\Sylius\Component\Core\Factory; |
13
|
|
|
|
14
|
|
|
use Payum\Core\Model\GatewayConfigInterface; |
15
|
|
|
use PhpSpec\ObjectBehavior; |
16
|
|
|
use Sylius\Component\Core\Factory\PaymentMethodFactory; |
17
|
|
|
use Sylius\Component\Core\Factory\PaymentMethodFactoryInterface; |
18
|
|
|
use Sylius\Component\Core\Model\PaymentMethodInterface; |
19
|
|
|
use Sylius\Component\Resource\Factory\FactoryInterface; |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* @author Mateusz Zalewski <[email protected]> |
23
|
|
|
*/ |
24
|
|
|
final class PaymentMethodFactorySpec extends ObjectBehavior |
25
|
|
|
{ |
26
|
|
|
function let(FactoryInterface $decoratedFactory, FactoryInterface $gatewayConfigFactory) |
27
|
|
|
{ |
28
|
|
|
$this->beConstructedWith($decoratedFactory, $gatewayConfigFactory); |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
function it_is_initializable() |
32
|
|
|
{ |
33
|
|
|
$this->shouldHaveType(PaymentMethodFactory::class); |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
function it_implements_payment_method_factory_interface() |
37
|
|
|
{ |
38
|
|
|
$this->shouldImplement(PaymentMethodFactoryInterface::class); |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
function it_creates_payment_method_with_specific_gateway( |
42
|
|
|
FactoryInterface $decoratedFactory, |
43
|
|
|
FactoryInterface $gatewayConfigFactory, |
44
|
|
|
GatewayConfigInterface $gatewayConfig, |
45
|
|
|
PaymentMethodInterface $paymentMethod |
46
|
|
|
) { |
47
|
|
|
$gatewayConfigFactory->createNew()->willReturn($gatewayConfig); |
48
|
|
|
$gatewayConfig->setFactoryName('offline')->shouldBeCalled(); |
|
|
|
|
49
|
|
|
|
50
|
|
|
$decoratedFactory->createNew()->willReturn($paymentMethod); |
51
|
|
|
$paymentMethod->setGatewayConfig($gatewayConfig)->shouldBeCalled(); |
52
|
|
|
|
53
|
|
|
$this->createWithGateway('offline'); |
54
|
|
|
} |
55
|
|
|
} |
56
|
|
|
|
This method has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.