-
Notifications
You must be signed in to change notification settings - Fork 111
/
BaseTest.php
106 lines (71 loc) · 2.47 KB
/
BaseTest.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
<?php
/**
* @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
* @copyright Aimeos (aimeos.org), 2015-2017
*/
namespace Aimeos\MShop\Service\Provider\Payment;
class BaseTest extends \PHPUnit\Framework\TestCase
{
private $object;
private $context;
protected function setUp()
{
$this->context = \TestHelperMShop::getContext();
$servManager = \Aimeos\MShop\Service\Manager\Factory::createManager( $this->context );
$search = $servManager->createSearch();
$search->setConditions($search->compare('==', 'service.provider', 'Standard'));
$result = $servManager->searchItems($search, array('price'));
if( ( $item = reset( $result ) ) === false ) {
throw new \RuntimeException( 'No order base item found' );
}
$this->object = new TestBase( $this->context, $item );
}
protected function tearDown()
{
unset( $this->object );
}
public function testCheckConfigBE()
{
$result = $this->object->checkConfigBE( array( 'payment.url-success' => true ) );
$this->assertEquals( 0, count( $result ) );
}
public function testGetConfigBE()
{
$result = $this->object->getConfigBE();
$this->assertEquals( 0, count( $result ) );
$this->assertInternalType( 'array', $result );
}
public function testCancel()
{
$item = \Aimeos\MShop\Order\Manager\Factory::createManager( $this->context )->createItem();
$this->setExpectedException( '\\Aimeos\\MShop\\Service\\Exception' );
$this->object->cancel( $item );
}
public function testCapture()
{
$item = \Aimeos\MShop\Order\Manager\Factory::createManager( $this->context )->createItem();
$this->setExpectedException( '\\Aimeos\\MShop\\Service\\Exception' );
$this->object->capture( $item );
}
public function testProcess()
{
$item = \Aimeos\MShop\Order\Manager\Factory::createManager( $this->context )->createItem();
$result = $this->object->process( $item, [] );
$this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Item\\Helper\\Form\\Iface', $result );
}
public function testRefund()
{
$item = \Aimeos\MShop\Order\Manager\Factory::createManager( $this->context )->createItem();
$this->setExpectedException( '\\Aimeos\\MShop\\Service\\Exception' );
$this->object->refund( $item );
}
public function testSetConfigFE()
{
$item = \Aimeos\MShop\Order\Manager\Factory::createManager( $this->context )
->getSubManager( 'base' )->getSubManager( 'service' )->createItem();
$this->object->setConfigFE( $item, [] );
}
}
class TestBase extends \Aimeos\MShop\Service\Provider\Payment\Base
{
}