Passed
Push — master ( 283bfd...df9032 )
by Aimeos
04:29
created

StandardTest::testHeaderException()   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
namespace Aimeos\Client\Html\Catalog\Stock;
4
5
6
/**
7
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
8
 * @copyright Aimeos (aimeos.org), 2015-2022
9
 */
10
class StandardTest extends \PHPUnit\Framework\TestCase
11
{
12
	private $object;
13
	private $context;
14
	private $view;
15
16
17
	protected function setUp() : void
18
	{
19
		$this->view = \TestHelperHtml::view();
20
		$this->context = \TestHelperHtml::context();
21
22
		$this->object = new \Aimeos\Client\Html\Catalog\Stock\Standard( $this->context );
23
		$this->object->setView( $this->view );
24
	}
25
26
27
	protected function tearDown() : void
28
	{
29
		unset( $this->object, $this->context, $this->view );
30
	}
31
32
33
	public function testHeader()
34
	{
35
		$output = $this->object->header();
36
		$this->assertNotNull( $output );
37
	}
38
39
40
	public function testBody()
41
	{
42
		$prodid = \Aimeos\MShop::create( $this->context, 'product' )->find( 'CNC' )->getId();
43
44
		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, array( 'st_pid' => $prodid ) );
45
		$this->view->addHelper( 'param', $helper );
46
47
		$output = $this->object->body();
48
		$this->assertRegExp( '/"' . $prodid . '".*stock-high/', $output );
49
	}
50
}
51