Passed
Push — master ( e65429...cce4b8 )
by Aimeos
03:27
created

StandardTest::testBodyMShopException()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 8
nc 1
nop 0
dl 0
loc 13
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
5
 * @copyright Aimeos (aimeos.org), 2021-2022
6
 */
7
8
9
namespace Aimeos\Client\Html\Cms\Page;
10
11
12
class StandardTest extends \PHPUnit\Framework\TestCase
0 ignored issues
show
Bug introduced by
The type PHPUnit\Framework\TestCase was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
13
{
14
	private $object;
15
	private $context;
16
	private $view;
17
18
19
	protected function setUp() : void
20
	{
21
		$this->view = \TestHelperHtml::view();
22
		$this->context = \TestHelperHtml::context();
23
		$this->context->locale()->setLanguageId( 'en' );
24
25
		$this->object = new \Aimeos\Client\Html\Cms\Page\Standard( $this->context );
26
		$this->object->setView( $this->view );
27
	}
28
29
30
	protected function tearDown() : void
31
	{
32
		unset( $this->object, $this->context, $this->view );
33
	}
34
35
36
	public function testHeader()
37
	{
38
		$tags = [];
39
		$expire = null;
40
		$view = $this->view;
41
42
		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $view, ['path' => 'contact'] );
43
		$view->addHelper( 'param', $helper );
44
45
		$this->object->setView( $this->object->data( $view, $tags, $expire ) );
46
		$output = $this->object->header();
47
48
		$this->assertStringContainsString( '<title>Contact page | Aimeos</title>', $output );
49
		$this->assertEquals( null, $expire );
50
		$this->assertEquals( 2, count( $tags ) );
51
	}
52
53
54
	public function testBody()
55
	{
56
		$tags = [];
57
		$expire = null;
58
		$view = $this->view;
59
60
		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $view, ['path' => 'contact'] );
61
		$view->addHelper( 'param', $helper );
62
63
		$this->object->setView( $this->object->data( $view, $tags, $expire ) );
64
		$output = $this->object->body();
65
66
		$this->assertStringStartsWith( '<section class="aimeos cms-page', $output );
67
		$this->assertStringContainsString( '<h1>Hello!</h1>', $output );
68
69
		$this->assertEquals( null, $expire );
70
		$this->assertEquals( 2, count( $tags ) );
71
	}
72
73
74
	public function testGetSubClientInvalid()
75
	{
76
		$this->expectException( '\\Aimeos\\Client\\Html\\Exception' );
77
		$this->object->getSubClient( 'invalid', 'invalid' );
78
	}
79
80
81
	public function testGetSubClientInvalidName()
82
	{
83
		$this->expectException( '\\Aimeos\\Client\\Html\\Exception' );
84
		$this->object->getSubClient( '$$$', '$$$' );
85
	}
86
87
88
	public function testInit()
89
	{
90
		$this->object->init();
91
92
		$this->assertEmpty( $this->view->get( 'errors' ) );
93
	}
94
}
95