Passed
Push — master ( fd781a...b1eaa4 )
by Aimeos
08:26
created

StandardTest::testBodyHtmlException()   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 Metaways Infosystems GmbH, 2013
6
 * @copyright Aimeos (aimeos.org), 2015-2022
7
 */
8
9
10
namespace Aimeos\Client\Html\Account\History;
11
12
13
class StandardTest extends \PHPUnit\Framework\TestCase
14
{
15
	private $object;
16
	private $context;
17
	private $view;
18
19
20
	protected function setUp() : void
21
	{
22
		$this->context = \TestHelperHtml::context();
23
		$this->view = \TestHelperHtml::view();
24
25
		$this->object = new \Aimeos\Client\Html\Account\History\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
		$output = $this->object->header();
39
		$this->assertNotNull( $output );
40
	}
41
42
43
	public function testBody()
44
	{
45
		$manager = \Aimeos\MShop\Customer\Manager\Factory::create( $this->context );
46
		$this->context->setUserId( $manager->find( '[email protected]' )->getId() );
47
48
		$output = $this->object->body();
49
50
		$this->assertStringStartsWith( '<section class="aimeos account-history"', $output );
51
52
		$this->assertStringContainsString( '<div id="account-history" class="account-history-list', $output );
53
54
		$this->assertRegExp( '#<div class="history-item#', $output );
55
		$this->assertRegExp( '#<h2 class="order-basic.*<span class="value[^<]+</span>.*</h2>#smU', $output );
56
		$this->assertRegExp( '#<div class="order-channel.*<span class="value[^<]+</span>.*</div>#smU', $output );
57
		$this->assertRegExp( '#<div class="order-payment.*<span class="value[^<]+</span>.*</div>#smU', $output );
58
		$this->assertRegExp( '#<div class="order-delivery.*<span class="value.*</span>.*</div>#smU', $output );
59
60
		$this->assertStringContainsString( '<div class="account-history-detail common-summary', $output );
61
62
		$this->assertStringContainsString( 'Our Unittest', $output );
63
		$this->assertStringContainsString( 'Example company', $output );
64
65
		$this->assertStringContainsString( '<h4>unitdeliverycode</h4>', $output );
66
		$this->assertStringContainsString( '<h4>unitpaymentcode</h4>', $output );
67
68
		$this->assertStringContainsString( '>1234<', $output );
69
		$this->assertStringContainsString( 'This is a comment', $output );
70
71
		$this->assertStringContainsString( 'Cafe Noire Expresso', $output );
72
		$this->assertStringContainsString( 'Cafe Noire Cappuccino', $output );
73
		$this->assertStringContainsString( 'Unittest: Monetary rebate', $output );
74
		$this->assertRegExp( '#<div class="price.+55.00 EUR</div>#', $output );
75
		$this->assertRegExp( '#<div class="quantity.+14 articles</div>#', $output );
76
	}
77
}
78