Passed
Push — master ( fd6974...da0ae9 )
by Aimeos
07:05 queued 04:07
created

StandardTest::setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 6
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 10
rs 10
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' );
0 ignored issues
show
Unused Code introduced by
The assignment to $manager is dead and can be removed.
Loading history...
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