|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* @license LGPLv3, http://opensource.org/licenses/LGPL-3.0 |
|
5
|
|
|
* @copyright Aimeos (aimeos.org), 2022 |
|
6
|
|
|
*/ |
|
7
|
|
|
|
|
8
|
|
|
|
|
9
|
|
|
namespace Aimeos\Client\Html\Account\Basket; |
|
10
|
|
|
|
|
11
|
|
|
|
|
12
|
|
|
class StandardTest extends \PHPUnit\Framework\TestCase |
|
13
|
|
|
{ |
|
14
|
|
|
private $object; |
|
15
|
|
|
private $context; |
|
16
|
|
|
private $view; |
|
17
|
|
|
|
|
18
|
|
|
|
|
19
|
|
|
protected function setUp() : void |
|
20
|
|
|
{ |
|
21
|
|
|
\Aimeos\Controller\Frontend::cache( true ); |
|
22
|
|
|
\Aimeos\MShop::cache( true ); |
|
23
|
|
|
|
|
24
|
|
|
$this->context = \TestHelper::context(); |
|
25
|
|
|
$this->view = \TestHelper::view(); |
|
26
|
|
|
|
|
27
|
|
|
$this->object = new \Aimeos\Client\Html\Account\Basket\Standard( $this->context ); |
|
28
|
|
|
$this->object->setView( $this->view ); |
|
29
|
|
|
} |
|
30
|
|
|
|
|
31
|
|
|
|
|
32
|
|
|
protected function tearDown() : void |
|
33
|
|
|
{ |
|
34
|
|
|
\Aimeos\Controller\Frontend::cache( false ); |
|
35
|
|
|
\Aimeos\MShop::cache( false ); |
|
36
|
|
|
|
|
37
|
|
|
unset( $this->object, $this->context, $this->view ); |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
|
|
41
|
|
|
public function testHeader() |
|
42
|
|
|
{ |
|
43
|
|
|
$output = $this->object->header(); |
|
44
|
|
|
|
|
45
|
|
|
$this->assertStringContainsString( '<link rel="stylesheet"', $output ); |
|
46
|
|
|
$this->assertStringContainsString( '<script defer', $output ); |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
|
|
50
|
|
|
public function testBody() |
|
51
|
|
|
{ |
|
52
|
|
|
$this->context->setUserId( -1 ); |
|
53
|
|
|
$manager = \Aimeos\MShop::create( $this->context, 'customer' ); |
|
|
|
|
|
|
54
|
|
|
|
|
55
|
|
|
$output = $this->object->body(); |
|
56
|
|
|
|
|
57
|
|
|
$this->assertStringContainsString( '<section class="aimeos account-basket', $output ); |
|
58
|
|
|
$this->assertRegExp( '#<div class="basket-item#', $output ); |
|
59
|
|
|
$this->assertRegExp( '#<h2 class="basket-basic.*<span class="value[^<]+</span>.*</h2>#smU', $output ); |
|
60
|
|
|
|
|
61
|
|
|
$this->assertStringContainsString( '<div class="account-basket-detail common-summary', $output ); |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
|
|
65
|
|
|
public function testInit() |
|
66
|
|
|
{ |
|
67
|
|
|
$this->view = \TestHelper::view(); |
|
68
|
|
|
$param = array( |
|
69
|
|
|
'sub_action' => 'delete', |
|
70
|
|
|
'sub_id' => 'abcd' |
|
71
|
|
|
); |
|
72
|
|
|
|
|
73
|
|
|
$helper = new \Aimeos\Base\View\Helper\Param\Standard( $this->view, $param ); |
|
74
|
|
|
$this->view->addHelper( 'param', $helper ); |
|
75
|
|
|
|
|
76
|
|
|
$this->object->setView( $this->object->data( $this->view ) ); |
|
77
|
|
|
|
|
78
|
|
|
$this->object->init(); |
|
79
|
|
|
} |
|
80
|
|
|
} |
|
81
|
|
|
|