Completed
Push — master ( 7b4297...eec074 )
by Aimeos
03:02
created

StandardTest   A

Complexity

Total Complexity 12

Size/Duplication

Total Lines 114
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 12
c 1
b 0
f 0
lcom 1
cbo 5
dl 0
loc 114
rs 10

12 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 9 1
A tearDown() 0 4 1
A testCreate() 0 5 1
A testCopy() 0 5 1
A testDelete() 0 5 1
A testGet() 0 5 1
A testSave() 0 5 1
A testSearch() 0 6 1
A testSearchException() 0 14 1
A testSearchMShopException() 0 14 1
A testGetSubClient() 0 5 1
A getViewNoRender() 0 7 1
1
<?php
2
3
/**
4
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
5
 * @copyright Aimeos (aimeos.org), 2016
6
 */
7
8
9
namespace Aimeos\Admin\JQAdm\Dashboard\Order\Paymentstatus;
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()
20
	{
21
		$this->view = \TestHelperJqadm::getView();
22
		$this->context = \TestHelperJqadm::getContext();
23
		$templatePaths = \TestHelperJqadm::getTemplatePaths();
24
25
		$this->object = new \Aimeos\Admin\JQAdm\Dashboard\Order\Paymentstatus\Standard( $this->context, $templatePaths );
26
		$this->object->setView( $this->view );
27
	}
28
29
30
	protected function tearDown()
31
	{
32
		unset( $this->object );
33
	}
34
35
36
	public function testCreate()
37
	{
38
		$this->setExpectedException( '\Aimeos\Admin\JQAdm\Exception' );
1 ignored issue
show
Deprecated Code introduced by
The method PHPUnit_Framework_TestCase::setExpectedException() has been deprecated with message: Method deprecated since Release 5.2.0

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
39
		$this->object->create();
40
	}
41
42
43
	public function testCopy()
44
	{
45
		$this->setExpectedException( '\Aimeos\Admin\JQAdm\Exception' );
1 ignored issue
show
Deprecated Code introduced by
The method PHPUnit_Framework_TestCase::setExpectedException() has been deprecated with message: Method deprecated since Release 5.2.0

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
46
		$this->object->copy();
47
	}
48
49
50
	public function testDelete()
51
	{
52
		$this->setExpectedException( '\Aimeos\Admin\JQAdm\Exception' );
1 ignored issue
show
Deprecated Code introduced by
The method PHPUnit_Framework_TestCase::setExpectedException() has been deprecated with message: Method deprecated since Release 5.2.0

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
53
		$this->object->delete();
54
	}
55
56
57
	public function testGet()
58
	{
59
		$this->setExpectedException( '\Aimeos\Admin\JQAdm\Exception' );
1 ignored issue
show
Deprecated Code introduced by
The method PHPUnit_Framework_TestCase::setExpectedException() has been deprecated with message: Method deprecated since Release 5.2.0

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
60
		$this->object->get();
61
	}
62
63
64
	public function testSave()
65
	{
66
		$this->setExpectedException( '\Aimeos\Admin\JQAdm\Exception' );
1 ignored issue
show
Deprecated Code introduced by
The method PHPUnit_Framework_TestCase::setExpectedException() has been deprecated with message: Method deprecated since Release 5.2.0

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
67
		$this->object->save();
68
	}
69
70
71
	public function testSearch()
72
	{
73
		$result = $this->object->search();
74
75
		$this->assertContains( '<div class="order-paymentstatus', $result );
76
	}
77
78
79
	public function testSearchException()
80
	{
81
		$object = $this->getMockBuilder( '\Aimeos\Admin\JQAdm\Dashboard\Standard' )
82
			->setConstructorArgs( array( $this->context, \TestHelperJqadm::getTemplatePaths() ) )
83
			->setMethods( array( 'getSubClients' ) )
84
			->getMock();
85
86
		$object->expects( $this->once() )->method( 'getSubClients' )
87
			->will( $this->throwException( new \Exception() ) );
88
89
		$object->setView( $this->getViewNoRender() );
90
91
		$object->search();
92
	}
93
94
95
	public function testSearchMShopException()
96
	{
97
		$object = $this->getMockBuilder( '\Aimeos\Admin\JQAdm\Dashboard\Standard' )
98
			->setConstructorArgs( array( $this->context, \TestHelperJqadm::getTemplatePaths() ) )
99
			->setMethods( array( 'getSubClients' ) )
100
			->getMock();
101
102
		$object->expects( $this->once() )->method( 'getSubClients' )
103
			->will( $this->throwException( new \Aimeos\MShop\Exception() ) );
104
105
		$object->setView( $this->getViewNoRender() );
106
107
		$object->search();
108
	}
109
110
111
	public function testGetSubClient()
112
	{
113
		$this->setExpectedException( '\Aimeos\Admin\JQAdm\Exception' );
1 ignored issue
show
Deprecated Code introduced by
The method PHPUnit_Framework_TestCase::setExpectedException() has been deprecated with message: Method deprecated since Release 5.2.0

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
114
		$this->object->getSubClient( 'invalid' );
115
	}
116
117
118
	protected function getViewNoRender()
119
	{
120
		return $this->getMockBuilder( '\Aimeos\MW\View\Standard' )
121
			->setConstructorArgs( array( array() ) )
122
			->setMethods( array( 'render', 'config' ) )
123
			->getMock();
124
	}
125
}
126