|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* @license LGPLv3, http://opensource.org/licenses/LGPL-3.0 |
|
5
|
|
|
* @copyright Metaways Infosystems GmbH, 2014 |
|
6
|
|
|
* @copyright Aimeos (aimeos.org), 2015-2018 |
|
7
|
|
|
*/ |
|
8
|
|
|
|
|
9
|
|
|
|
|
10
|
|
|
namespace Aimeos\Client\Html\Checkout\Confirm\Intro; |
|
11
|
|
|
|
|
12
|
|
|
|
|
13
|
|
|
class StandardTest extends \PHPUnit\Framework\TestCase |
|
14
|
|
|
{ |
|
15
|
|
|
private $object; |
|
16
|
|
|
private $context; |
|
17
|
|
|
|
|
18
|
|
|
|
|
19
|
|
|
protected function setUp() : void |
|
20
|
|
|
{ |
|
21
|
|
|
$this->context = \TestHelperHtml::getContext(); |
|
22
|
|
|
|
|
23
|
|
|
$this->object = new \Aimeos\Client\Html\Checkout\Confirm\Intro\Standard( $this->context ); |
|
24
|
|
|
$this->object->setView( \TestHelperHtml::getView() ); |
|
25
|
|
|
} |
|
26
|
|
|
|
|
27
|
|
|
|
|
28
|
|
|
protected function tearDown() : void |
|
29
|
|
|
{ |
|
30
|
|
|
unset( $this->object ); |
|
31
|
|
|
} |
|
32
|
|
|
|
|
33
|
|
|
|
|
34
|
|
|
public function testGetBody() |
|
35
|
|
|
{ |
|
36
|
|
|
$manager = \Aimeos\MShop\Order\Manager\Factory::create( $this->context ); |
|
37
|
|
|
|
|
38
|
|
|
$search = $manager->createSearch(); |
|
39
|
|
|
$search->setConditions( $search->compare( '==', 'order.base.service.code', 'paypalexpress' ) ); |
|
40
|
|
|
|
|
41
|
|
|
$items = $manager->searchItems( $search ); |
|
42
|
|
|
if( ( $item = reset( $items ) ) === false ) { |
|
43
|
|
|
throw new \RuntimeException( 'No item found' ); |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
|
|
|
|
47
|
|
|
$view = \TestHelperHtml::getView(); |
|
48
|
|
|
$view->confirmOrderItem = $item; |
|
49
|
|
|
$this->object->setView( $view ); |
|
50
|
|
|
|
|
51
|
|
|
$output = $this->object->getBody(); |
|
52
|
|
|
$this->assertStringStartsWith( '<div class="checkout-confirm-intro">', $output ); |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
|
|
56
|
|
|
public function testGetSubClientInvalid() |
|
57
|
|
|
{ |
|
58
|
|
|
$this->expectException( '\\Aimeos\\Client\\Html\\Exception' ); |
|
59
|
|
|
$this->object->getSubClient( 'invalid', 'invalid' ); |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
|
|
63
|
|
|
public function testGetSubClientInvalidName() |
|
64
|
|
|
{ |
|
65
|
|
|
$this->expectException( '\\Aimeos\\Client\\Html\\Exception' ); |
|
66
|
|
|
$this->object->getSubClient( '$$$', '$$$' ); |
|
67
|
|
|
} |
|
68
|
|
|
} |
|
69
|
|
|
|