StandardTest   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 21
dl 0
loc 51
rs 10
c 0
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A tearDown() 0 6 1
A testHeader() 0 6 1
A testGetSubClient() 0 4 1
A testBody() 0 6 1
A setUp() 0 10 1
1
<?php
2
3
/**
4
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
5
 * @copyright Aimeos (aimeos.org), 2015-2025
6
 */
7
8
9
namespace Aimeos\Client\Html\Catalog\Session;
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->view = \TestHelper::view();
25
		$this->context = \TestHelper::context();
26
27
		$this->object = new \Aimeos\Client\Html\Catalog\Session\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->object->setView( $this->object->data( $this->view ) );
53
		$output = $this->object->body();
54
55
		$this->assertStringStartsWith( '<div class="section aimeos catalog-session"', $output );
56
	}
57
58
59
	public function testGetSubClient()
60
	{
61
		$client = $this->object->getSubClient( 'seen', 'Standard' );
62
		$this->assertInstanceOf( '\\Aimeos\\Client\\HTML\\Iface', $client );
63
	}
64
}
65