Passed
Push — master ( 6501cb...0fb630 )
by Aimeos
03:18
created

StandardTest::testProcess()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
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, 2014
6
 * @copyright Aimeos (aimeos.org), 2015-2018
7
 */
8
9
10
namespace Aimeos\Client\Html\Checkout\Confirm\Intro;
11
12
13
class StandardTest extends \PHPUnit\Framework\TestCase
14
{
15
	private $object;
16
	private $context;
17
18
19
	protected function setUp() : void
20
	{
21
		$this->context = \TestHelperHtml::getContext();
22
23
		$this->object = new \Aimeos\Client\Html\Checkout\Confirm\Intro\Standard( $this->context );
24
		$this->object->setView( \TestHelperHtml::getView() );
25
	}
26
27
28
	protected function tearDown() : void
29
	{
30
		unset( $this->object );
31
	}
32
33
34
	public function testGetBody()
35
	{
36
		$manager = \Aimeos\MShop\Order\Manager\Factory::create( $this->context );
37
38
		$search = $manager->createSearch();
39
		$search->setConditions( $search->compare( '==', 'order.base.service.code', 'paypalexpress' ) );
40
41
		$items = $manager->searchItems( $search );
42
		if( ( $item = reset( $items ) ) === false ) {
43
			throw new \RuntimeException( 'No item found' );
44
		}
45
46
47
		$view = \TestHelperHtml::getView();
48
		$view->confirmOrderItem = $item;
49
		$this->object->setView( $view );
50
51
		$output = $this->object->getBody();
52
		$this->assertStringStartsWith( '<div class="checkout-confirm-intro">', $output );
53
	}
54
55
56
	public function testGetSubClientInvalid()
57
	{
58
		$this->expectException( '\\Aimeos\\Client\\Html\\Exception' );
59
		$this->object->getSubClient( 'invalid', 'invalid' );
60
	}
61
62
63
	public function testGetSubClientInvalidName()
64
	{
65
		$this->expectException( '\\Aimeos\\Client\\Html\\Exception' );
66
		$this->object->getSubClient( '$$$', '$$$' );
67
	}
68
}
69