Completed
Push — master ( 501177...b6b6ac )
by Aimeos
03:43
created

StandardTest::testCopy()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 5
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 9
rs 10
1
<?php
2
3
/**
4
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
5
 * @copyright Aimeos (aimeos.org), 2020
6
 */
7
8
9
namespace Aimeos\Admin\JQAdm\Product\Order;
10
11
12
class StandardTest extends \PHPUnit\Framework\TestCase
13
{
14
	private $context;
15
	private $object;
16
	private $view;
17
18
19
	protected function setUp() : void
20
	{
21
		$this->view = \TestHelperJqadm::getView();
22
		$this->context = \TestHelperJqadm::getContext();
23
24
		$this->object = new \Aimeos\Admin\JQAdm\Product\Order\Standard( $this->context );
25
		$this->object = new \Aimeos\Admin\JQAdm\Common\Decorator\Page( $this->object, $this->context );
26
		$this->object->setAimeos( \TestHelperJqadm::getAimeos() );
27
		$this->object->setView( $this->view );
28
	}
29
30
31
	protected function tearDown() : void
32
	{
33
		unset( $this->object, $this->view, $this->context );
34
	}
35
36
37
	public function testCreate()
38
	{
39
		$manager = \Aimeos\MShop::create( $this->context, 'product' );
40
41
		$this->view->item = $manager->createItem();
42
		$result = $this->object->create();
43
44
		$this->assertEmpty( $this->view->get( 'errors' ) );
45
		$this->assertStringContainsString( 'item-order', $result );
46
	}
47
48
49
	public function testCopy()
50
	{
51
		$manager = \Aimeos\MShop::create( $this->context, 'product' );
52
53
		$this->view->item = $manager->findItem( 'CNC' );
54
		$result = $this->object->copy();
55
56
		$this->assertEmpty( $this->view->get( 'errors' ) );
57
		$this->assertStringContainsString( 'item-order', $result );
58
	}
59
60
61
	public function testGet()
62
	{
63
		$manager = \Aimeos\MShop::create( $this->context, 'product' );
64
65
		$this->view->item = $manager->findItem( 'CNC' );
66
		$result = $this->object->get();
67
68
		$this->assertEmpty( $this->view->get( 'errors' ) );
69
		$this->assertStringContainsString( 'item-order', $result );
70
	}
71
72
73
	public function testGetSubClient()
74
	{
75
		$this->expectException( \Aimeos\Admin\JQAdm\Exception::class );
76
		$this->object->getSubClient( 'unknown' );
77
	}
78
}
79