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\Common\Decorator; |
10
|
|
|
|
11
|
|
|
|
12
|
|
|
class BaseTest extends \PHPUnit_Framework_TestCase |
13
|
|
|
{ |
14
|
|
|
private $object; |
15
|
|
|
private $mock; |
16
|
|
|
|
17
|
|
|
|
18
|
|
|
protected function setUp() |
19
|
|
|
{ |
20
|
|
|
$this->mock = $this->getMockBuilder( 'Aimeos\Admin\JQAdm\Product\Standard' ) |
21
|
|
|
->setMethods( array( 'copy', 'create', 'delete', 'get', 'save', 'search', 'getSubClient' ) ) |
22
|
|
|
->disableOriginalConstructor() |
23
|
|
|
->getMock(); |
24
|
|
|
|
25
|
|
|
$templatePaths = \TestHelperJqadm::getTemplatePaths(); |
26
|
|
|
$context = \TestHelperJqadm::getContext(); |
27
|
|
|
|
28
|
|
|
$this->object = new \Aimeos\Admin\JQAdm\Common\Decorator\Page( $this->mock, $context, $templatePaths ); |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
|
32
|
|
|
protected function tearDown() |
33
|
|
|
{ |
34
|
|
|
unset( $this->object, $this->mock ); |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
|
38
|
|
|
public function testCallInvalid() |
39
|
|
|
{ |
40
|
|
|
$this->setExpectedException( '\Aimeos\Admin\JQAdm\Exception' ); |
|
|
|
|
41
|
|
|
$this->object->invalidMethod(); |
|
|
|
|
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
|
45
|
|
|
public function testCopy() |
46
|
|
|
{ |
47
|
|
|
$this->mock->expects( $this->once() )->method( 'copy' )->will( $this->returnValue( 'test' ) ); |
48
|
|
|
|
49
|
|
|
$this->assertEquals( 'test', $this->object->copy() ); |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
|
53
|
|
|
public function testCreate() |
54
|
|
|
{ |
55
|
|
|
$this->mock->expects( $this->once() )->method( 'create' )->will( $this->returnValue( 'test' ) ); |
56
|
|
|
|
57
|
|
|
$this->assertEquals( 'test', $this->object->create() ); |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
|
61
|
|
|
public function testDelete() |
62
|
|
|
{ |
63
|
|
|
$this->mock->expects( $this->once() )->method( 'delete' )->will( $this->returnValue( 'test' ) ); |
64
|
|
|
|
65
|
|
|
$this->assertEquals( 'test', $this->object->delete() ); |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
|
69
|
|
|
public function testGet() |
70
|
|
|
{ |
71
|
|
|
$this->mock->expects( $this->once() )->method( 'get' )->will( $this->returnValue( 'test' ) ); |
72
|
|
|
|
73
|
|
|
$this->assertEquals( 'test', $this->object->get() ); |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
|
77
|
|
|
public function testSave() |
78
|
|
|
{ |
79
|
|
|
$this->mock->expects( $this->once() )->method( 'save' )->will( $this->returnValue( 'test' ) ); |
80
|
|
|
|
81
|
|
|
$this->assertEquals( 'test', $this->object->save() ); |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
|
85
|
|
|
public function testSearch() |
86
|
|
|
{ |
87
|
|
|
$this->mock->expects( $this->once() )->method( 'search' )->will( $this->returnValue( 'test' ) ); |
88
|
|
|
|
89
|
|
|
$this->assertEquals( 'test', $this->object->search() ); |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
|
93
|
|
|
public function testGetSubClient() |
94
|
|
|
{ |
95
|
|
|
$this->mock->expects( $this->once() )->method( 'getSubClient' )->will( $this->returnValue( 'test' ) ); |
96
|
|
|
|
97
|
|
|
$this->assertEquals( 'test', $this->object->getSubClient( 'invalid' ) ); |
98
|
|
|
} |
99
|
|
|
} |
100
|
|
|
|
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.