Completed
Push — master ( 0229de...f71bfb )
by Aimeos
04:41
created
admin/jqadm/tests/Admin/JQAdm/Customer/Property/StandardTest.php 1 patch
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -21,40 +21,40 @@  discard block
 block discarded – undo
21 21
 		$this->view = \TestHelperJqadm::getView();
22 22
 		$this->context = \TestHelperJqadm::getContext();
23 23
 
24
-		$this->object = new \Aimeos\Admin\JQAdm\Customer\Property\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 );
24
+		$this->object = new \Aimeos\Admin\JQAdm\Customer\Property\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 28
 	}
29 29
 
30 30
 
31 31
 	protected function tearDown()
32 32
 	{
33
-		unset( $this->object, $this->view, $this->context );
33
+		unset($this->object, $this->view, $this->context);
34 34
 	}
35 35
 
36 36
 
37 37
 	public function testCreate()
38 38
 	{
39
-		$manager = \Aimeos\MShop::create( $this->context, 'customer' );
39
+		$manager = \Aimeos\MShop::create($this->context, 'customer');
40 40
 
41 41
 		$this->view->item = $manager->createItem();
42 42
 		$result = $this->object->create();
43 43
 
44
-		$this->assertContains( 'Properties', $result );
45
-		$this->assertNull( $this->view->get( 'errors' ) );
44
+		$this->assertContains('Properties', $result);
45
+		$this->assertNull($this->view->get('errors'));
46 46
 	}
47 47
 
48 48
 
49 49
 	public function testCopy()
50 50
 	{
51
-		$manager = \Aimeos\MShop::create( $this->context, 'customer' );
51
+		$manager = \Aimeos\MShop::create($this->context, 'customer');
52 52
 
53
-		$this->view->item = $manager->findItem( 'UTC001', ['customer/property'] );
53
+		$this->view->item = $manager->findItem('UTC001', ['customer/property']);
54 54
 		$result = $this->object->copy();
55 55
 
56
-		$this->assertNull( $this->view->get( 'errors' ) );
57
-		$this->assertContains( 'Properties', $result );
56
+		$this->assertNull($this->view->get('errors'));
57
+		$this->assertContains('Properties', $result);
58 58
 	}
59 59
 
60 60
 
@@ -62,26 +62,26 @@  discard block
 block discarded – undo
62 62
 	{
63 63
 		$result = $this->object->delete();
64 64
 
65
-		$this->assertNull( $this->view->get( 'errors' ) );
66
-		$this->assertNull( $result );
65
+		$this->assertNull($this->view->get('errors'));
66
+		$this->assertNull($result);
67 67
 	}
68 68
 
69 69
 
70 70
 	public function testGet()
71 71
 	{
72
-		$manager = \Aimeos\MShop::create( $this->context, 'customer' );
72
+		$manager = \Aimeos\MShop::create($this->context, 'customer');
73 73
 
74
-		$this->view->item = $manager->findItem( 'UTC001', ['customer/property'] );
74
+		$this->view->item = $manager->findItem('UTC001', ['customer/property']);
75 75
 		$result = $this->object->get();
76 76
 
77
-		$this->assertNull( $this->view->get( 'errors' ) );
78
-		$this->assertContains( 'Properties', $result );
77
+		$this->assertNull($this->view->get('errors'));
78
+		$this->assertContains('Properties', $result);
79 79
 	}
80 80
 
81 81
 
82 82
 	public function testSave()
83 83
 	{
84
-		$manager = \Aimeos\MShop::create( $this->context, 'customer' );
84
+		$manager = \Aimeos\MShop::create($this->context, 'customer');
85 85
 		$this->view->item = $manager->createItem();
86 86
 
87 87
 		$param = array(
@@ -95,70 +95,70 @@  discard block
 block discarded – undo
95 95
 			),
96 96
 		);
97 97
 
98
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param );
99
-		$this->view->addHelper( 'param', $helper );
98
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param);
99
+		$this->view->addHelper('param', $helper);
100 100
 
101 101
 		$result = $this->object->save();
102 102
 
103
-		$items = $this->view->item->getPropertyItems( null, false );
103
+		$items = $this->view->item->getPropertyItems(null, false);
104 104
 
105
-		$this->assertNull( $this->view->get( 'errors' ) );
106
-		$this->assertNull( $result );
107
-		$this->assertEquals( 1, count( $items ) );
108
-		$this->assertEquals( null, reset( $items )->getLanguageId() );
109
-		$this->assertEquals( '#100000', reset( $items )->getValue() );
105
+		$this->assertNull($this->view->get('errors'));
106
+		$this->assertNull($result);
107
+		$this->assertEquals(1, count($items));
108
+		$this->assertEquals(null, reset($items)->getLanguageId());
109
+		$this->assertEquals('#100000', reset($items)->getValue());
110 110
 	}
111 111
 
112 112
 
113 113
 	public function testSaveException()
114 114
 	{
115
-		$object = $this->getMockBuilder( \Aimeos\Admin\JQAdm\Customer\Property\Standard::class )
116
-			->setConstructorArgs( array( $this->context, \TestHelperJqadm::getTemplatePaths() ) )
117
-			->setMethods( array( 'fromArray' ) )
115
+		$object = $this->getMockBuilder(\Aimeos\Admin\JQAdm\Customer\Property\Standard::class)
116
+			->setConstructorArgs(array($this->context, \TestHelperJqadm::getTemplatePaths()))
117
+			->setMethods(array('fromArray'))
118 118
 			->getMock();
119 119
 
120
-		$object->expects( $this->once() )->method( 'fromArray' )
121
-			->will( $this->throwException( new \RuntimeException() ) );
120
+		$object->expects($this->once())->method('fromArray')
121
+			->will($this->throwException(new \RuntimeException()));
122 122
 
123 123
 		$this->view = \TestHelperJqadm::getView();
124
-		$this->view->item = \Aimeos\MShop::create( $this->context, 'customer' )->createItem();
124
+		$this->view->item = \Aimeos\MShop::create($this->context, 'customer')->createItem();
125 125
 
126
-		$object->setView( $this->view );
126
+		$object->setView($this->view);
127 127
 
128
-		$this->setExpectedException( \Aimeos\Admin\JQAdm\Exception::class );
128
+		$this->setExpectedException(\Aimeos\Admin\JQAdm\Exception::class);
129 129
 		$object->save();
130 130
 	}
131 131
 
132 132
 
133 133
 	public function testSaveMShopException()
134 134
 	{
135
-		$object = $this->getMockBuilder( \Aimeos\Admin\JQAdm\Customer\Property\Standard::class )
136
-			->setConstructorArgs( array( $this->context, \TestHelperJqadm::getTemplatePaths() ) )
137
-			->setMethods( array( 'fromArray' ) )
135
+		$object = $this->getMockBuilder(\Aimeos\Admin\JQAdm\Customer\Property\Standard::class)
136
+			->setConstructorArgs(array($this->context, \TestHelperJqadm::getTemplatePaths()))
137
+			->setMethods(array('fromArray'))
138 138
 			->getMock();
139 139
 
140
-		$object->expects( $this->once() )->method( 'fromArray' )
141
-			->will( $this->throwException( new \Aimeos\MShop\Exception() ) );
140
+		$object->expects($this->once())->method('fromArray')
141
+			->will($this->throwException(new \Aimeos\MShop\Exception()));
142 142
 
143 143
 		$this->view = \TestHelperJqadm::getView();
144
-		$this->view->item = \Aimeos\MShop::create( $this->context, 'customer' )->createItem();
144
+		$this->view->item = \Aimeos\MShop::create($this->context, 'customer')->createItem();
145 145
 
146
-		$object->setView( $this->view );
146
+		$object->setView($this->view);
147 147
 
148
-		$this->setExpectedException( \Aimeos\Admin\JQAdm\Exception::class );
148
+		$this->setExpectedException(\Aimeos\Admin\JQAdm\Exception::class);
149 149
 		$object->save();
150 150
 	}
151 151
 
152 152
 
153 153
 	public function testSearch()
154 154
 	{
155
-		$this->assertNull( $this->object->search() );
155
+		$this->assertNull($this->object->search());
156 156
 	}
157 157
 
158 158
 
159 159
 	public function testGetSubClient()
160 160
 	{
161
-		$this->setExpectedException( \Aimeos\Admin\JQAdm\Exception::class );
162
-		$this->object->getSubClient( 'unknown' );
161
+		$this->setExpectedException(\Aimeos\Admin\JQAdm\Exception::class);
162
+		$this->object->getSubClient('unknown');
163 163
 	}
164 164
 }
Please login to merge, or discard this patch.
admin/jqadm/tests/Admin/JQAdm/Supplier/StandardTest.php 1 patch
Spacing   +89 added lines, -89 removed lines patch added patch discarded remove patch
@@ -21,16 +21,16 @@  discard block
 block discarded – undo
21 21
 		$this->view = \TestHelperJqadm::getView();
22 22
 		$this->context = \TestHelperJqadm::getContext();
23 23
 
24
-		$this->object = new \Aimeos\Admin\JQAdm\Supplier\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 );
24
+		$this->object = new \Aimeos\Admin\JQAdm\Supplier\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 28
 	}
29 29
 
30 30
 
31 31
 	protected function tearDown()
32 32
 	{
33
-		unset( $this->object, $this->view, $this->context );
33
+		unset($this->object, $this->view, $this->context);
34 34
 	}
35 35
 
36 36
 
@@ -42,10 +42,10 @@  discard block
 block discarded – undo
42 42
 
43 43
 	public function testCreateException()
44 44
 	{
45
-		$object = $this->getClientMock( 'getSubClients' );
45
+		$object = $this->getClientMock('getSubClients');
46 46
 
47
-		$object->expects( $this->once() )->method( 'getSubClients' )
48
-			->will( $this->throwException( new \RuntimeException() ) );
47
+		$object->expects($this->once())->method('getSubClients')
48
+			->will($this->throwException(new \RuntimeException()));
49 49
 
50 50
 		$object->create();
51 51
 	}
@@ -53,10 +53,10 @@  discard block
 block discarded – undo
53 53
 
54 54
 	public function testCreateMShopException()
55 55
 	{
56
-		$object = $this->getClientMock( 'getSubClients' );
56
+		$object = $this->getClientMock('getSubClients');
57 57
 
58
-		$object->expects( $this->once() )->method( 'getSubClients' )
59
-			->will( $this->throwException( new \Aimeos\MShop\Exception() ) );
58
+		$object->expects($this->once())->method('getSubClients')
59
+			->will($this->throwException(new \Aimeos\MShop\Exception()));
60 60
 
61 61
 		$object->create();
62 62
 	}
@@ -64,24 +64,24 @@  discard block
 block discarded – undo
64 64
 
65 65
 	public function testCopy()
66 66
 	{
67
-		$manager = \Aimeos\MShop::create( $this->context, 'supplier' );
67
+		$manager = \Aimeos\MShop::create($this->context, 'supplier');
68 68
 
69
-		$param = ['site' => 'unittest', 'id' => $manager->findItem( 'unitCode001' )->getId()];
70
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param );
71
-		$this->view->addHelper( 'param', $helper );
69
+		$param = ['site' => 'unittest', 'id' => $manager->findItem('unitCode001')->getId()];
70
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param);
71
+		$this->view->addHelper('param', $helper);
72 72
 
73 73
 		$result = $this->object->copy();
74 74
 
75
-		$this->assertContains( 'unitSupplier001', $result );
75
+		$this->assertContains('unitSupplier001', $result);
76 76
 	}
77 77
 
78 78
 
79 79
 	public function testCopyException()
80 80
 	{
81
-		$object = $this->getClientMock( 'getSubClients' );
81
+		$object = $this->getClientMock('getSubClients');
82 82
 
83
-		$object->expects( $this->once() )->method( 'getSubClients' )
84
-			->will( $this->throwException( new \RuntimeException() ) );
83
+		$object->expects($this->once())->method('getSubClients')
84
+			->will($this->throwException(new \RuntimeException()));
85 85
 
86 86
 		$object->copy();
87 87
 	}
@@ -89,10 +89,10 @@  discard block
 block discarded – undo
89 89
 
90 90
 	public function testCopyMShopException()
91 91
 	{
92
-		$object = $this->getClientMock( 'getSubClients' );
92
+		$object = $this->getClientMock('getSubClients');
93 93
 
94
-		$object->expects( $this->once() )->method( 'getSubClients' )
95
-			->will( $this->throwException( new \Aimeos\MShop\Exception() ) );
94
+		$object->expects($this->once())->method('getSubClients')
95
+			->will($this->throwException(new \Aimeos\MShop\Exception()));
96 96
 
97 97
 		$object->copy();
98 98
 	}
@@ -100,16 +100,16 @@  discard block
 block discarded – undo
100 100
 
101 101
 	public function testDelete()
102 102
 	{
103
-		$this->assertNotNull( $this->object->delete() );
103
+		$this->assertNotNull($this->object->delete());
104 104
 	}
105 105
 
106 106
 
107 107
 	public function testDeleteException()
108 108
 	{
109
-		$object = $this->getClientMock( 'getSubClients' );
109
+		$object = $this->getClientMock('getSubClients');
110 110
 
111
-		$object->expects( $this->exactly( 2 ) )->method( 'getSubClients' )
112
-			->will( $this->throwException( new \RuntimeException() ) );
111
+		$object->expects($this->exactly(2))->method('getSubClients')
112
+			->will($this->throwException(new \RuntimeException()));
113 113
 
114 114
 		$object->delete();
115 115
 	}
@@ -117,10 +117,10 @@  discard block
 block discarded – undo
117 117
 
118 118
 	public function testDeleteMShopException()
119 119
 	{
120
-		$object = $this->getClientMock( 'getSubClients' );
120
+		$object = $this->getClientMock('getSubClients');
121 121
 
122
-		$object->expects( $this->exactly( 2 ) )->method( 'getSubClients' )
123
-			->will( $this->throwException( new \Aimeos\MShop\Exception() ) );
122
+		$object->expects($this->exactly(2))->method('getSubClients')
123
+			->will($this->throwException(new \Aimeos\MShop\Exception()));
124 124
 
125 125
 		$object->delete();
126 126
 	}
@@ -128,24 +128,24 @@  discard block
 block discarded – undo
128 128
 
129 129
 	public function testGet()
130 130
 	{
131
-		$manager = \Aimeos\MShop::create( $this->context, 'supplier' );
131
+		$manager = \Aimeos\MShop::create($this->context, 'supplier');
132 132
 
133
-		$param = ['site' => 'unittest', 'id' => $manager->findItem( 'unitCode001' )->getId()];
134
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param );
135
-		$this->view->addHelper( 'param', $helper );
133
+		$param = ['site' => 'unittest', 'id' => $manager->findItem('unitCode001')->getId()];
134
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param);
135
+		$this->view->addHelper('param', $helper);
136 136
 
137 137
 		$result = $this->object->get();
138 138
 
139
-		$this->assertContains( 'unitSupplier001', $result );
139
+		$this->assertContains('unitSupplier001', $result);
140 140
 	}
141 141
 
142 142
 
143 143
 	public function testGetException()
144 144
 	{
145
-		$object = $this->getClientMock( 'getSubClients' );
145
+		$object = $this->getClientMock('getSubClients');
146 146
 
147
-		$object->expects( $this->once() )->method( 'getSubClients' )
148
-			->will( $this->throwException( new \RuntimeException() ) );
147
+		$object->expects($this->once())->method('getSubClients')
148
+			->will($this->throwException(new \RuntimeException()));
149 149
 
150 150
 		$object->get();
151 151
 	}
@@ -153,10 +153,10 @@  discard block
 block discarded – undo
153 153
 
154 154
 	public function testGetMShopException()
155 155
 	{
156
-		$object = $this->getClientMock( 'getSubClients' );
156
+		$object = $this->getClientMock('getSubClients');
157 157
 
158
-		$object->expects( $this->once() )->method( 'getSubClients' )
159
-			->will( $this->throwException( new \Aimeos\MShop\Exception() ) );
158
+		$object->expects($this->once())->method('getSubClients')
159
+			->will($this->throwException(new \Aimeos\MShop\Exception()));
160 160
 
161 161
 		$object->get();
162 162
 	}
@@ -164,16 +164,16 @@  discard block
 block discarded – undo
164 164
 
165 165
 	public function testGetViewException()
166 166
 	{
167
-		$object = new \Aimeos\Admin\JQAdm\Supplier\Standard( $this->context, [] );
167
+		$object = new \Aimeos\Admin\JQAdm\Supplier\Standard($this->context, []);
168 168
 
169
-		$this->setExpectedException( \Aimeos\Admin\JQAdm\Exception::class );
169
+		$this->setExpectedException(\Aimeos\Admin\JQAdm\Exception::class);
170 170
 		$object->getView();
171 171
 	}
172 172
 
173 173
 
174 174
 	public function testSave()
175 175
 	{
176
-		$manager = \Aimeos\MShop::create( $this->context, 'supplier' );
176
+		$manager = \Aimeos\MShop::create($this->context, 'supplier');
177 177
 
178 178
 		$param = array(
179 179
 			'site' => 'unittest',
@@ -185,21 +185,21 @@  discard block
 block discarded – undo
185 185
 			),
186 186
 		);
187 187
 
188
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param );
189
-		$this->view->addHelper( 'param', $helper );
188
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param);
189
+		$this->view->addHelper('param', $helper);
190 190
 
191 191
 		$this->object->save();
192 192
 
193
-		$manager->deleteItem( $manager->findItem( 'jqadm@test' )->getId() );
193
+		$manager->deleteItem($manager->findItem('jqadm@test')->getId());
194 194
 	}
195 195
 
196 196
 
197 197
 	public function testSaveException()
198 198
 	{
199
-		$object = $this->getClientMock( 'fromArray' );
199
+		$object = $this->getClientMock('fromArray');
200 200
 
201
-		$object->expects( $this->once() )->method( 'fromArray' )
202
-			->will( $this->throwException( new \RuntimeException() ) );
201
+		$object->expects($this->once())->method('fromArray')
202
+			->will($this->throwException(new \RuntimeException()));
203 203
 
204 204
 		$object->save();
205 205
 	}
@@ -207,10 +207,10 @@  discard block
 block discarded – undo
207 207
 
208 208
 	public function testSaveMShopException()
209 209
 	{
210
-		$object = $this->getClientMock( 'fromArray' );
210
+		$object = $this->getClientMock('fromArray');
211 211
 
212
-		$object->expects( $this->once() )->method( 'fromArray' )
213
-			->will( $this->throwException( new \RuntimeException() ) );
212
+		$object->expects($this->once())->method('fromArray')
213
+			->will($this->throwException(new \RuntimeException()));
214 214
 
215 215
 		$object->save();
216 216
 	}
@@ -218,10 +218,10 @@  discard block
 block discarded – undo
218 218
 
219 219
 	public function testSaveJQAdmException()
220 220
 	{
221
-		$object = $this->getClientMock( 'fromArray' );
221
+		$object = $this->getClientMock('fromArray');
222 222
 
223
-		$object->expects( $this->once() )->method( 'fromArray' )
224
-			->will( $this->throwException( new \RuntimeException() ) );
223
+		$object->expects($this->once())->method('fromArray')
224
+			->will($this->throwException(new \RuntimeException()));
225 225
 
226 226
 		$object->save();
227 227
 	}
@@ -232,27 +232,27 @@  discard block
 block discarded – undo
232 232
 		$param = array(
233 233
 			'site' => 'unittest', 'lang' => 'de',
234 234
 			'filter' => array(
235
-				'key' => array( 0 => 'supplier.code' ),
236
-				'op' => array( 0 => '==' ),
237
-				'val' => array( 0 => 'unitCode001' ),
235
+				'key' => array(0 => 'supplier.code'),
236
+				'op' => array(0 => '=='),
237
+				'val' => array(0 => 'unitCode001'),
238 238
 			),
239
-			'sort' => array( 'supplier.label', '-supplier.id' ),
239
+			'sort' => array('supplier.label', '-supplier.id'),
240 240
 		);
241
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param );
242
-		$this->view->addHelper( 'param', $helper );
241
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param);
242
+		$this->view->addHelper('param', $helper);
243 243
 
244 244
 		$result = $this->object->search();
245 245
 
246
-		$this->assertContains( '>unitCode001<', $result );
246
+		$this->assertContains('>unitCode001<', $result);
247 247
 	}
248 248
 
249 249
 
250 250
 	public function testSearchException()
251 251
 	{
252
-		$object = $this->getClientMock( 'initCriteria' );
252
+		$object = $this->getClientMock('initCriteria');
253 253
 
254
-		$object->expects( $this->once() )->method( 'initCriteria' )
255
-			->will( $this->throwException( new \RuntimeException() ) );
254
+		$object->expects($this->once())->method('initCriteria')
255
+			->will($this->throwException(new \RuntimeException()));
256 256
 
257 257
 		$object->search();
258 258
 	}
@@ -260,10 +260,10 @@  discard block
 block discarded – undo
260 260
 
261 261
 	public function testSearchMShopException()
262 262
 	{
263
-		$object = $this->getClientMock( 'initCriteria' );
263
+		$object = $this->getClientMock('initCriteria');
264 264
 
265
-		$object->expects( $this->once() )->method( 'initCriteria' )
266
-			->will( $this->throwException( new \Aimeos\MShop\Exception() ) );
265
+		$object->expects($this->once())->method('initCriteria')
266
+			->will($this->throwException(new \Aimeos\MShop\Exception()));
267 267
 
268 268
 		$object->search();
269 269
 	}
@@ -271,34 +271,34 @@  discard block
 block discarded – undo
271 271
 
272 272
 	public function testGetSubClient()
273 273
 	{
274
-		$result = $this->object->getSubClient( 'address' );
275
-		$this->assertInstanceOf( \Aimeos\Admin\JQAdm\Iface::class, $result );
274
+		$result = $this->object->getSubClient('address');
275
+		$this->assertInstanceOf(\Aimeos\Admin\JQAdm\Iface::class, $result);
276 276
 	}
277 277
 
278 278
 
279 279
 	public function testGetSubClientInvalid()
280 280
 	{
281
-		$this->setExpectedException( \Aimeos\Admin\JQAdm\Exception::class );
282
-		$this->object->getSubClient( '$unknown$' );
281
+		$this->setExpectedException(\Aimeos\Admin\JQAdm\Exception::class);
282
+		$this->object->getSubClient('$unknown$');
283 283
 	}
284 284
 
285 285
 
286 286
 	public function testGetSubClientUnknown()
287 287
 	{
288
-		$this->setExpectedException( \Aimeos\Admin\JQAdm\Exception::class );
289
-		$this->object->getSubClient( 'unknown' );
288
+		$this->setExpectedException(\Aimeos\Admin\JQAdm\Exception::class);
289
+		$this->object->getSubClient('unknown');
290 290
 	}
291 291
 
292 292
 
293
-	public function getClientMock( $method )
293
+	public function getClientMock($method)
294 294
 	{
295
-		$object = $this->getMockBuilder( \Aimeos\Admin\JQAdm\Supplier\Standard::class )
296
-			->setConstructorArgs( array( $this->context, \TestHelperJqadm::getTemplatePaths() ) )
297
-			->setMethods( [$method] )
295
+		$object = $this->getMockBuilder(\Aimeos\Admin\JQAdm\Supplier\Standard::class)
296
+			->setConstructorArgs(array($this->context, \TestHelperJqadm::getTemplatePaths()))
297
+			->setMethods([$method])
298 298
 			->getMock();
299 299
 
300
-		$object->setAimeos( \TestHelperJqadm::getAimeos() );
301
-		$object->setView( $this->getViewNoRender() );
300
+		$object->setAimeos(\TestHelperJqadm::getAimeos());
301
+		$object->setView($this->getViewNoRender());
302 302
 
303 303
 		return $object;
304 304
 	}
@@ -306,19 +306,19 @@  discard block
 block discarded – undo
306 306
 
307 307
 	protected function getViewNoRender()
308 308
 	{
309
-		$view = $this->getMockBuilder( \Aimeos\MW\View\Standard::class )
310
-			->setConstructorArgs( array( [] ) )
311
-			->setMethods( array( 'render', 'config' ) )
309
+		$view = $this->getMockBuilder(\Aimeos\MW\View\Standard::class)
310
+			->setConstructorArgs(array([]))
311
+			->setMethods(array('render', 'config'))
312 312
 			->getMock();
313 313
 
314
-		$manager = \Aimeos\MShop::create( $this->context, 'supplier' );
314
+		$manager = \Aimeos\MShop::create($this->context, 'supplier');
315 315
 
316
-		$param = ['site' => 'unittest', 'id' => $manager->findItem( 'unitCode001' )->getId()];
317
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $view, $param );
318
-		$view->addHelper( 'param', $helper );
316
+		$param = ['site' => 'unittest', 'id' => $manager->findItem('unitCode001')->getId()];
317
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($view, $param);
318
+		$view->addHelper('param', $helper);
319 319
 
320
-		$helper = new \Aimeos\MW\View\Helper\Access\Standard( $view, [] );
321
-		$view->addHelper( 'access', $helper );
320
+		$helper = new \Aimeos\MW\View\Helper\Access\Standard($view, []);
321
+		$view->addHelper('access', $helper);
322 322
 
323 323
 		return $view;
324 324
 	}
Please login to merge, or discard this patch.
admin/jqadm/tests/Admin/JQAdm/Supplier/Address/StandardTest.php 1 patch
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -21,40 +21,40 @@  discard block
 block discarded – undo
21 21
 		$this->view = \TestHelperJqadm::getView();
22 22
 		$this->context = \TestHelperJqadm::getContext();
23 23
 
24
-		$this->object = new \Aimeos\Admin\JQAdm\Supplier\Address\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 );
24
+		$this->object = new \Aimeos\Admin\JQAdm\Supplier\Address\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 28
 	}
29 29
 
30 30
 
31 31
 	protected function tearDown()
32 32
 	{
33
-		unset( $this->object, $this->view, $this->context );
33
+		unset($this->object, $this->view, $this->context);
34 34
 	}
35 35
 
36 36
 
37 37
 	public function testCreate()
38 38
 	{
39
-		$manager = \Aimeos\MShop::create( $this->context, 'supplier' );
39
+		$manager = \Aimeos\MShop::create($this->context, 'supplier');
40 40
 
41 41
 		$this->view->item = $manager->createItem();
42 42
 		$result = $this->object->create();
43 43
 
44
-		$this->assertContains( 'item-address', $result );
45
-		$this->assertNull( $this->view->get( 'errors' ) );
44
+		$this->assertContains('item-address', $result);
45
+		$this->assertNull($this->view->get('errors'));
46 46
 	}
47 47
 
48 48
 
49 49
 	public function testCopy()
50 50
 	{
51
-		$manager = \Aimeos\MShop::create( $this->context, 'supplier' );
51
+		$manager = \Aimeos\MShop::create($this->context, 'supplier');
52 52
 
53
-		$this->view->item = $manager->findItem( 'unitCode001', array( 'supplier/address' ) );
53
+		$this->view->item = $manager->findItem('unitCode001', array('supplier/address'));
54 54
 		$result = $this->object->copy();
55 55
 
56
-		$this->assertNull( $this->view->get( 'errors' ) );
57
-		$this->assertContains( 'Example company', $result );
56
+		$this->assertNull($this->view->get('errors'));
57
+		$this->assertContains('Example company', $result);
58 58
 	}
59 59
 
60 60
 
@@ -62,26 +62,26 @@  discard block
 block discarded – undo
62 62
 	{
63 63
 		$result = $this->object->delete();
64 64
 
65
-		$this->assertNull( $this->view->get( 'errors' ) );
66
-		$this->assertNull( $result );
65
+		$this->assertNull($this->view->get('errors'));
66
+		$this->assertNull($result);
67 67
 	}
68 68
 
69 69
 
70 70
 	public function testGet()
71 71
 	{
72
-		$manager = \Aimeos\MShop::create( $this->context, 'supplier' );
72
+		$manager = \Aimeos\MShop::create($this->context, 'supplier');
73 73
 
74
-		$this->view->item = $manager->findItem( 'unitCode001', array( 'supplier/address' ) );
74
+		$this->view->item = $manager->findItem('unitCode001', array('supplier/address'));
75 75
 		$result = $this->object->get();
76 76
 
77
-		$this->assertNull( $this->view->get( 'errors' ) );
78
-		$this->assertContains( 'Example company', $result );
77
+		$this->assertNull($this->view->get('errors'));
78
+		$this->assertContains('Example company', $result);
79 79
 	}
80 80
 
81 81
 
82 82
 	public function testSave()
83 83
 	{
84
-		$manager = \Aimeos\MShop::create( $this->context, 'supplier' );
84
+		$manager = \Aimeos\MShop::create($this->context, 'supplier');
85 85
 		$this->view->item = $manager->createItem();
86 86
 
87 87
 		$param = array(
@@ -96,73 +96,73 @@  discard block
 block discarded – undo
96 96
 			),
97 97
 		);
98 98
 
99
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param );
100
-		$this->view->addHelper( 'param', $helper );
99
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param);
100
+		$this->view->addHelper('param', $helper);
101 101
 
102 102
 		$result = $this->object->save();
103 103
 
104
-		$this->assertNull( $this->view->get( 'errors' ) );
105
-		$this->assertNull( $result );
106
-		$this->assertEquals( 1, count( $this->view->item->getAddressItems() ) );
104
+		$this->assertNull($this->view->get('errors'));
105
+		$this->assertNull($result);
106
+		$this->assertEquals(1, count($this->view->item->getAddressItems()));
107 107
 
108
-		foreach( $this->view->item->getAddressItems() as $addrItem )
108
+		foreach ($this->view->item->getAddressItems() as $addrItem)
109 109
 		{
110
-			$this->assertEquals( '[email protected]', $addrItem->getEmail() );
111
-			$this->assertEquals( 'test', $addrItem->getFirstname() );
112
-			$this->assertEquals( 'user', $addrItem->getLastname() );
110
+			$this->assertEquals('[email protected]', $addrItem->getEmail());
111
+			$this->assertEquals('test', $addrItem->getFirstname());
112
+			$this->assertEquals('user', $addrItem->getLastname());
113 113
 		}
114 114
 	}
115 115
 
116 116
 
117 117
 	public function testSaveException()
118 118
 	{
119
-		$object = $this->getMockBuilder( \Aimeos\Admin\JQAdm\Supplier\Address\Standard::class )
120
-			->setConstructorArgs( array( $this->context, \TestHelperJqadm::getTemplatePaths() ) )
121
-			->setMethods( array( 'fromArray' ) )
119
+		$object = $this->getMockBuilder(\Aimeos\Admin\JQAdm\Supplier\Address\Standard::class)
120
+			->setConstructorArgs(array($this->context, \TestHelperJqadm::getTemplatePaths()))
121
+			->setMethods(array('fromArray'))
122 122
 			->getMock();
123 123
 
124
-		$object->expects( $this->once() )->method( 'fromArray' )
125
-			->will( $this->throwException( new \RuntimeException() ) );
124
+		$object->expects($this->once())->method('fromArray')
125
+			->will($this->throwException(new \RuntimeException()));
126 126
 
127 127
 		$view = \TestHelperJqadm::getView();
128
-		$view->item = \Aimeos\MShop::create( $this->context, 'supplier' )->createItem();
128
+		$view->item = \Aimeos\MShop::create($this->context, 'supplier')->createItem();
129 129
 
130
-		$object->setView( $view );
130
+		$object->setView($view);
131 131
 
132
-		$this->setExpectedException( \Aimeos\Admin\JQAdm\Exception::class );
132
+		$this->setExpectedException(\Aimeos\Admin\JQAdm\Exception::class);
133 133
 		$object->save();
134 134
 	}
135 135
 
136 136
 
137 137
 	public function testSaveMShopException()
138 138
 	{
139
-		$object = $this->getMockBuilder( \Aimeos\Admin\JQAdm\Supplier\Address\Standard::class )
140
-			->setConstructorArgs( array( $this->context, \TestHelperJqadm::getTemplatePaths() ) )
141
-			->setMethods( array( 'fromArray' ) )
139
+		$object = $this->getMockBuilder(\Aimeos\Admin\JQAdm\Supplier\Address\Standard::class)
140
+			->setConstructorArgs(array($this->context, \TestHelperJqadm::getTemplatePaths()))
141
+			->setMethods(array('fromArray'))
142 142
 			->getMock();
143 143
 
144
-		$object->expects( $this->once() )->method( 'fromArray' )
145
-			->will( $this->throwException( new \Aimeos\MShop\Exception() ) );
144
+		$object->expects($this->once())->method('fromArray')
145
+			->will($this->throwException(new \Aimeos\MShop\Exception()));
146 146
 
147 147
 		$this->view = \TestHelperJqadm::getView();
148
-		$this->view->item = \Aimeos\MShop::create( $this->context, 'supplier' )->createItem();
148
+		$this->view->item = \Aimeos\MShop::create($this->context, 'supplier')->createItem();
149 149
 
150
-		$object->setView( $this->view );
150
+		$object->setView($this->view);
151 151
 
152
-		$this->setExpectedException( \Aimeos\Admin\JQAdm\Exception::class );
152
+		$this->setExpectedException(\Aimeos\Admin\JQAdm\Exception::class);
153 153
 		$object->save();
154 154
 	}
155 155
 
156 156
 
157 157
 	public function testSearch()
158 158
 	{
159
-		$this->assertNull( $this->object->search() );
159
+		$this->assertNull($this->object->search());
160 160
 	}
161 161
 
162 162
 
163 163
 	public function testGetSubClient()
164 164
 	{
165
-		$this->setExpectedException( \Aimeos\Admin\JQAdm\Exception::class );
166
-		$this->object->getSubClient( 'unknown' );
165
+		$this->setExpectedException(\Aimeos\Admin\JQAdm\Exception::class);
166
+		$this->object->getSubClient('unknown');
167 167
 	}
168 168
 }
Please login to merge, or discard this patch.
admin/jqadm/tests/Admin/JQAdm/Supplier/Product/StandardTest.php 1 patch
Spacing   +93 added lines, -93 removed lines patch added patch discarded remove patch
@@ -21,41 +21,41 @@  discard block
 block discarded – undo
21 21
 		$this->view = \TestHelperJqadm::getView();
22 22
 		$this->context = \TestHelperJqadm::getContext();
23 23
 
24
-		$this->object = new \Aimeos\Admin\JQAdm\Supplier\Product\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 );
24
+		$this->object = new \Aimeos\Admin\JQAdm\Supplier\Product\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 28
 	}
29 29
 
30 30
 
31 31
 	protected function tearDown()
32 32
 	{
33
-		unset( $this->object, $this->view, $this->context );
33
+		unset($this->object, $this->view, $this->context);
34 34
 	}
35 35
 
36 36
 
37 37
 	public function testCopy()
38 38
 	{
39
-		$manager = \Aimeos\MShop::create( $this->context, 'supplier' );
40
-		$this->view->item = $manager->findItem( 'unitCode001' );
39
+		$manager = \Aimeos\MShop::create($this->context, 'supplier');
40
+		$this->view->item = $manager->findItem('unitCode001');
41 41
 
42 42
 		$result = $this->object->copy();
43 43
 
44
-		$this->assertContains( 'item-product', $result );
44
+		$this->assertContains('item-product', $result);
45 45
 	}
46 46
 
47 47
 
48 48
 	public function testCopyException()
49 49
 	{
50
-		$object = $this->getMockBuilder( \Aimeos\Admin\JQAdm\Supplier\Product\Standard::class )
51
-			->setConstructorArgs( array( $this->context, \TestHelperJqadm::getTemplatePaths() ) )
52
-			->setMethods( array( 'getSubClients' ) )
50
+		$object = $this->getMockBuilder(\Aimeos\Admin\JQAdm\Supplier\Product\Standard::class)
51
+			->setConstructorArgs(array($this->context, \TestHelperJqadm::getTemplatePaths()))
52
+			->setMethods(array('getSubClients'))
53 53
 			->getMock();
54 54
 
55
-		$object->expects( $this->once() )->method( 'getSubClients' )
56
-			->will( $this->throwException( new \RuntimeException() ) );
55
+		$object->expects($this->once())->method('getSubClients')
56
+			->will($this->throwException(new \RuntimeException()));
57 57
 
58
-		$object->setView( $this->getViewNoRender() );
58
+		$object->setView($this->getViewNoRender());
59 59
 
60 60
 		$object->copy();
61 61
 	}
@@ -63,15 +63,15 @@  discard block
 block discarded – undo
63 63
 
64 64
 	public function testCopyMShopException()
65 65
 	{
66
-		$object = $this->getMockBuilder( \Aimeos\Admin\JQAdm\Supplier\Product\Standard::class )
67
-			->setConstructorArgs( array( $this->context, \TestHelperJqadm::getTemplatePaths() ) )
68
-			->setMethods( array( 'getSubClients' ) )
66
+		$object = $this->getMockBuilder(\Aimeos\Admin\JQAdm\Supplier\Product\Standard::class)
67
+			->setConstructorArgs(array($this->context, \TestHelperJqadm::getTemplatePaths()))
68
+			->setMethods(array('getSubClients'))
69 69
 			->getMock();
70 70
 
71
-		$object->expects( $this->once() )->method( 'getSubClients' )
72
-			->will( $this->throwException( new \Aimeos\MShop\Exception() ) );
71
+		$object->expects($this->once())->method('getSubClients')
72
+			->will($this->throwException(new \Aimeos\MShop\Exception()));
73 73
 
74
-		$object->setView( $this->getViewNoRender() );
74
+		$object->setView($this->getViewNoRender());
75 75
 
76 76
 		$object->copy();
77 77
 	}
@@ -79,26 +79,26 @@  discard block
 block discarded – undo
79 79
 
80 80
 	public function testCreate()
81 81
 	{
82
-		$manager = \Aimeos\MShop::create( $this->context, 'supplier' );
83
-		$this->view->item = $manager->findItem( 'unitCode001' );
82
+		$manager = \Aimeos\MShop::create($this->context, 'supplier');
83
+		$this->view->item = $manager->findItem('unitCode001');
84 84
 
85 85
 		$result = $this->object->create();
86 86
 
87
-		$this->assertContains( 'item-product', $result );
87
+		$this->assertContains('item-product', $result);
88 88
 	}
89 89
 
90 90
 
91 91
 	public function testCreateException()
92 92
 	{
93
-		$object = $this->getMockBuilder( \Aimeos\Admin\JQAdm\Supplier\Product\Standard::class )
94
-			->setConstructorArgs( array( $this->context, \TestHelperJqadm::getTemplatePaths() ) )
95
-			->setMethods( array( 'getSubClients' ) )
93
+		$object = $this->getMockBuilder(\Aimeos\Admin\JQAdm\Supplier\Product\Standard::class)
94
+			->setConstructorArgs(array($this->context, \TestHelperJqadm::getTemplatePaths()))
95
+			->setMethods(array('getSubClients'))
96 96
 			->getMock();
97 97
 
98
-		$object->expects( $this->once() )->method( 'getSubClients' )
99
-			->will( $this->throwException( new \RuntimeException() ) );
98
+		$object->expects($this->once())->method('getSubClients')
99
+			->will($this->throwException(new \RuntimeException()));
100 100
 
101
-		$object->setView( $this->getViewNoRender() );
101
+		$object->setView($this->getViewNoRender());
102 102
 
103 103
 		$object->create();
104 104
 	}
@@ -106,15 +106,15 @@  discard block
 block discarded – undo
106 106
 
107 107
 	public function testCreateMShopException()
108 108
 	{
109
-		$object = $this->getMockBuilder( \Aimeos\Admin\JQAdm\Supplier\Product\Standard::class )
110
-			->setConstructorArgs( array( $this->context, \TestHelperJqadm::getTemplatePaths() ) )
111
-			->setMethods( array( 'getSubClients' ) )
109
+		$object = $this->getMockBuilder(\Aimeos\Admin\JQAdm\Supplier\Product\Standard::class)
110
+			->setConstructorArgs(array($this->context, \TestHelperJqadm::getTemplatePaths()))
111
+			->setMethods(array('getSubClients'))
112 112
 			->getMock();
113 113
 
114
-		$object->expects( $this->once() )->method( 'getSubClients' )
115
-			->will( $this->throwException( new \Aimeos\MShop\Exception() ) );
114
+		$object->expects($this->once())->method('getSubClients')
115
+			->will($this->throwException(new \Aimeos\MShop\Exception()));
116 116
 
117
-		$object->setView( $this->getViewNoRender() );
117
+		$object->setView($this->getViewNoRender());
118 118
 
119 119
 		$object->create();
120 120
 	}
@@ -122,27 +122,27 @@  discard block
 block discarded – undo
122 122
 
123 123
 	public function testGet()
124 124
 	{
125
-		$manager = \Aimeos\MShop::create( $this->context, 'supplier' );
126
-		$this->view->item = $manager->findItem( 'unitCode001' );
125
+		$manager = \Aimeos\MShop::create($this->context, 'supplier');
126
+		$this->view->item = $manager->findItem('unitCode001');
127 127
 
128 128
 		$result = $this->object->get();
129 129
 
130
-		$this->assertContains( 'item-product', $result );
131
-		$this->assertContains( 'default', $result );
130
+		$this->assertContains('item-product', $result);
131
+		$this->assertContains('default', $result);
132 132
 	}
133 133
 
134 134
 
135 135
 	public function testGetException()
136 136
 	{
137
-		$object = $this->getMockBuilder( \Aimeos\Admin\JQAdm\Supplier\Product\Standard::class )
138
-			->setConstructorArgs( array( $this->context, \TestHelperJqadm::getTemplatePaths() ) )
139
-			->setMethods( array( 'getSubClients' ) )
137
+		$object = $this->getMockBuilder(\Aimeos\Admin\JQAdm\Supplier\Product\Standard::class)
138
+			->setConstructorArgs(array($this->context, \TestHelperJqadm::getTemplatePaths()))
139
+			->setMethods(array('getSubClients'))
140 140
 			->getMock();
141 141
 
142
-		$object->expects( $this->once() )->method( 'getSubClients' )
143
-			->will( $this->throwException( new \RuntimeException() ) );
142
+		$object->expects($this->once())->method('getSubClients')
143
+			->will($this->throwException(new \RuntimeException()));
144 144
 
145
-		$object->setView( $this->getViewNoRender() );
145
+		$object->setView($this->getViewNoRender());
146 146
 
147 147
 		$object->get();
148 148
 	}
@@ -150,15 +150,15 @@  discard block
 block discarded – undo
150 150
 
151 151
 	public function testGetMShopException()
152 152
 	{
153
-		$object = $this->getMockBuilder( \Aimeos\Admin\JQAdm\Supplier\Product\Standard::class )
154
-			->setConstructorArgs( array( $this->context, \TestHelperJqadm::getTemplatePaths() ) )
155
-			->setMethods( array( 'getSubClients' ) )
153
+		$object = $this->getMockBuilder(\Aimeos\Admin\JQAdm\Supplier\Product\Standard::class)
154
+			->setConstructorArgs(array($this->context, \TestHelperJqadm::getTemplatePaths()))
155
+			->setMethods(array('getSubClients'))
156 156
 			->getMock();
157 157
 
158
-		$object->expects( $this->once() )->method( 'getSubClients' )
159
-			->will( $this->throwException( new \Aimeos\MShop\Exception() ) );
158
+		$object->expects($this->once())->method('getSubClients')
159
+			->will($this->throwException(new \Aimeos\MShop\Exception()));
160 160
 
161
-		$object->setView( $this->getViewNoRender() );
161
+		$object->setView($this->getViewNoRender());
162 162
 
163 163
 		$object->get();
164 164
 	}
@@ -166,13 +166,13 @@  discard block
 block discarded – undo
166 166
 
167 167
 	public function testSave()
168 168
 	{
169
-		$manager = \Aimeos\MShop::create( $this->context, 'supplier' );
169
+		$manager = \Aimeos\MShop::create($this->context, 'supplier');
170 170
 
171
-		$item = $manager->findItem( 'unitCode001' );
172
-		$item->setCode( 'jqadm-test-save' );
173
-		$item->setId( null );
171
+		$item = $manager->findItem('unitCode001');
172
+		$item->setCode('jqadm-test-save');
173
+		$item->setId(null);
174 174
 
175
-		$item = $manager->saveItem( $item );
175
+		$item = $manager->saveItem($item);
176 176
 
177 177
 
178 178
 		$param = array(
@@ -188,83 +188,83 @@  discard block
 block discarded – undo
188 188
 			),
189 189
 		);
190 190
 
191
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param );
192
-		$this->view->addHelper( 'param', $helper );
191
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param);
192
+		$this->view->addHelper('param', $helper);
193 193
 		$this->view->item = $item;
194 194
 
195 195
 		$result = $this->object->save();
196 196
 
197
-		$item = $manager->getItem( $item->getId(), ['product'] );
198
-		$manager->deleteItem( $item->getId() );
197
+		$item = $manager->getItem($item->getId(), ['product']);
198
+		$manager->deleteItem($item->getId());
199 199
 
200
-		$this->assertNull( $this->view->get( 'errors' ) );
201
-		$this->assertNull( $result );
202
-		$this->assertEquals( 1, count( $item->getListItems() ) );
200
+		$this->assertNull($this->view->get('errors'));
201
+		$this->assertNull($result);
202
+		$this->assertEquals(1, count($item->getListItems()));
203 203
 
204
-		foreach( $item->getListItems( 'product' ) as $listItem )
204
+		foreach ($item->getListItems('product') as $listItem)
205 205
 		{
206
-			$this->assertEquals( $item->getId(), $listItem->getParentId() );
207
-			$this->assertEquals( 'default', $listItem->getType() );
208
-			$this->assertEquals( 'product', $listItem->getDomain() );
209
-			$this->assertEquals( '2000-01-01 00:00:00', $listItem->getDateStart() );
210
-			$this->assertEquals( '2100-01-01 00:00:00', $listItem->getDateEnd() );
211
-			$this->assertEquals( ['test' => 'value'], $listItem->getConfig() );
212
-			$this->assertEquals( 'test', $listItem->getRefId() );
213
-			$this->assertEquals( 1, $listItem->getStatus() );
206
+			$this->assertEquals($item->getId(), $listItem->getParentId());
207
+			$this->assertEquals('default', $listItem->getType());
208
+			$this->assertEquals('product', $listItem->getDomain());
209
+			$this->assertEquals('2000-01-01 00:00:00', $listItem->getDateStart());
210
+			$this->assertEquals('2100-01-01 00:00:00', $listItem->getDateEnd());
211
+			$this->assertEquals(['test' => 'value'], $listItem->getConfig());
212
+			$this->assertEquals('test', $listItem->getRefId());
213
+			$this->assertEquals(1, $listItem->getStatus());
214 214
 		}
215 215
 	}
216 216
 
217 217
 
218 218
 	public function testSaveException()
219 219
 	{
220
-		$object = $this->getMockBuilder( \Aimeos\Admin\JQAdm\Supplier\Product\Standard::class )
221
-			->setConstructorArgs( array( $this->context, \TestHelperJqadm::getTemplatePaths() ) )
222
-			->setMethods( array( 'fromArray' ) )
220
+		$object = $this->getMockBuilder(\Aimeos\Admin\JQAdm\Supplier\Product\Standard::class)
221
+			->setConstructorArgs(array($this->context, \TestHelperJqadm::getTemplatePaths()))
222
+			->setMethods(array('fromArray'))
223 223
 			->getMock();
224 224
 
225
-		$object->expects( $this->once() )->method( 'fromArray' )
226
-			->will( $this->throwException( new \RuntimeException() ) );
225
+		$object->expects($this->once())->method('fromArray')
226
+			->will($this->throwException(new \RuntimeException()));
227 227
 
228
-		$object->setView( $this->getViewNoRender() );
228
+		$object->setView($this->getViewNoRender());
229 229
 
230
-		$this->setExpectedException( \Aimeos\Admin\JQAdm\Exception::class );
230
+		$this->setExpectedException(\Aimeos\Admin\JQAdm\Exception::class);
231 231
 		$object->save();
232 232
 	}
233 233
 
234 234
 
235 235
 	public function testSaveMShopException()
236 236
 	{
237
-		$object = $this->getMockBuilder( \Aimeos\Admin\JQAdm\Supplier\Product\Standard::class )
238
-			->setConstructorArgs( array( $this->context, \TestHelperJqadm::getTemplatePaths() ) )
239
-			->setMethods( array( 'fromArray' ) )
237
+		$object = $this->getMockBuilder(\Aimeos\Admin\JQAdm\Supplier\Product\Standard::class)
238
+			->setConstructorArgs(array($this->context, \TestHelperJqadm::getTemplatePaths()))
239
+			->setMethods(array('fromArray'))
240 240
 			->getMock();
241 241
 
242
-		$object->expects( $this->once() )->method( 'fromArray' )
243
-			->will( $this->throwException( new \Aimeos\MShop\Exception() ) );
242
+		$object->expects($this->once())->method('fromArray')
243
+			->will($this->throwException(new \Aimeos\MShop\Exception()));
244 244
 
245
-		$object->setView( $this->getViewNoRender() );
245
+		$object->setView($this->getViewNoRender());
246 246
 
247
-		$this->setExpectedException( \Aimeos\Admin\JQAdm\Exception::class );
247
+		$this->setExpectedException(\Aimeos\Admin\JQAdm\Exception::class);
248 248
 		$object->save();
249 249
 	}
250 250
 
251 251
 
252 252
 	public function testGetSubClient()
253 253
 	{
254
-		$this->setExpectedException( \Aimeos\Admin\JQAdm\Exception::class );
255
-		$this->object->getSubClient( 'unknown' );
254
+		$this->setExpectedException(\Aimeos\Admin\JQAdm\Exception::class);
255
+		$this->object->getSubClient('unknown');
256 256
 	}
257 257
 
258 258
 
259 259
 	protected function getViewNoRender()
260 260
 	{
261
-		$view = $this->getMockBuilder( \Aimeos\MW\View\Standard::class )
262
-			->setConstructorArgs( array( [] ) )
263
-			->setMethods( array( 'render', 'config' ) )
261
+		$view = $this->getMockBuilder(\Aimeos\MW\View\Standard::class)
262
+			->setConstructorArgs(array([]))
263
+			->setMethods(array('render', 'config'))
264 264
 			->getMock();
265 265
 
266
-		$manager = \Aimeos\MShop::create( $this->context, 'supplier' );
267
-		$view->item = $manager->findItem( 'unitCode001' );
266
+		$manager = \Aimeos\MShop::create($this->context, 'supplier');
267
+		$view->item = $manager->findItem('unitCode001');
268 268
 
269 269
 		return $view;
270 270
 	}
Please login to merge, or discard this patch.
admin/jqadm/tests/Admin/JQAdm/Supplier/Text/StandardTest.php 1 patch
Spacing   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -21,75 +21,75 @@  discard block
 block discarded – undo
21 21
 		$this->view = \TestHelperJqadm::getView();
22 22
 		$this->context = \TestHelperJqadm::getContext();
23 23
 
24
-		$langManager = \Aimeos\MShop::create( $this->context, 'locale/language' );
24
+		$langManager = \Aimeos\MShop::create($this->context, 'locale/language');
25 25
 
26
-		$this->view->pageLanguages = $langManager->searchItems( $langManager->createSearch() );
27
-		$this->view->item = \Aimeos\MShop::create( $this->context, 'supplier' )->createItem();
26
+		$this->view->pageLanguages = $langManager->searchItems($langManager->createSearch());
27
+		$this->view->item = \Aimeos\MShop::create($this->context, 'supplier')->createItem();
28 28
 
29
-		$this->object = new \Aimeos\Admin\JQAdm\Supplier\Text\Standard( $this->context );
30
-		$this->object = new \Aimeos\Admin\JQAdm\Common\Decorator\Page( $this->object, $this->context );
31
-		$this->object->setAimeos( \TestHelperJqadm::getAimeos() );
32
-		$this->object->setView( $this->view );
29
+		$this->object = new \Aimeos\Admin\JQAdm\Supplier\Text\Standard($this->context);
30
+		$this->object = new \Aimeos\Admin\JQAdm\Common\Decorator\Page($this->object, $this->context);
31
+		$this->object->setAimeos(\TestHelperJqadm::getAimeos());
32
+		$this->object->setView($this->view);
33 33
 	}
34 34
 
35 35
 
36 36
 	protected function tearDown()
37 37
 	{
38
-		unset( $this->object, $this->view, $this->context );
38
+		unset($this->object, $this->view, $this->context);
39 39
 	}
40 40
 
41 41
 
42 42
 	public function testCreate()
43 43
 	{
44
-		$manager = \Aimeos\MShop::create( $this->context, 'supplier' );
44
+		$manager = \Aimeos\MShop::create($this->context, 'supplier');
45 45
 
46 46
 		$this->view->item = $manager->createItem();
47 47
 		$result = $this->object->create();
48 48
 
49
-		$this->assertContains( 'item-text', $result );
50
-		$this->assertNull( $this->view->get( 'errors' ) );
49
+		$this->assertContains('item-text', $result);
50
+		$this->assertNull($this->view->get('errors'));
51 51
 	}
52 52
 
53 53
 
54 54
 	public function testCopy()
55 55
 	{
56
-		$manager = \Aimeos\MShop::create( $this->context, 'supplier' );
56
+		$manager = \Aimeos\MShop::create($this->context, 'supplier');
57 57
 
58
-		$this->view->item = $manager->findItem( 'unitCode001', ['text'] );
58
+		$this->view->item = $manager->findItem('unitCode001', ['text']);
59 59
 		$result = $this->object->copy();
60 60
 
61
-		$this->assertNull( $this->view->get( 'errors' ) );
62
-		$this->assertContains( 'Supplier description', $result );
61
+		$this->assertNull($this->view->get('errors'));
62
+		$this->assertContains('Supplier description', $result);
63 63
 	}
64 64
 
65 65
 
66 66
 	public function testDelete()
67 67
 	{
68
-		$manager = \Aimeos\MShop::create( $this->context, 'supplier' );
68
+		$manager = \Aimeos\MShop::create($this->context, 'supplier');
69 69
 
70 70
 		$this->view->item = $manager->createItem();
71 71
 		$result = $this->object->delete();
72 72
 
73
-		$this->assertNull( $this->view->get( 'errors' ) );
74
-		$this->assertNull( $result );
73
+		$this->assertNull($this->view->get('errors'));
74
+		$this->assertNull($result);
75 75
 	}
76 76
 
77 77
 
78 78
 	public function testGet()
79 79
 	{
80
-		$manager = \Aimeos\MShop::create( $this->context, 'supplier' );
80
+		$manager = \Aimeos\MShop::create($this->context, 'supplier');
81 81
 
82
-		$this->view->item = $manager->findItem( 'unitCode001', ['text'] );
82
+		$this->view->item = $manager->findItem('unitCode001', ['text']);
83 83
 		$result = $this->object->get();
84 84
 
85
-		$this->assertNull( $this->view->get( 'errors' ) );
86
-		$this->assertContains( 'Supplier description', $result );
85
+		$this->assertNull($this->view->get('errors'));
86
+		$this->assertContains('Supplier description', $result);
87 87
 	}
88 88
 
89 89
 
90 90
 	public function testSave()
91 91
 	{
92
-		$manager = \Aimeos\MShop::create( $this->context, 'supplier' );
92
+		$manager = \Aimeos\MShop::create($this->context, 'supplier');
93 93
 		$item = $manager->createItem();
94 94
 
95 95
 		$param = array(
@@ -119,75 +119,75 @@  discard block
 block discarded – undo
119 119
 			),
120 120
 		);
121 121
 
122
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param );
123
-		$this->view->addHelper( 'param', $helper );
122
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param);
123
+		$this->view->addHelper('param', $helper);
124 124
 		$this->view->item = $item;
125 125
 
126 126
 		$result = $this->object->save();
127 127
 
128
-		$this->assertNull( $this->view->get( 'errors' ) );
129
-		$this->assertNull( $result );
130
-		$this->assertEquals( 3, count( $item->getListItems() ) );
128
+		$this->assertNull($this->view->get('errors'));
129
+		$this->assertNull($result);
130
+		$this->assertEquals(3, count($item->getListItems()));
131 131
 
132
-		foreach( $item->getListItems( 'text' ) as $listItem )
132
+		foreach ($item->getListItems('text') as $listItem)
133 133
 		{
134
-			$this->assertEquals( 'text', $listItem->getDomain() );
134
+			$this->assertEquals('text', $listItem->getDomain());
135 135
 
136 136
 			$refItem = $listItem->getRefItem();
137
-			$this->assertEquals( 'de', $refItem->getLanguageId() );
137
+			$this->assertEquals('de', $refItem->getLanguageId());
138 138
 		}
139 139
 	}
140 140
 
141 141
 
142 142
 	public function testSaveException()
143 143
 	{
144
-		$object = $this->getMockBuilder( \Aimeos\Admin\JQAdm\Supplier\Text\Standard::class )
145
-			->setConstructorArgs( array( $this->context, \TestHelperJqadm::getTemplatePaths() ) )
146
-			->setMethods( array( 'fromArray' ) )
144
+		$object = $this->getMockBuilder(\Aimeos\Admin\JQAdm\Supplier\Text\Standard::class)
145
+			->setConstructorArgs(array($this->context, \TestHelperJqadm::getTemplatePaths()))
146
+			->setMethods(array('fromArray'))
147 147
 			->getMock();
148 148
 
149
-		$object->expects( $this->once() )->method( 'fromArray' )
150
-			->will( $this->throwException( new \RuntimeException() ) );
149
+		$object->expects($this->once())->method('fromArray')
150
+			->will($this->throwException(new \RuntimeException()));
151 151
 
152 152
 		$this->view = \TestHelperJqadm::getView();
153
-		$this->view->item = \Aimeos\MShop::create( $this->context, 'supplier' )->createItem();
153
+		$this->view->item = \Aimeos\MShop::create($this->context, 'supplier')->createItem();
154 154
 
155
-		$object->setView( $this->view );
155
+		$object->setView($this->view);
156 156
 
157
-		$this->setExpectedException( \Aimeos\Admin\JQAdm\Exception::class );
157
+		$this->setExpectedException(\Aimeos\Admin\JQAdm\Exception::class);
158 158
 		$object->save();
159 159
 	}
160 160
 
161 161
 
162 162
 	public function testSaveMShopException()
163 163
 	{
164
-		$object = $this->getMockBuilder( \Aimeos\Admin\JQAdm\Supplier\Text\Standard::class )
165
-			->setConstructorArgs( array( $this->context, \TestHelperJqadm::getTemplatePaths() ) )
166
-			->setMethods( array( 'fromArray' ) )
164
+		$object = $this->getMockBuilder(\Aimeos\Admin\JQAdm\Supplier\Text\Standard::class)
165
+			->setConstructorArgs(array($this->context, \TestHelperJqadm::getTemplatePaths()))
166
+			->setMethods(array('fromArray'))
167 167
 			->getMock();
168 168
 
169
-		$object->expects( $this->once() )->method( 'fromArray' )
170
-			->will( $this->throwException( new \Aimeos\MShop\Exception() ) );
169
+		$object->expects($this->once())->method('fromArray')
170
+			->will($this->throwException(new \Aimeos\MShop\Exception()));
171 171
 
172 172
 		$this->view = \TestHelperJqadm::getView();
173
-		$this->view->item = \Aimeos\MShop::create( $this->context, 'supplier' )->createItem();
173
+		$this->view->item = \Aimeos\MShop::create($this->context, 'supplier')->createItem();
174 174
 
175
-		$object->setView( $this->view );
175
+		$object->setView($this->view);
176 176
 
177
-		$this->setExpectedException( \Aimeos\Admin\JQAdm\Exception::class );
177
+		$this->setExpectedException(\Aimeos\Admin\JQAdm\Exception::class);
178 178
 		$object->save();
179 179
 	}
180 180
 
181 181
 
182 182
 	public function testSearch()
183 183
 	{
184
-		$this->assertNull( $this->object->search() );
184
+		$this->assertNull($this->object->search());
185 185
 	}
186 186
 
187 187
 
188 188
 	public function testGetSubClient()
189 189
 	{
190
-		$this->setExpectedException( \Aimeos\Admin\JQAdm\Exception::class );
191
-		$this->object->getSubClient( 'unknown' );
190
+		$this->setExpectedException(\Aimeos\Admin\JQAdm\Exception::class);
191
+		$this->object->getSubClient('unknown');
192 192
 	}
193 193
 }
Please login to merge, or discard this patch.
admin/jqadm/tests/Admin/JQAdm/Subscription/StandardTest.php 1 patch
Spacing   +95 added lines, -95 removed lines patch added patch discarded remove patch
@@ -21,16 +21,16 @@  discard block
 block discarded – undo
21 21
 		$this->view = \TestHelperJqadm::getView();
22 22
 		$this->context = \TestHelperJqadm::getContext();
23 23
 
24
-		$this->object = new \Aimeos\Admin\JQAdm\Subscription\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 );
24
+		$this->object = new \Aimeos\Admin\JQAdm\Subscription\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 28
 	}
29 29
 
30 30
 
31 31
 	protected function tearDown()
32 32
 	{
33
-		unset( $this->object, $this->view, $this->context );
33
+		unset($this->object, $this->view, $this->context);
34 34
 	}
35 35
 
36 36
 
@@ -42,10 +42,10 @@  discard block
 block discarded – undo
42 42
 
43 43
 	public function testCreateException()
44 44
 	{
45
-		$object = $this->getClientMock( 'getSubClients' );
45
+		$object = $this->getClientMock('getSubClients');
46 46
 
47
-		$object->expects( $this->once() )->method( 'getSubClients' )
48
-			->will( $this->throwException( new \RuntimeException() ) );
47
+		$object->expects($this->once())->method('getSubClients')
48
+			->will($this->throwException(new \RuntimeException()));
49 49
 
50 50
 		$object->create();
51 51
 	}
@@ -53,10 +53,10 @@  discard block
 block discarded – undo
53 53
 
54 54
 	public function testCreateMShopException()
55 55
 	{
56
-		$object = $this->getClientMock( 'getSubClients' );
56
+		$object = $this->getClientMock('getSubClients');
57 57
 
58
-		$object->expects( $this->once() )->method( 'getSubClients' )
59
-			->will( $this->throwException( new \Aimeos\MShop\Exception() ) );
58
+		$object->expects($this->once())->method('getSubClients')
59
+			->will($this->throwException(new \Aimeos\MShop\Exception()));
60 60
 
61 61
 		$object->create();
62 62
 	}
@@ -64,24 +64,24 @@  discard block
 block discarded – undo
64 64
 
65 65
 	public function testCopy()
66 66
 	{
67
-		$manager = \Aimeos\MShop::create( $this->context, 'subscription' );
67
+		$manager = \Aimeos\MShop::create($this->context, 'subscription');
68 68
 
69 69
 		$param = ['site' => 'unittest', 'id' => $this->getSubscriptionId()];
70
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param );
71
-		$this->view->addHelper( 'param', $helper );
70
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param);
71
+		$this->view->addHelper('param', $helper);
72 72
 
73 73
 		$result = $this->object->copy();
74 74
 
75
-		$this->assertContains( '2010-01-01', $result );
75
+		$this->assertContains('2010-01-01', $result);
76 76
 	}
77 77
 
78 78
 
79 79
 	public function testCopyException()
80 80
 	{
81
-		$object = $this->getClientMock( 'getSubClients' );
81
+		$object = $this->getClientMock('getSubClients');
82 82
 
83
-		$object->expects( $this->once() )->method( 'getSubClients' )
84
-			->will( $this->throwException( new \RuntimeException() ) );
83
+		$object->expects($this->once())->method('getSubClients')
84
+			->will($this->throwException(new \RuntimeException()));
85 85
 
86 86
 		$object->copy();
87 87
 	}
@@ -89,10 +89,10 @@  discard block
 block discarded – undo
89 89
 
90 90
 	public function testCopyMShopException()
91 91
 	{
92
-		$object = $this->getClientMock( 'getSubClients' );
92
+		$object = $this->getClientMock('getSubClients');
93 93
 
94
-		$object->expects( $this->once() )->method( 'getSubClients' )
95
-			->will( $this->throwException( new \Aimeos\MShop\Exception() ) );
94
+		$object->expects($this->once())->method('getSubClients')
95
+			->will($this->throwException(new \Aimeos\MShop\Exception()));
96 96
 
97 97
 		$object->copy();
98 98
 	}
@@ -100,16 +100,16 @@  discard block
 block discarded – undo
100 100
 
101 101
 	public function testDelete()
102 102
 	{
103
-		$this->assertNotNull( $this->object->delete() );
103
+		$this->assertNotNull($this->object->delete());
104 104
 	}
105 105
 
106 106
 
107 107
 	public function testDeleteException()
108 108
 	{
109
-		$object = $this->getClientMock( 'getSubClients' );
109
+		$object = $this->getClientMock('getSubClients');
110 110
 
111
-		$object->expects( $this->exactly( 2 ) )->method( 'getSubClients' )
112
-			->will( $this->throwException( new \RuntimeException() ) );
111
+		$object->expects($this->exactly(2))->method('getSubClients')
112
+			->will($this->throwException(new \RuntimeException()));
113 113
 
114 114
 		$object->delete();
115 115
 	}
@@ -117,10 +117,10 @@  discard block
 block discarded – undo
117 117
 
118 118
 	public function testDeleteMShopException()
119 119
 	{
120
-		$object = $this->getClientMock( 'getSubClients' );
120
+		$object = $this->getClientMock('getSubClients');
121 121
 
122
-		$object->expects( $this->exactly( 2 ) )->method( 'getSubClients' )
123
-			->will( $this->throwException( new \Aimeos\MShop\Exception() ) );
122
+		$object->expects($this->exactly(2))->method('getSubClients')
123
+			->will($this->throwException(new \Aimeos\MShop\Exception()));
124 124
 
125 125
 		$object->delete();
126 126
 	}
@@ -128,24 +128,24 @@  discard block
 block discarded – undo
128 128
 
129 129
 	public function testGet()
130 130
 	{
131
-		$manager = \Aimeos\MShop::create( $this->context, 'subscription' );
131
+		$manager = \Aimeos\MShop::create($this->context, 'subscription');
132 132
 
133 133
 		$param = ['site' => 'unittest', 'id' => $this->getSubscriptionId()];
134
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param );
135
-		$this->view->addHelper( 'param', $helper );
134
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param);
135
+		$this->view->addHelper('param', $helper);
136 136
 
137 137
 		$result = $this->object->get();
138 138
 
139
-		$this->assertContains( '2010-01-01', $result );
139
+		$this->assertContains('2010-01-01', $result);
140 140
 	}
141 141
 
142 142
 
143 143
 	public function testGetException()
144 144
 	{
145
-		$object = $this->getClientMock( 'getSubClients' );
145
+		$object = $this->getClientMock('getSubClients');
146 146
 
147
-		$object->expects( $this->once() )->method( 'getSubClients' )
148
-			->will( $this->throwException( new \RuntimeException() ) );
147
+		$object->expects($this->once())->method('getSubClients')
148
+			->will($this->throwException(new \RuntimeException()));
149 149
 
150 150
 		$object->get();
151 151
 	}
@@ -153,10 +153,10 @@  discard block
 block discarded – undo
153 153
 
154 154
 	public function testGetMShopException()
155 155
 	{
156
-		$object = $this->getClientMock( 'getSubClients' );
156
+		$object = $this->getClientMock('getSubClients');
157 157
 
158
-		$object->expects( $this->once() )->method( 'getSubClients' )
159
-			->will( $this->throwException( new \Aimeos\MShop\Exception() ) );
158
+		$object->expects($this->once())->method('getSubClients')
159
+			->will($this->throwException(new \Aimeos\MShop\Exception()));
160 160
 
161 161
 		$object->get();
162 162
 	}
@@ -164,23 +164,23 @@  discard block
 block discarded – undo
164 164
 
165 165
 	public function testGetViewException()
166 166
 	{
167
-		$object = new \Aimeos\Admin\JQAdm\Subscription\Standard( $this->context, [] );
167
+		$object = new \Aimeos\Admin\JQAdm\Subscription\Standard($this->context, []);
168 168
 
169
-		$this->setExpectedException( \Aimeos\Admin\JQAdm\Exception::class );
169
+		$this->setExpectedException(\Aimeos\Admin\JQAdm\Exception::class);
170 170
 		$object->getView();
171 171
 	}
172 172
 
173 173
 
174 174
 	public function testSave()
175 175
 	{
176
-		$manager = \Aimeos\MShop::create( $this->context, 'order/base/product' );
177
-		$items = $manager->searchItems( $manager->createSearch()->setSlice( 0, 1 ) );
176
+		$manager = \Aimeos\MShop::create($this->context, 'order/base/product');
177
+		$items = $manager->searchItems($manager->createSearch()->setSlice(0, 1));
178 178
 
179
-		if( ( $item = reset( $items ) ) === false ) {
180
-			throw new \Exception( 'No order product item found' );
179
+		if (($item = reset($items)) === false) {
180
+			throw new \Exception('No order product item found');
181 181
 		}
182 182
 
183
-		$manager = \Aimeos\MShop::create( $this->context, 'subscription' );
183
+		$manager = \Aimeos\MShop::create($this->context, 'subscription');
184 184
 
185 185
 		$param = array(
186 186
 			'site' => 'unittest',
@@ -195,21 +195,21 @@  discard block
 block discarded – undo
195 195
 			),
196 196
 		);
197 197
 
198
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param );
199
-		$this->view->addHelper( 'param', $helper );
198
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param);
199
+		$this->view->addHelper('param', $helper);
200 200
 
201 201
 		$this->object->save();
202 202
 
203
-		$manager->deleteItem( $this->getSubscriptionId( '2006-06-06' ) );
203
+		$manager->deleteItem($this->getSubscriptionId('2006-06-06'));
204 204
 	}
205 205
 
206 206
 
207 207
 	public function testSaveException()
208 208
 	{
209
-		$object = $this->getClientMock( 'fromArray' );
209
+		$object = $this->getClientMock('fromArray');
210 210
 
211
-		$object->expects( $this->once() )->method( 'fromArray' )
212
-			->will( $this->throwException( new \RuntimeException() ) );
211
+		$object->expects($this->once())->method('fromArray')
212
+			->will($this->throwException(new \RuntimeException()));
213 213
 
214 214
 		$object->save();
215 215
 	}
@@ -217,10 +217,10 @@  discard block
 block discarded – undo
217 217
 
218 218
 	public function testSaveMShopException()
219 219
 	{
220
-		$object = $this->getClientMock( 'fromArray' );
220
+		$object = $this->getClientMock('fromArray');
221 221
 
222
-		$object->expects( $this->once() )->method( 'fromArray' )
223
-			->will( $this->throwException( new \RuntimeException() ) );
222
+		$object->expects($this->once())->method('fromArray')
223
+			->will($this->throwException(new \RuntimeException()));
224 224
 
225 225
 		$object->save();
226 226
 	}
@@ -228,10 +228,10 @@  discard block
 block discarded – undo
228 228
 
229 229
 	public function testSaveJQAdmException()
230 230
 	{
231
-		$object = $this->getClientMock( 'fromArray' );
231
+		$object = $this->getClientMock('fromArray');
232 232
 
233
-		$object->expects( $this->once() )->method( 'fromArray' )
234
-			->will( $this->throwException( new \RuntimeException() ) );
233
+		$object->expects($this->once())->method('fromArray')
234
+			->will($this->throwException(new \RuntimeException()));
235 235
 
236 236
 		$object->save();
237 237
 	}
@@ -242,27 +242,27 @@  discard block
 block discarded – undo
242 242
 		$param = array(
243 243
 			'site' => 'unittest', 'lang' => 'de',
244 244
 			'filter' => array(
245
-				'key' => array( 0 => 'subscription.dateend' ),
246
-				'op' => array( 0 => '>=' ),
247
-				'val' => array( 0 => '2010-01-01' ),
245
+				'key' => array(0 => 'subscription.dateend'),
246
+				'op' => array(0 => '>='),
247
+				'val' => array(0 => '2010-01-01'),
248 248
 			),
249
-			'sort' => array( 'subscription.datenext', '-subscription.id' ),
249
+			'sort' => array('subscription.datenext', '-subscription.id'),
250 250
 		);
251
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param );
252
-		$this->view->addHelper( 'param', $helper );
251
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param);
252
+		$this->view->addHelper('param', $helper);
253 253
 
254 254
 		$result = $this->object->search();
255 255
 
256
-		$this->assertContains( '2010-01-01', $result );
256
+		$this->assertContains('2010-01-01', $result);
257 257
 	}
258 258
 
259 259
 
260 260
 	public function testSearchException()
261 261
 	{
262
-		$object = $this->getClientMock( 'initCriteria' );
262
+		$object = $this->getClientMock('initCriteria');
263 263
 
264
-		$object->expects( $this->once() )->method( 'initCriteria' )
265
-			->will( $this->throwException( new \RuntimeException() ) );
264
+		$object->expects($this->once())->method('initCriteria')
265
+			->will($this->throwException(new \RuntimeException()));
266 266
 
267 267
 		$object->search();
268 268
 	}
@@ -270,10 +270,10 @@  discard block
 block discarded – undo
270 270
 
271 271
 	public function testSearchMShopException()
272 272
 	{
273
-		$object = $this->getClientMock( 'initCriteria' );
273
+		$object = $this->getClientMock('initCriteria');
274 274
 
275
-		$object->expects( $this->once() )->method( 'initCriteria' )
276
-			->will( $this->throwException( new \Aimeos\MShop\Exception() ) );
275
+		$object->expects($this->once())->method('initCriteria')
276
+			->will($this->throwException(new \Aimeos\MShop\Exception()));
277 277
 
278 278
 		$object->search();
279 279
 	}
@@ -281,27 +281,27 @@  discard block
 block discarded – undo
281 281
 
282 282
 	public function testGetSubClientInvalid()
283 283
 	{
284
-		$this->setExpectedException( \Aimeos\Admin\JQAdm\Exception::class );
285
-		$this->object->getSubClient( '$unknown$' );
284
+		$this->setExpectedException(\Aimeos\Admin\JQAdm\Exception::class);
285
+		$this->object->getSubClient('$unknown$');
286 286
 	}
287 287
 
288 288
 
289 289
 	public function testGetSubClientUnknown()
290 290
 	{
291
-		$this->setExpectedException( \Aimeos\Admin\JQAdm\Exception::class );
292
-		$this->object->getSubClient( 'unknown' );
291
+		$this->setExpectedException(\Aimeos\Admin\JQAdm\Exception::class);
292
+		$this->object->getSubClient('unknown');
293 293
 	}
294 294
 
295 295
 
296
-	public function getClientMock( $method )
296
+	public function getClientMock($method)
297 297
 	{
298
-		$object = $this->getMockBuilder( \Aimeos\Admin\JQAdm\Subscription\Standard::class )
299
-			->setConstructorArgs( array( $this->context, \TestHelperJqadm::getTemplatePaths() ) )
300
-			->setMethods( [$method] )
298
+		$object = $this->getMockBuilder(\Aimeos\Admin\JQAdm\Subscription\Standard::class)
299
+			->setConstructorArgs(array($this->context, \TestHelperJqadm::getTemplatePaths()))
300
+			->setMethods([$method])
301 301
 			->getMock();
302 302
 
303
-		$object->setAimeos( \TestHelperJqadm::getAimeos() );
304
-		$object->setView( $this->getViewNoRender() );
303
+		$object->setAimeos(\TestHelperJqadm::getAimeos());
304
+		$object->setView($this->getViewNoRender());
305 305
 
306 306
 		return $object;
307 307
 	}
@@ -309,33 +309,33 @@  discard block
 block discarded – undo
309 309
 
310 310
 	protected function getViewNoRender()
311 311
 	{
312
-		$view = $this->getMockBuilder( \Aimeos\MW\View\Standard::class )
313
-			->setConstructorArgs( array( [] ) )
314
-			->setMethods( array( 'render', 'config' ) )
312
+		$view = $this->getMockBuilder(\Aimeos\MW\View\Standard::class)
313
+			->setConstructorArgs(array([]))
314
+			->setMethods(array('render', 'config'))
315 315
 			->getMock();
316 316
 
317
-		$manager = \Aimeos\MShop::create( $this->context, 'subscription' );
317
+		$manager = \Aimeos\MShop::create($this->context, 'subscription');
318 318
 
319 319
 		$param = ['site' => 'unittest', 'id' => $this->getSubscriptionId()];
320
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $view, $param );
321
-		$view->addHelper( 'param', $helper );
320
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($view, $param);
321
+		$view->addHelper('param', $helper);
322 322
 
323
-		$helper = new \Aimeos\MW\View\Helper\Access\Standard( $view, [] );
324
-		$view->addHelper( 'access', $helper );
323
+		$helper = new \Aimeos\MW\View\Helper\Access\Standard($view, []);
324
+		$view->addHelper('access', $helper);
325 325
 
326 326
 		return $view;
327 327
 	}
328 328
 
329 329
 
330
-	protected function getSubscriptionId( $end = '2010-01-01' )
330
+	protected function getSubscriptionId($end = '2010-01-01')
331 331
 	{
332
-		$manager = \Aimeos\MShop::create( $this->context, 'subscription' );
333
-		$search = $manager->createSearch()->setSlice( 0, 1 );
334
-		$search->setConditions( $search->compare( '==', 'subscription.dateend', $end ) );
335
-		$items = $manager->searchItems( $search );
332
+		$manager = \Aimeos\MShop::create($this->context, 'subscription');
333
+		$search = $manager->createSearch()->setSlice(0, 1);
334
+		$search->setConditions($search->compare('==', 'subscription.dateend', $end));
335
+		$items = $manager->searchItems($search);
336 336
 
337
-		if( ( $item = reset( $items ) ) === false ) {
338
-			throw new \Exception( sprintf( 'No subscription item found for end date "%1$s"', $end ) );
337
+		if (($item = reset($items)) === false) {
338
+			throw new \Exception(sprintf('No subscription item found for end date "%1$s"', $end));
339 339
 		}
340 340
 
341 341
 		return $item->getId();
Please login to merge, or discard this patch.
admin/jqadm/tests/Admin/JQAdm/Plugin/StandardTest.php 1 patch
Spacing   +90 added lines, -90 removed lines patch added patch discarded remove patch
@@ -21,16 +21,16 @@  discard block
 block discarded – undo
21 21
 		$this->view = \TestHelperJqadm::getView();
22 22
 		$this->context = \TestHelperJqadm::getContext();
23 23
 
24
-		$this->object = new \Aimeos\Admin\JQAdm\Plugin\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 );
24
+		$this->object = new \Aimeos\Admin\JQAdm\Plugin\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 28
 	}
29 29
 
30 30
 
31 31
 	protected function tearDown()
32 32
 	{
33
-		unset( $this->object, $this->view, $this->context );
33
+		unset($this->object, $this->view, $this->context);
34 34
 	}
35 35
 
36 36
 
@@ -42,10 +42,10 @@  discard block
 block discarded – undo
42 42
 
43 43
 	public function testCreateException()
44 44
 	{
45
-		$object = $this->getClientMock( 'getSubClients' );
45
+		$object = $this->getClientMock('getSubClients');
46 46
 
47
-		$object->expects( $this->once() )->method( 'getSubClients' )
48
-			->will( $this->throwException( new \RuntimeException() ) );
47
+		$object->expects($this->once())->method('getSubClients')
48
+			->will($this->throwException(new \RuntimeException()));
49 49
 
50 50
 		$object->create();
51 51
 	}
@@ -53,10 +53,10 @@  discard block
 block discarded – undo
53 53
 
54 54
 	public function testCreateMShopException()
55 55
 	{
56
-		$object = $this->getClientMock( 'getSubClients' );
56
+		$object = $this->getClientMock('getSubClients');
57 57
 
58
-		$object->expects( $this->once() )->method( 'getSubClients' )
59
-			->will( $this->throwException( new \Aimeos\MShop\Exception() ) );
58
+		$object->expects($this->once())->method('getSubClients')
59
+			->will($this->throwException(new \Aimeos\MShop\Exception()));
60 60
 
61 61
 		$object->create();
62 62
 	}
@@ -65,21 +65,21 @@  discard block
 block discarded – undo
65 65
 	public function testCopy()
66 66
 	{
67 67
 		$param = ['site' => 'unittest', 'id' => $this->getItem()->getId()];
68
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param );
69
-		$this->view->addHelper( 'param', $helper );
68
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param);
69
+		$this->view->addHelper('param', $helper);
70 70
 
71 71
 		$result = $this->object->copy();
72 72
 
73
-		$this->assertContains( 'Shipping-Plugin', $result );
73
+		$this->assertContains('Shipping-Plugin', $result);
74 74
 	}
75 75
 
76 76
 
77 77
 	public function testCopyException()
78 78
 	{
79
-		$object = $this->getClientMock( 'getSubClients' );
79
+		$object = $this->getClientMock('getSubClients');
80 80
 
81
-		$object->expects( $this->once() )->method( 'getSubClients' )
82
-			->will( $this->throwException( new \RuntimeException() ) );
81
+		$object->expects($this->once())->method('getSubClients')
82
+			->will($this->throwException(new \RuntimeException()));
83 83
 
84 84
 		$object->copy();
85 85
 	}
@@ -87,10 +87,10 @@  discard block
 block discarded – undo
87 87
 
88 88
 	public function testCopyMShopException()
89 89
 	{
90
-		$object = $this->getClientMock( 'getSubClients' );
90
+		$object = $this->getClientMock('getSubClients');
91 91
 
92
-		$object->expects( $this->once() )->method( 'getSubClients' )
93
-			->will( $this->throwException( new \Aimeos\MShop\Exception() ) );
92
+		$object->expects($this->once())->method('getSubClients')
93
+			->will($this->throwException(new \Aimeos\MShop\Exception()));
94 94
 
95 95
 		$object->copy();
96 96
 	}
@@ -98,16 +98,16 @@  discard block
 block discarded – undo
98 98
 
99 99
 	public function testDelete()
100 100
 	{
101
-		$this->assertNotNull( $this->object->delete() );
101
+		$this->assertNotNull($this->object->delete());
102 102
 	}
103 103
 
104 104
 
105 105
 	public function testDeleteException()
106 106
 	{
107
-		$object = $this->getClientMock( 'getSubClients' );
107
+		$object = $this->getClientMock('getSubClients');
108 108
 
109
-		$object->expects( $this->exactly( 2 ) )->method( 'getSubClients' )
110
-			->will( $this->throwException( new \RuntimeException() ) );
109
+		$object->expects($this->exactly(2))->method('getSubClients')
110
+			->will($this->throwException(new \RuntimeException()));
111 111
 
112 112
 		$object->delete();
113 113
 	}
@@ -115,10 +115,10 @@  discard block
 block discarded – undo
115 115
 
116 116
 	public function testDeleteMShopException()
117 117
 	{
118
-		$object = $this->getClientMock( 'getSubClients' );
118
+		$object = $this->getClientMock('getSubClients');
119 119
 
120
-		$object->expects( $this->exactly( 2 ) )->method( 'getSubClients' )
121
-			->will( $this->throwException( new \Aimeos\MShop\Exception() ) );
120
+		$object->expects($this->exactly(2))->method('getSubClients')
121
+			->will($this->throwException(new \Aimeos\MShop\Exception()));
122 122
 
123 123
 		$object->delete();
124 124
 	}
@@ -127,21 +127,21 @@  discard block
 block discarded – undo
127 127
 	public function testGet()
128 128
 	{
129 129
 		$param = ['site' => 'unittest', 'id' => $this->getItem()->getId()];
130
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param );
131
-		$this->view->addHelper( 'param', $helper );
130
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param);
131
+		$this->view->addHelper('param', $helper);
132 132
 
133 133
 		$result = $this->object->get();
134 134
 
135
-		$this->assertContains( 'Shipping-Plugin', $result );
135
+		$this->assertContains('Shipping-Plugin', $result);
136 136
 	}
137 137
 
138 138
 
139 139
 	public function testGetException()
140 140
 	{
141
-		$object = $this->getClientMock( 'getSubClients' );
141
+		$object = $this->getClientMock('getSubClients');
142 142
 
143
-		$object->expects( $this->once() )->method( 'getSubClients' )
144
-			->will( $this->throwException( new \RuntimeException() ) );
143
+		$object->expects($this->once())->method('getSubClients')
144
+			->will($this->throwException(new \RuntimeException()));
145 145
 
146 146
 		$object->get();
147 147
 	}
@@ -149,10 +149,10 @@  discard block
 block discarded – undo
149 149
 
150 150
 	public function testGetMShopException()
151 151
 	{
152
-		$object = $this->getClientMock( 'getSubClients' );
152
+		$object = $this->getClientMock('getSubClients');
153 153
 
154
-		$object->expects( $this->once() )->method( 'getSubClients' )
155
-			->will( $this->throwException( new \Aimeos\MShop\Exception() ) );
154
+		$object->expects($this->once())->method('getSubClients')
155
+			->will($this->throwException(new \Aimeos\MShop\Exception()));
156 156
 
157 157
 		$object->get();
158 158
 	}
@@ -160,16 +160,16 @@  discard block
 block discarded – undo
160 160
 
161 161
 	public function testGetViewException()
162 162
 	{
163
-		$object = new \Aimeos\Admin\JQAdm\Plugin\Standard( $this->context, [] );
163
+		$object = new \Aimeos\Admin\JQAdm\Plugin\Standard($this->context, []);
164 164
 
165
-		$this->setExpectedException( \Aimeos\Admin\JQAdm\Exception::class );
165
+		$this->setExpectedException(\Aimeos\Admin\JQAdm\Exception::class);
166 166
 		$object->getView();
167 167
 	}
168 168
 
169 169
 
170 170
 	public function testSave()
171 171
 	{
172
-		$manager = \Aimeos\MShop::create( $this->context, 'plugin' );
172
+		$manager = \Aimeos\MShop::create($this->context, 'plugin');
173 173
 
174 174
 		$param = array(
175 175
 			'site' => 'unittest',
@@ -180,27 +180,27 @@  discard block
 block discarded – undo
180 180
 				'plugin.label' => 'test label',
181 181
 				'plugin.position' => '2',
182 182
 				'config' => array(
183
-					'key' => array( 0 => 'test key' ),
184
-					'val' => array( 0 => 'test value' ),
183
+					'key' => array(0 => 'test key'),
184
+					'val' => array(0 => 'test value'),
185 185
 				),
186 186
 			),
187 187
 		);
188 188
 
189
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param );
190
-		$this->view->addHelper( 'param', $helper );
189
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param);
190
+		$this->view->addHelper('param', $helper);
191 191
 
192 192
 		$this->object->save();
193 193
 
194
-		$manager->deleteItem( $this->getItem( 'test label' )->getId() );
194
+		$manager->deleteItem($this->getItem('test label')->getId());
195 195
 	}
196 196
 
197 197
 
198 198
 	public function testSaveException()
199 199
 	{
200
-		$object = $this->getClientMock( 'fromArray' );
200
+		$object = $this->getClientMock('fromArray');
201 201
 
202
-		$object->expects( $this->once() )->method( 'fromArray' )
203
-			->will( $this->throwException( new \RuntimeException() ) );
202
+		$object->expects($this->once())->method('fromArray')
203
+			->will($this->throwException(new \RuntimeException()));
204 204
 
205 205
 		$object->save();
206 206
 	}
@@ -208,10 +208,10 @@  discard block
 block discarded – undo
208 208
 
209 209
 	public function testSaveMShopException()
210 210
 	{
211
-		$object = $this->getClientMock( 'fromArray' );
211
+		$object = $this->getClientMock('fromArray');
212 212
 
213
-		$object->expects( $this->once() )->method( 'fromArray' )
214
-			->will( $this->throwException( new \RuntimeException() ) );
213
+		$object->expects($this->once())->method('fromArray')
214
+			->will($this->throwException(new \RuntimeException()));
215 215
 
216 216
 		$object->save();
217 217
 	}
@@ -219,10 +219,10 @@  discard block
 block discarded – undo
219 219
 
220 220
 	public function testSaveJQAdmException()
221 221
 	{
222
-		$object = $this->getClientMock( 'fromArray' );
222
+		$object = $this->getClientMock('fromArray');
223 223
 
224
-		$object->expects( $this->once() )->method( 'fromArray' )
225
-			->will( $this->throwException( new \RuntimeException() ) );
224
+		$object->expects($this->once())->method('fromArray')
225
+			->will($this->throwException(new \RuntimeException()));
226 226
 
227 227
 		$object->save();
228 228
 	}
@@ -233,27 +233,27 @@  discard block
 block discarded – undo
233 233
 		$param = array(
234 234
 			'site' => 'unittest', 'lang' => 'de',
235 235
 			'filter' => array(
236
-				'key' => array( 0 => 'plugin.label' ),
237
-				'op' => array( 0 => '==' ),
238
-				'val' => array( 0 => 'Shipping-Plugin' ),
236
+				'key' => array(0 => 'plugin.label'),
237
+				'op' => array(0 => '=='),
238
+				'val' => array(0 => 'Shipping-Plugin'),
239 239
 			),
240
-			'sort' => array( 'plugin.label', '-plugin.id' ),
240
+			'sort' => array('plugin.label', '-plugin.id'),
241 241
 		);
242
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param );
243
-		$this->view->addHelper( 'param', $helper );
242
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param);
243
+		$this->view->addHelper('param', $helper);
244 244
 
245 245
 		$result = $this->object->search();
246 246
 
247
-		$this->assertContains( '>Shipping-Plugin<', $result );
247
+		$this->assertContains('>Shipping-Plugin<', $result);
248 248
 	}
249 249
 
250 250
 
251 251
 	public function testSearchException()
252 252
 	{
253
-		$object = $this->getClientMock( 'initCriteria' );
253
+		$object = $this->getClientMock('initCriteria');
254 254
 
255
-		$object->expects( $this->once() )->method( 'initCriteria' )
256
-			->will( $this->throwException( new \RuntimeException() ) );
255
+		$object->expects($this->once())->method('initCriteria')
256
+			->will($this->throwException(new \RuntimeException()));
257 257
 
258 258
 		$object->search();
259 259
 	}
@@ -261,10 +261,10 @@  discard block
 block discarded – undo
261 261
 
262 262
 	public function testSearchMShopException()
263 263
 	{
264
-		$object = $this->getClientMock( 'initCriteria' );
264
+		$object = $this->getClientMock('initCriteria');
265 265
 
266
-		$object->expects( $this->once() )->method( 'initCriteria' )
267
-			->will( $this->throwException( new \Aimeos\MShop\Exception() ) );
266
+		$object->expects($this->once())->method('initCriteria')
267
+			->will($this->throwException(new \Aimeos\MShop\Exception()));
268 268
 
269 269
 		$object->search();
270 270
 	}
@@ -272,27 +272,27 @@  discard block
 block discarded – undo
272 272
 
273 273
 	public function testGetSubClientInvalid()
274 274
 	{
275
-		$this->setExpectedException( \Aimeos\Admin\JQAdm\Exception::class );
276
-		$this->object->getSubClient( '$unknown$' );
275
+		$this->setExpectedException(\Aimeos\Admin\JQAdm\Exception::class);
276
+		$this->object->getSubClient('$unknown$');
277 277
 	}
278 278
 
279 279
 
280 280
 	public function testGetSubClientUnknown()
281 281
 	{
282
-		$this->setExpectedException( \Aimeos\Admin\JQAdm\Exception::class );
283
-		$this->object->getSubClient( 'unknown' );
282
+		$this->setExpectedException(\Aimeos\Admin\JQAdm\Exception::class);
283
+		$this->object->getSubClient('unknown');
284 284
 	}
285 285
 
286 286
 
287
-	public function getClientMock( $method )
287
+	public function getClientMock($method)
288 288
 	{
289
-		$object = $this->getMockBuilder( \Aimeos\Admin\JQAdm\Plugin\Standard::class )
290
-			->setConstructorArgs( array( $this->context, \TestHelperJqadm::getTemplatePaths() ) )
291
-			->setMethods( [$method] )
289
+		$object = $this->getMockBuilder(\Aimeos\Admin\JQAdm\Plugin\Standard::class)
290
+			->setConstructorArgs(array($this->context, \TestHelperJqadm::getTemplatePaths()))
291
+			->setMethods([$method])
292 292
 			->getMock();
293 293
 
294
-		$object->setAimeos( \TestHelperJqadm::getAimeos() );
295
-		$object->setView( $this->getViewNoRender() );
294
+		$object->setAimeos(\TestHelperJqadm::getAimeos());
295
+		$object->setView($this->getViewNoRender());
296 296
 
297 297
 		return $object;
298 298
 	}
@@ -300,34 +300,34 @@  discard block
 block discarded – undo
300 300
 
301 301
 	protected function getViewNoRender()
302 302
 	{
303
-		$view = $this->getMockBuilder( \Aimeos\MW\View\Standard::class )
304
-			->setConstructorArgs( array( [] ) )
305
-			->setMethods( array( 'render', 'config' ) )
303
+		$view = $this->getMockBuilder(\Aimeos\MW\View\Standard::class)
304
+			->setConstructorArgs(array([]))
305
+			->setMethods(array('render', 'config'))
306 306
 			->getMock();
307 307
 
308 308
 		$param = ['site' => 'unittest', 'id' => $this->getItem()->getId()];
309
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $view, $param );
310
-		$view->addHelper( 'param', $helper );
309
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($view, $param);
310
+		$view->addHelper('param', $helper);
311 311
 
312
-		$helper = new \Aimeos\MW\View\Helper\Access\Standard( $view, [] );
313
-		$view->addHelper( 'access', $helper );
312
+		$helper = new \Aimeos\MW\View\Helper\Access\Standard($view, []);
313
+		$view->addHelper('access', $helper);
314 314
 
315 315
 		return $view;
316 316
 	}
317 317
 
318 318
 
319
-	protected function getItem( $label = 'Shipping-Plugin' )
319
+	protected function getItem($label = 'Shipping-Plugin')
320 320
 	{
321
-		$manager = \Aimeos\MShop::create( $this->context, 'plugin' );
321
+		$manager = \Aimeos\MShop::create($this->context, 'plugin');
322 322
 
323 323
 		$search = $manager->createSearch();
324
-		$search->setConditions( $search->compare( '==', 'plugin.label', $label ) );
325
-		$search->setSlice( 0, 1 );
324
+		$search->setConditions($search->compare('==', 'plugin.label', $label));
325
+		$search->setSlice(0, 1);
326 326
 
327
-		$items = $manager->searchItems( $search );
327
+		$items = $manager->searchItems($search);
328 328
 
329
-		if( ( $item = reset( $items ) ) === false ) {
330
-			throw new \Exception( sprintf( 'No plugin with label "%1$s" found', $label ) );
329
+		if (($item = reset($items)) === false) {
330
+			throw new \Exception(sprintf('No plugin with label "%1$s" found', $label));
331 331
 		}
332 332
 
333 333
 		return $item;
Please login to merge, or discard this patch.
admin/jqadm/tests/Admin/JQAdm/Group/StandardTest.php 1 patch
Spacing   +120 added lines, -120 removed lines patch added patch discarded remove patch
@@ -21,16 +21,16 @@  discard block
 block discarded – undo
21 21
 		$this->view = \TestHelperJqadm::getView();
22 22
 		$this->context = \TestHelperJqadm::getContext();
23 23
 
24
-		$this->object = new \Aimeos\Admin\JQAdm\Group\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 );
24
+		$this->object = new \Aimeos\Admin\JQAdm\Group\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 28
 	}
29 29
 
30 30
 
31 31
 	protected function tearDown()
32 32
 	{
33
-		unset( $this->object, $this->view, $this->context );
33
+		unset($this->object, $this->view, $this->context);
34 34
 	}
35 35
 
36 36
 
@@ -42,15 +42,15 @@  discard block
 block discarded – undo
42 42
 
43 43
 	public function testCreateException()
44 44
 	{
45
-		$object = $this->getMockBuilder( \Aimeos\Admin\JQAdm\Group\Standard::class )
46
-			->setConstructorArgs( array( $this->context, \TestHelperJqadm::getTemplatePaths() ) )
47
-			->setMethods( array( 'getSubClients' ) )
45
+		$object = $this->getMockBuilder(\Aimeos\Admin\JQAdm\Group\Standard::class)
46
+			->setConstructorArgs(array($this->context, \TestHelperJqadm::getTemplatePaths()))
47
+			->setMethods(array('getSubClients'))
48 48
 			->getMock();
49 49
 
50
-		$object->expects( $this->once() )->method( 'getSubClients' )
51
-			->will( $this->throwException( new \RuntimeException() ) );
50
+		$object->expects($this->once())->method('getSubClients')
51
+			->will($this->throwException(new \RuntimeException()));
52 52
 
53
-		$object->setView( $this->getViewNoRender() );
53
+		$object->setView($this->getViewNoRender());
54 54
 
55 55
 		$object->create();
56 56
 	}
@@ -58,15 +58,15 @@  discard block
 block discarded – undo
58 58
 
59 59
 	public function testCreateMShopException()
60 60
 	{
61
-		$object = $this->getMockBuilder( \Aimeos\Admin\JQAdm\Group\Standard::class )
62
-			->setConstructorArgs( array( $this->context, \TestHelperJqadm::getTemplatePaths() ) )
63
-			->setMethods( array( 'getSubClients' ) )
61
+		$object = $this->getMockBuilder(\Aimeos\Admin\JQAdm\Group\Standard::class)
62
+			->setConstructorArgs(array($this->context, \TestHelperJqadm::getTemplatePaths()))
63
+			->setMethods(array('getSubClients'))
64 64
 			->getMock();
65 65
 
66
-		$object->expects( $this->once() )->method( 'getSubClients' )
67
-			->will( $this->throwException( new \Aimeos\MShop\Exception() ) );
66
+		$object->expects($this->once())->method('getSubClients')
67
+			->will($this->throwException(new \Aimeos\MShop\Exception()));
68 68
 
69
-		$object->setView( $this->getViewNoRender() );
69
+		$object->setView($this->getViewNoRender());
70 70
 
71 71
 		$object->create();
72 72
 	}
@@ -74,29 +74,29 @@  discard block
 block discarded – undo
74 74
 
75 75
 	public function testCopy()
76 76
 	{
77
-		$manager = \Aimeos\MShop::create( $this->context, 'customer/group' );
77
+		$manager = \Aimeos\MShop::create($this->context, 'customer/group');
78 78
 
79
-		$param = ['type' => 'unittest', 'id' => $manager->findItem( 'unitgroup' )->getId()];
80
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param );
81
-		$this->view->addHelper( 'param', $helper );
79
+		$param = ['type' => 'unittest', 'id' => $manager->findItem('unitgroup')->getId()];
80
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param);
81
+		$this->view->addHelper('param', $helper);
82 82
 
83 83
 		$result = $this->object->copy();
84 84
 
85
-		$this->assertContains( 'unitgroup', $result );
85
+		$this->assertContains('unitgroup', $result);
86 86
 	}
87 87
 
88 88
 
89 89
 	public function testCopyException()
90 90
 	{
91
-		$object = $this->getMockBuilder( \Aimeos\Admin\JQAdm\Group\Standard::class )
92
-			->setConstructorArgs( array( $this->context, \TestHelperJqadm::getTemplatePaths() ) )
93
-			->setMethods( array( 'getSubClients' ) )
91
+		$object = $this->getMockBuilder(\Aimeos\Admin\JQAdm\Group\Standard::class)
92
+			->setConstructorArgs(array($this->context, \TestHelperJqadm::getTemplatePaths()))
93
+			->setMethods(array('getSubClients'))
94 94
 			->getMock();
95 95
 
96
-		$object->expects( $this->once() )->method( 'getSubClients' )
97
-			->will( $this->throwException( new \RuntimeException() ) );
96
+		$object->expects($this->once())->method('getSubClients')
97
+			->will($this->throwException(new \RuntimeException()));
98 98
 
99
-		$object->setView( $this->getViewNoRender() );
99
+		$object->setView($this->getViewNoRender());
100 100
 
101 101
 		$object->copy();
102 102
 	}
@@ -104,15 +104,15 @@  discard block
 block discarded – undo
104 104
 
105 105
 	public function testCopyMShopException()
106 106
 	{
107
-		$object = $this->getMockBuilder( \Aimeos\Admin\JQAdm\Group\Standard::class )
108
-			->setConstructorArgs( array( $this->context, \TestHelperJqadm::getTemplatePaths() ) )
109
-			->setMethods( array( 'getSubClients' ) )
107
+		$object = $this->getMockBuilder(\Aimeos\Admin\JQAdm\Group\Standard::class)
108
+			->setConstructorArgs(array($this->context, \TestHelperJqadm::getTemplatePaths()))
109
+			->setMethods(array('getSubClients'))
110 110
 			->getMock();
111 111
 
112
-		$object->expects( $this->once() )->method( 'getSubClients' )
113
-			->will( $this->throwException( new \Aimeos\MShop\Exception() ) );
112
+		$object->expects($this->once())->method('getSubClients')
113
+			->will($this->throwException(new \Aimeos\MShop\Exception()));
114 114
 
115
-		$object->setView( $this->getViewNoRender() );
115
+		$object->setView($this->getViewNoRender());
116 116
 
117 117
 		$object->copy();
118 118
 	}
@@ -120,21 +120,21 @@  discard block
 block discarded – undo
120 120
 
121 121
 	public function testDelete()
122 122
 	{
123
-		$this->assertNotNull( $this->object->delete() );
123
+		$this->assertNotNull($this->object->delete());
124 124
 	}
125 125
 
126 126
 
127 127
 	public function testDeleteException()
128 128
 	{
129
-		$object = $this->getMockBuilder( \Aimeos\Admin\JQAdm\Group\Standard::class )
130
-			->setConstructorArgs( array( $this->context, \TestHelperJqadm::getTemplatePaths() ) )
131
-			->setMethods( array( 'getSubClients', 'search' ) )
129
+		$object = $this->getMockBuilder(\Aimeos\Admin\JQAdm\Group\Standard::class)
130
+			->setConstructorArgs(array($this->context, \TestHelperJqadm::getTemplatePaths()))
131
+			->setMethods(array('getSubClients', 'search'))
132 132
 			->getMock();
133 133
 
134
-		$object->expects( $this->once() )->method( 'getSubClients' )
135
-			->will( $this->throwException( new \RuntimeException() ) );
134
+		$object->expects($this->once())->method('getSubClients')
135
+			->will($this->throwException(new \RuntimeException()));
136 136
 
137
-		$object->setView( $this->getViewNoRender() );
137
+		$object->setView($this->getViewNoRender());
138 138
 
139 139
 		$object->delete();
140 140
 	}
@@ -142,15 +142,15 @@  discard block
 block discarded – undo
142 142
 
143 143
 	public function testDeleteMShopException()
144 144
 	{
145
-		$object = $this->getMockBuilder( \Aimeos\Admin\JQAdm\Group\Standard::class )
146
-			->setConstructorArgs( array( $this->context, \TestHelperJqadm::getTemplatePaths() ) )
147
-			->setMethods( array( 'getSubClients', 'search' ) )
145
+		$object = $this->getMockBuilder(\Aimeos\Admin\JQAdm\Group\Standard::class)
146
+			->setConstructorArgs(array($this->context, \TestHelperJqadm::getTemplatePaths()))
147
+			->setMethods(array('getSubClients', 'search'))
148 148
 			->getMock();
149 149
 
150
-		$object->expects( $this->once() )->method( 'getSubClients' )
151
-			->will( $this->throwException( new \Aimeos\MShop\Exception() ) );
150
+		$object->expects($this->once())->method('getSubClients')
151
+			->will($this->throwException(new \Aimeos\MShop\Exception()));
152 152
 
153
-		$object->setView( $this->getViewNoRender() );
153
+		$object->setView($this->getViewNoRender());
154 154
 
155 155
 		$object->delete();
156 156
 	}
@@ -158,29 +158,29 @@  discard block
 block discarded – undo
158 158
 
159 159
 	public function testGet()
160 160
 	{
161
-		$manager = \Aimeos\MShop::create( $this->context, 'customer/group' );
161
+		$manager = \Aimeos\MShop::create($this->context, 'customer/group');
162 162
 
163
-		$param = ['type' => 'unittest', 'id' => $manager->findItem( 'unitgroup' )->getId()];
164
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param );
165
-		$this->view->addHelper( 'param', $helper );
163
+		$param = ['type' => 'unittest', 'id' => $manager->findItem('unitgroup')->getId()];
164
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param);
165
+		$this->view->addHelper('param', $helper);
166 166
 
167 167
 		$result = $this->object->get();
168 168
 
169
-		$this->assertContains( 'unitgroup', $result );
169
+		$this->assertContains('unitgroup', $result);
170 170
 	}
171 171
 
172 172
 
173 173
 	public function testGetException()
174 174
 	{
175
-		$object = $this->getMockBuilder( \Aimeos\Admin\JQAdm\Group\Standard::class )
176
-			->setConstructorArgs( array( $this->context, \TestHelperJqadm::getTemplatePaths() ) )
177
-			->setMethods( array( 'getSubClients' ) )
175
+		$object = $this->getMockBuilder(\Aimeos\Admin\JQAdm\Group\Standard::class)
176
+			->setConstructorArgs(array($this->context, \TestHelperJqadm::getTemplatePaths()))
177
+			->setMethods(array('getSubClients'))
178 178
 			->getMock();
179 179
 
180
-		$object->expects( $this->once() )->method( 'getSubClients' )
181
-			->will( $this->throwException( new \RuntimeException() ) );
180
+		$object->expects($this->once())->method('getSubClients')
181
+			->will($this->throwException(new \RuntimeException()));
182 182
 
183
-		$object->setView( $this->getViewNoRender() );
183
+		$object->setView($this->getViewNoRender());
184 184
 
185 185
 		$object->get();
186 186
 	}
@@ -188,15 +188,15 @@  discard block
 block discarded – undo
188 188
 
189 189
 	public function testGetMShopException()
190 190
 	{
191
-		$object = $this->getMockBuilder( \Aimeos\Admin\JQAdm\Group\Standard::class )
192
-			->setConstructorArgs( array( $this->context, \TestHelperJqadm::getTemplatePaths() ) )
193
-			->setMethods( array( 'getSubClients' ) )
191
+		$object = $this->getMockBuilder(\Aimeos\Admin\JQAdm\Group\Standard::class)
192
+			->setConstructorArgs(array($this->context, \TestHelperJqadm::getTemplatePaths()))
193
+			->setMethods(array('getSubClients'))
194 194
 			->getMock();
195 195
 
196
-		$object->expects( $this->once() )->method( 'getSubClients' )
197
-			->will( $this->throwException( new \Aimeos\MShop\Exception() ) );
196
+		$object->expects($this->once())->method('getSubClients')
197
+			->will($this->throwException(new \Aimeos\MShop\Exception()));
198 198
 
199
-		$object->setView( $this->getViewNoRender() );
199
+		$object->setView($this->getViewNoRender());
200 200
 
201 201
 		$object->get();
202 202
 	}
@@ -204,16 +204,16 @@  discard block
 block discarded – undo
204 204
 
205 205
 	public function testGetViewException()
206 206
 	{
207
-		$object = new \Aimeos\Admin\JQAdm\Group\Standard( $this->context, [] );
207
+		$object = new \Aimeos\Admin\JQAdm\Group\Standard($this->context, []);
208 208
 
209
-		$this->setExpectedException( \Aimeos\Admin\JQAdm\Exception::class );
209
+		$this->setExpectedException(\Aimeos\Admin\JQAdm\Exception::class);
210 210
 		$object->getView();
211 211
 	}
212 212
 
213 213
 
214 214
 	public function testSave()
215 215
 	{
216
-		$manager = \Aimeos\MShop::create( $this->context, 'customer/group' );
216
+		$manager = \Aimeos\MShop::create($this->context, 'customer/group');
217 217
 
218 218
 		$param = array(
219 219
 			'type' => 'unittest',
@@ -224,26 +224,26 @@  discard block
 block discarded – undo
224 224
 			),
225 225
 		);
226 226
 
227
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param );
228
-		$this->view->addHelper( 'param', $helper );
227
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param);
228
+		$this->view->addHelper('param', $helper);
229 229
 
230 230
 		$this->object->save();
231 231
 
232
-		$manager->deleteItem( $manager->findItem( 'jqadm@test' )->getId() );
232
+		$manager->deleteItem($manager->findItem('jqadm@test')->getId());
233 233
 	}
234 234
 
235 235
 
236 236
 	public function testSaveException()
237 237
 	{
238
-		$object = $this->getMockBuilder( \Aimeos\Admin\JQAdm\Group\Standard::class )
239
-			->setConstructorArgs( array( $this->context, \TestHelperJqadm::getTemplatePaths() ) )
240
-			->setMethods( array( 'fromArray' ) )
238
+		$object = $this->getMockBuilder(\Aimeos\Admin\JQAdm\Group\Standard::class)
239
+			->setConstructorArgs(array($this->context, \TestHelperJqadm::getTemplatePaths()))
240
+			->setMethods(array('fromArray'))
241 241
 			->getMock();
242 242
 
243
-		$object->expects( $this->once() )->method( 'fromArray' )
244
-			->will( $this->throwException( new \RuntimeException() ) );
243
+		$object->expects($this->once())->method('fromArray')
244
+			->will($this->throwException(new \RuntimeException()));
245 245
 
246
-		$object->setView( $this->getViewNoRender() );
246
+		$object->setView($this->getViewNoRender());
247 247
 
248 248
 		$object->save();
249 249
 	}
@@ -251,15 +251,15 @@  discard block
 block discarded – undo
251 251
 
252 252
 	public function testSaveMShopException()
253 253
 	{
254
-		$object = $this->getMockBuilder( \Aimeos\Admin\JQAdm\Group\Standard::class )
255
-			->setConstructorArgs( array( $this->context, \TestHelperJqadm::getTemplatePaths() ) )
256
-			->setMethods( array( 'fromArray' ) )
254
+		$object = $this->getMockBuilder(\Aimeos\Admin\JQAdm\Group\Standard::class)
255
+			->setConstructorArgs(array($this->context, \TestHelperJqadm::getTemplatePaths()))
256
+			->setMethods(array('fromArray'))
257 257
 			->getMock();
258 258
 
259
-		$object->expects( $this->once() )->method( 'fromArray' )
260
-			->will( $this->throwException( new \RuntimeException() ) );
259
+		$object->expects($this->once())->method('fromArray')
260
+			->will($this->throwException(new \RuntimeException()));
261 261
 
262
-		$object->setView( $this->getViewNoRender() );
262
+		$object->setView($this->getViewNoRender());
263 263
 
264 264
 		$object->save();
265 265
 	}
@@ -267,15 +267,15 @@  discard block
 block discarded – undo
267 267
 
268 268
 	public function testSaveJQAdmException()
269 269
 	{
270
-		$object = $this->getMockBuilder( \Aimeos\Admin\JQAdm\Group\Standard::class )
271
-			->setConstructorArgs( array( $this->context, \TestHelperJqadm::getTemplatePaths() ) )
272
-			->setMethods( array( 'fromArray' ) )
270
+		$object = $this->getMockBuilder(\Aimeos\Admin\JQAdm\Group\Standard::class)
271
+			->setConstructorArgs(array($this->context, \TestHelperJqadm::getTemplatePaths()))
272
+			->setMethods(array('fromArray'))
273 273
 			->getMock();
274 274
 
275
-		$object->expects( $this->once() )->method( 'fromArray' )
276
-			->will( $this->throwException( new \RuntimeException() ) );
275
+		$object->expects($this->once())->method('fromArray')
276
+			->will($this->throwException(new \RuntimeException()));
277 277
 
278
-		$object->setView( $this->getViewNoRender() );
278
+		$object->setView($this->getViewNoRender());
279 279
 
280 280
 		$object->save();
281 281
 	}
@@ -286,32 +286,32 @@  discard block
 block discarded – undo
286 286
 		$param = array(
287 287
 			'type' => 'unittest', 'lang' => 'de',
288 288
 			'filter' => array(
289
-				'key' => array( 0 => 'customer.group.code' ),
290
-				'op' => array( 0 => '==' ),
291
-				'val' => array( 0 => 'unitgroup' ),
289
+				'key' => array(0 => 'customer.group.code'),
290
+				'op' => array(0 => '=='),
291
+				'val' => array(0 => 'unitgroup'),
292 292
 			),
293
-			'sort' => array( '-customer.group.id' ),
293
+			'sort' => array('-customer.group.id'),
294 294
 		);
295
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param );
296
-		$this->view->addHelper( 'param', $helper );
295
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param);
296
+		$this->view->addHelper('param', $helper);
297 297
 
298 298
 		$result = $this->object->search();
299 299
 
300
-		$this->assertContains( '>unitgroup<', $result );
300
+		$this->assertContains('>unitgroup<', $result);
301 301
 	}
302 302
 
303 303
 
304 304
 	public function testSearchException()
305 305
 	{
306
-		$object = $this->getMockBuilder( \Aimeos\Admin\JQAdm\Group\Standard::class )
307
-			->setConstructorArgs( array( $this->context, \TestHelperJqadm::getTemplatePaths() ) )
308
-			->setMethods( array( 'initCriteria' ) )
306
+		$object = $this->getMockBuilder(\Aimeos\Admin\JQAdm\Group\Standard::class)
307
+			->setConstructorArgs(array($this->context, \TestHelperJqadm::getTemplatePaths()))
308
+			->setMethods(array('initCriteria'))
309 309
 			->getMock();
310 310
 
311
-		$object->expects( $this->once() )->method( 'initCriteria' )
312
-			->will( $this->throwException( new \RuntimeException() ) );
311
+		$object->expects($this->once())->method('initCriteria')
312
+			->will($this->throwException(new \RuntimeException()));
313 313
 
314
-		$object->setView( $this->getViewNoRender() );
314
+		$object->setView($this->getViewNoRender());
315 315
 
316 316
 		$object->search();
317 317
 	}
@@ -319,15 +319,15 @@  discard block
 block discarded – undo
319 319
 
320 320
 	public function testSearchMShopException()
321 321
 	{
322
-		$object = $this->getMockBuilder( \Aimeos\Admin\JQAdm\Group\Standard::class )
323
-			->setConstructorArgs( array( $this->context, \TestHelperJqadm::getTemplatePaths() ) )
324
-			->setMethods( array( 'initCriteria' ) )
322
+		$object = $this->getMockBuilder(\Aimeos\Admin\JQAdm\Group\Standard::class)
323
+			->setConstructorArgs(array($this->context, \TestHelperJqadm::getTemplatePaths()))
324
+			->setMethods(array('initCriteria'))
325 325
 			->getMock();
326 326
 
327
-		$object->expects( $this->once() )->method( 'initCriteria' )
328
-			->will( $this->throwException( new \Aimeos\MShop\Exception() ) );
327
+		$object->expects($this->once())->method('initCriteria')
328
+			->will($this->throwException(new \Aimeos\MShop\Exception()));
329 329
 
330
-		$object->setView( $this->getViewNoRender() );
330
+		$object->setView($this->getViewNoRender());
331 331
 
332 332
 		$object->search();
333 333
 	}
@@ -335,33 +335,33 @@  discard block
 block discarded – undo
335 335
 
336 336
 	public function testGetSubClientInvalid()
337 337
 	{
338
-		$this->setExpectedException( \Aimeos\Admin\JQAdm\Exception::class );
339
-		$this->object->getSubClient( '$unknown$' );
338
+		$this->setExpectedException(\Aimeos\Admin\JQAdm\Exception::class);
339
+		$this->object->getSubClient('$unknown$');
340 340
 	}
341 341
 
342 342
 
343 343
 	public function testGetSubClientUnknown()
344 344
 	{
345
-		$this->setExpectedException( \Aimeos\Admin\JQAdm\Exception::class );
346
-		$this->object->getSubClient( 'unknown' );
345
+		$this->setExpectedException(\Aimeos\Admin\JQAdm\Exception::class);
346
+		$this->object->getSubClient('unknown');
347 347
 	}
348 348
 
349 349
 
350 350
 	protected function getViewNoRender()
351 351
 	{
352
-		$view = $this->getMockBuilder( \Aimeos\MW\View\Standard::class )
353
-			->setConstructorArgs( array( [] ) )
354
-			->setMethods( array( 'render', 'config' ) )
352
+		$view = $this->getMockBuilder(\Aimeos\MW\View\Standard::class)
353
+			->setConstructorArgs(array([]))
354
+			->setMethods(array('render', 'config'))
355 355
 			->getMock();
356 356
 
357
-		$manager = \Aimeos\MShop::create( $this->context, 'customer/group' );
357
+		$manager = \Aimeos\MShop::create($this->context, 'customer/group');
358 358
 
359
-		$param = ['type' => 'unittest', 'id' => $manager->findItem( 'unitgroup' )->getId()];
360
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $view, $param );
361
-		$view->addHelper( 'param', $helper );
359
+		$param = ['type' => 'unittest', 'id' => $manager->findItem('unitgroup')->getId()];
360
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($view, $param);
361
+		$view->addHelper('param', $helper);
362 362
 
363
-		$helper = new \Aimeos\MW\View\Helper\Access\Standard( $view, [] );
364
-		$view->addHelper( 'access', $helper );
363
+		$helper = new \Aimeos\MW\View\Helper\Access\Standard($view, []);
364
+		$view->addHelper('access', $helper);
365 365
 
366 366
 		return $view;
367 367
 	}
Please login to merge, or discard this patch.
admin/jqadm/tests/Admin/JQAdm/Order/StandardTest.php 1 patch
Spacing   +95 added lines, -95 removed lines patch added patch discarded remove patch
@@ -19,22 +19,22 @@  discard block
 block discarded – undo
19 19
 	protected function setUp()
20 20
 	{
21 21
 		$this->view = \TestHelperJqadm::getView();
22
-		$request = $this->getMockBuilder( \Psr\Http\Message\ServerRequestInterface::class )->getMock();
23
-		$helper = new \Aimeos\MW\View\Helper\Request\Standard( $this->view, $request, '127.0.0.1', 'test' );
24
-		$this->view ->addHelper( 'request', $helper );
22
+		$request = $this->getMockBuilder(\Psr\Http\Message\ServerRequestInterface::class)->getMock();
23
+		$helper = new \Aimeos\MW\View\Helper\Request\Standard($this->view, $request, '127.0.0.1', 'test');
24
+		$this->view ->addHelper('request', $helper);
25 25
 
26 26
 		$this->context = \TestHelperJqadm::getContext();
27 27
 
28
-		$this->object = new \Aimeos\Admin\JQAdm\Order\Standard( $this->context );
29
-		$this->object = new \Aimeos\Admin\JQAdm\Common\Decorator\Page( $this->object, $this->context );
30
-		$this->object->setAimeos( \TestHelperJqadm::getAimeos() );
31
-		$this->object->setView( $this->view );
28
+		$this->object = new \Aimeos\Admin\JQAdm\Order\Standard($this->context);
29
+		$this->object = new \Aimeos\Admin\JQAdm\Common\Decorator\Page($this->object, $this->context);
30
+		$this->object->setAimeos(\TestHelperJqadm::getAimeos());
31
+		$this->object->setView($this->view);
32 32
 	}
33 33
 
34 34
 
35 35
 	protected function tearDown()
36 36
 	{
37
-		unset( $this->object, $this->view, $this->context );
37
+		unset($this->object, $this->view, $this->context);
38 38
 	}
39 39
 
40 40
 
@@ -46,10 +46,10 @@  discard block
 block discarded – undo
46 46
 
47 47
 	public function testCreateException()
48 48
 	{
49
-		$object = $this->getClientMock( 'getSubClients' );
49
+		$object = $this->getClientMock('getSubClients');
50 50
 
51
-		$object->expects( $this->once() )->method( 'getSubClients' )
52
-			->will( $this->throwException( new \RuntimeException() ) );
51
+		$object->expects($this->once())->method('getSubClients')
52
+			->will($this->throwException(new \RuntimeException()));
53 53
 
54 54
 		$object->create();
55 55
 	}
@@ -57,10 +57,10 @@  discard block
 block discarded – undo
57 57
 
58 58
 	public function testCreateMShopException()
59 59
 	{
60
-		$object = $this->getClientMock( 'getSubClients' );
60
+		$object = $this->getClientMock('getSubClients');
61 61
 
62
-		$object->expects( $this->once() )->method( 'getSubClients' )
63
-			->will( $this->throwException( new \Aimeos\MShop\Exception() ) );
62
+		$object->expects($this->once())->method('getSubClients')
63
+			->will($this->throwException(new \Aimeos\MShop\Exception()));
64 64
 
65 65
 		$object->create();
66 66
 	}
@@ -69,21 +69,21 @@  discard block
 block discarded – undo
69 69
 	public function testCopy()
70 70
 	{
71 71
 		$param = ['site' => 'unittest', 'id' => $this->getOrderBaseItem()->getId()];
72
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param );
73
-		$this->view->addHelper( 'param', $helper );
72
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param);
73
+		$this->view->addHelper('param', $helper);
74 74
 
75 75
 		$result = $this->object->copy();
76 76
 
77
-		$this->assertContains( 'This is another comment.', $result );
77
+		$this->assertContains('This is another comment.', $result);
78 78
 	}
79 79
 
80 80
 
81 81
 	public function testCopyException()
82 82
 	{
83
-		$object = $this->getClientMock( 'getSubClients' );
83
+		$object = $this->getClientMock('getSubClients');
84 84
 
85
-		$object->expects( $this->once() )->method( 'getSubClients' )
86
-			->will( $this->throwException( new \RuntimeException() ) );
85
+		$object->expects($this->once())->method('getSubClients')
86
+			->will($this->throwException(new \RuntimeException()));
87 87
 
88 88
 		$object->copy();
89 89
 	}
@@ -91,10 +91,10 @@  discard block
 block discarded – undo
91 91
 
92 92
 	public function testCopyMShopException()
93 93
 	{
94
-		$object = $this->getClientMock( 'getSubClients' );
94
+		$object = $this->getClientMock('getSubClients');
95 95
 
96
-		$object->expects( $this->once() )->method( 'getSubClients' )
97
-			->will( $this->throwException( new \Aimeos\MShop\Exception() ) );
96
+		$object->expects($this->once())->method('getSubClients')
97
+			->will($this->throwException(new \Aimeos\MShop\Exception()));
98 98
 
99 99
 		$object->copy();
100 100
 	}
@@ -102,28 +102,28 @@  discard block
 block discarded – undo
102 102
 
103 103
 	public function testDelete()
104 104
 	{
105
-		$this->assertNull( $this->object->delete() );
105
+		$this->assertNull($this->object->delete());
106 106
 	}
107 107
 
108 108
 
109 109
 	public function testGet()
110 110
 	{
111 111
 		$param = ['site' => 'unittest', 'id' => $this->getOrderBaseItem()->getId()];
112
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param );
113
-		$this->view->addHelper( 'param', $helper );
112
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param);
113
+		$this->view->addHelper('param', $helper);
114 114
 
115 115
 		$result = $this->object->get();
116 116
 
117
-		$this->assertContains( 'This is another comment.', $result );
117
+		$this->assertContains('This is another comment.', $result);
118 118
 	}
119 119
 
120 120
 
121 121
 	public function testGetException()
122 122
 	{
123
-		$object = $this->getClientMock( 'getSubClients' );
123
+		$object = $this->getClientMock('getSubClients');
124 124
 
125
-		$object->expects( $this->once() )->method( 'getSubClients' )
126
-			->will( $this->throwException( new \RuntimeException() ) );
125
+		$object->expects($this->once())->method('getSubClients')
126
+			->will($this->throwException(new \RuntimeException()));
127 127
 
128 128
 		$object->get();
129 129
 	}
@@ -131,10 +131,10 @@  discard block
 block discarded – undo
131 131
 
132 132
 	public function testGetMShopException()
133 133
 	{
134
-		$object = $this->getClientMock( 'getSubClients' );
134
+		$object = $this->getClientMock('getSubClients');
135 135
 
136
-		$object->expects( $this->once() )->method( 'getSubClients' )
137
-			->will( $this->throwException( new \Aimeos\MShop\Exception() ) );
136
+		$object->expects($this->once())->method('getSubClients')
137
+			->will($this->throwException(new \Aimeos\MShop\Exception()));
138 138
 
139 139
 		$object->get();
140 140
 	}
@@ -150,28 +150,28 @@  discard block
 block discarded – undo
150 150
 			],
151 151
 			'sort' => ['-order.ctime', 'order.id'],
152 152
 		];
153
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param );
154
-		$this->view->addHelper( 'param', $helper );
153
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param);
154
+		$this->view->addHelper('param', $helper);
155 155
 
156 156
 		$result = $this->object->export();
157 157
 
158
-		$mq = $this->context->getMessageQueueManager()->get( 'mq-admin' )->getQueue( 'order-export' );
158
+		$mq = $this->context->getMessageQueueManager()->get('mq-admin')->getQueue('order-export');
159 159
 
160 160
 		$msg = $mq->get();
161
-		$this->assertNotNull( $msg );
162
-		$mq->del( $msg );
161
+		$this->assertNotNull($msg);
162
+		$mq->del($msg);
163 163
 
164 164
 		$expected = '{"sitecode":"unittest","filter":{"&&":[{"==":{"order.id":"1"}}]},"sort":{"order.ctime":"-","order.id":"+"}}';
165
-		$this->assertEquals( $expected, $msg->getBody() );
165
+		$this->assertEquals($expected, $msg->getBody());
166 166
 	}
167 167
 
168 168
 
169 169
 	public function testExportException()
170 170
 	{
171
-		$object = $this->getClientMock( 'storeSearchParams' );
171
+		$object = $this->getClientMock('storeSearchParams');
172 172
 
173
-		$object->expects( $this->atLeastOnce() )->method( 'storeSearchParams' )
174
-			->will( $this->throwException( new \RuntimeException() ) );
173
+		$object->expects($this->atLeastOnce())->method('storeSearchParams')
174
+			->will($this->throwException(new \RuntimeException()));
175 175
 
176 176
 		$object->export();
177 177
 	}
@@ -179,10 +179,10 @@  discard block
 block discarded – undo
179 179
 
180 180
 	public function testExportMShopException()
181 181
 	{
182
-		$object = $this->getClientMock( 'storeSearchParams' );
182
+		$object = $this->getClientMock('storeSearchParams');
183 183
 
184
-		$object->expects( $this->atLeastOnce() )->method( 'storeSearchParams' )
185
-			->will( $this->throwException( new \Aimeos\MShop\Exception() ) );
184
+		$object->expects($this->atLeastOnce())->method('storeSearchParams')
185
+			->will($this->throwException(new \Aimeos\MShop\Exception()));
186 186
 
187 187
 		$object->export();
188 188
 	}
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 
191 191
 	public function testSave()
192 192
 	{
193
-		$manager = \Aimeos\MShop::create( $this->context, 'order/base' );
193
+		$manager = \Aimeos\MShop::create($this->context, 'order/base');
194 194
 		$this->view->item = $manager->createItem();
195 195
 
196 196
 		$param = array(
@@ -200,21 +200,21 @@  discard block
 block discarded – undo
200 200
 			),
201 201
 		);
202 202
 
203
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param );
204
-		$this->view->addHelper( 'param', $helper );
203
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param);
204
+		$this->view->addHelper('param', $helper);
205 205
 
206 206
 		$this->object->save();
207 207
 
208
-		$manager->deleteItem( $this->getOrderBaseItem( 'jqadm test comment' )->getId() );
208
+		$manager->deleteItem($this->getOrderBaseItem('jqadm test comment')->getId());
209 209
 	}
210 210
 
211 211
 
212 212
 	public function testSaveException()
213 213
 	{
214
-		$object = $this->getClientMock( 'fromArray' );
214
+		$object = $this->getClientMock('fromArray');
215 215
 
216
-		$object->expects( $this->once() )->method( 'fromArray' )
217
-			->will( $this->throwException( new \RuntimeException() ) );
216
+		$object->expects($this->once())->method('fromArray')
217
+			->will($this->throwException(new \RuntimeException()));
218 218
 
219 219
 		$object->save();
220 220
 	}
@@ -222,10 +222,10 @@  discard block
 block discarded – undo
222 222
 
223 223
 	public function testSaveMShopException()
224 224
 	{
225
-		$object = $this->getClientMock( 'fromArray' );
225
+		$object = $this->getClientMock('fromArray');
226 226
 
227
-		$object->expects( $this->once() )->method( 'fromArray' )
228
-			->will( $this->throwException( new \RuntimeException() ) );
227
+		$object->expects($this->once())->method('fromArray')
228
+			->will($this->throwException(new \RuntimeException()));
229 229
 
230 230
 		$object->save();
231 231
 	}
@@ -233,10 +233,10 @@  discard block
 block discarded – undo
233 233
 
234 234
 	public function testSaveJQAdmException()
235 235
 	{
236
-		$object = $this->getClientMock( 'fromArray' );
236
+		$object = $this->getClientMock('fromArray');
237 237
 
238
-		$object->expects( $this->once() )->method( 'fromArray' )
239
-			->will( $this->throwException( new \RuntimeException() ) );
238
+		$object->expects($this->once())->method('fromArray')
239
+			->will($this->throwException(new \RuntimeException()));
240 240
 
241 241
 		$object->save();
242 242
 	}
@@ -247,14 +247,14 @@  discard block
 block discarded – undo
247 247
 		$param = array(
248 248
 			'site' => 'unittest', 'lang' => 'de',
249 249
 			'filter' => array(
250
-				'key' => array( 0 => 'order.base.type' ),
251
-				'op' => array( 0 => '==' ),
252
-				'val' => array( 0 => 'web' ),
250
+				'key' => array(0 => 'order.base.type'),
251
+				'op' => array(0 => '=='),
252
+				'val' => array(0 => 'web'),
253 253
 			),
254
-			'sort' => array( '-order.base.id' ),
254
+			'sort' => array('-order.base.id'),
255 255
 		);
256
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param );
257
-		$this->view->addHelper( 'param', $helper );
256
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param);
257
+		$this->view->addHelper('param', $helper);
258 258
 
259 259
 		$result = $this->object->search();
260 260
 
@@ -264,10 +264,10 @@  discard block
 block discarded – undo
264 264
 
265 265
 	public function testSearchException()
266 266
 	{
267
-		$object = $this->getClientMock( 'initCriteria' );
267
+		$object = $this->getClientMock('initCriteria');
268 268
 
269
-		$object->expects( $this->once() )->method( 'initCriteria' )
270
-			->will( $this->throwException( new \RuntimeException() ) );
269
+		$object->expects($this->once())->method('initCriteria')
270
+			->will($this->throwException(new \RuntimeException()));
271 271
 
272 272
 		$object->search();
273 273
 	}
@@ -275,10 +275,10 @@  discard block
 block discarded – undo
275 275
 
276 276
 	public function testSearchMShopException()
277 277
 	{
278
-		$object = $this->getClientMock( 'initCriteria' );
278
+		$object = $this->getClientMock('initCriteria');
279 279
 
280
-		$object->expects( $this->once() )->method( 'initCriteria' )
281
-			->will( $this->throwException( new \Aimeos\MShop\Exception() ) );
280
+		$object->expects($this->once())->method('initCriteria')
281
+			->will($this->throwException(new \Aimeos\MShop\Exception()));
282 282
 
283 283
 		$object->search();
284 284
 	}
@@ -286,34 +286,34 @@  discard block
 block discarded – undo
286 286
 
287 287
 	public function testGetSubClient()
288 288
 	{
289
-		$result = $this->object->getSubClient( 'invoice' );
290
-		$this->assertInstanceOf( \Aimeos\Admin\JQAdm\Iface::class, $result );
289
+		$result = $this->object->getSubClient('invoice');
290
+		$this->assertInstanceOf(\Aimeos\Admin\JQAdm\Iface::class, $result);
291 291
 	}
292 292
 
293 293
 
294 294
 	public function testGetSubClientInvalid()
295 295
 	{
296
-		$this->setExpectedException( \Aimeos\Admin\JQAdm\Exception::class );
297
-		$this->object->getSubClient( '$unknown$' );
296
+		$this->setExpectedException(\Aimeos\Admin\JQAdm\Exception::class);
297
+		$this->object->getSubClient('$unknown$');
298 298
 	}
299 299
 
300 300
 
301 301
 	public function testGetSubClientUnknown()
302 302
 	{
303
-		$this->setExpectedException( \Aimeos\Admin\JQAdm\Exception::class );
304
-		$this->object->getSubClient( 'unknown' );
303
+		$this->setExpectedException(\Aimeos\Admin\JQAdm\Exception::class);
304
+		$this->object->getSubClient('unknown');
305 305
 	}
306 306
 
307 307
 
308
-	public function getClientMock( $method )
308
+	public function getClientMock($method)
309 309
 	{
310
-		$object = $this->getMockBuilder( \Aimeos\Admin\JQAdm\Order\Standard::class )
311
-			->setConstructorArgs( array( $this->context, \TestHelperJqadm::getTemplatePaths() ) )
312
-			->setMethods( [$method] )
310
+		$object = $this->getMockBuilder(\Aimeos\Admin\JQAdm\Order\Standard::class)
311
+			->setConstructorArgs(array($this->context, \TestHelperJqadm::getTemplatePaths()))
312
+			->setMethods([$method])
313 313
 			->getMock();
314 314
 
315
-		$object->setAimeos( \TestHelperJqadm::getAimeos() );
316
-		$object->setView( $this->getViewNoRender() );
315
+		$object->setAimeos(\TestHelperJqadm::getAimeos());
316
+		$object->setView($this->getViewNoRender());
317 317
 
318 318
 		return $object;
319 319
 	}
@@ -321,33 +321,33 @@  discard block
 block discarded – undo
321 321
 
322 322
 	protected function getViewNoRender()
323 323
 	{
324
-		$view = $this->getMockBuilder( \Aimeos\MW\View\Standard::class )
325
-			->setConstructorArgs( array( [] ) )
326
-			->setMethods( array( 'render', 'config' ) )
324
+		$view = $this->getMockBuilder(\Aimeos\MW\View\Standard::class)
325
+			->setConstructorArgs(array([]))
326
+			->setMethods(array('render', 'config'))
327 327
 			->getMock();
328 328
 
329 329
 		$param = ['site' => 'unittest', 'id' => $this->getOrderBaseItem()->getId()];
330
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $view, $param );
331
-		$view->addHelper( 'param', $helper );
330
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($view, $param);
331
+		$view->addHelper('param', $helper);
332 332
 
333
-		$helper = new \Aimeos\MW\View\Helper\Access\Standard( $view, [] );
334
-		$view->addHelper( 'access', $helper );
333
+		$helper = new \Aimeos\MW\View\Helper\Access\Standard($view, []);
334
+		$view->addHelper('access', $helper);
335 335
 
336 336
 		return $view;
337 337
 	}
338 338
 
339 339
 
340
-	protected function getOrderBaseItem( $comment = 'This is another comment.' )
340
+	protected function getOrderBaseItem($comment = 'This is another comment.')
341 341
 	{
342
-		$manager = \Aimeos\MShop::create( $this->context, 'order/base' );
342
+		$manager = \Aimeos\MShop::create($this->context, 'order/base');
343 343
 
344 344
 		$search = $manager->createSearch();
345
-		$search->setConditions( $search->compare( '==', 'order.base.comment', $comment ) );
345
+		$search->setConditions($search->compare('==', 'order.base.comment', $comment));
346 346
 
347
-		$items = $manager->searchItems( $search );
347
+		$items = $manager->searchItems($search);
348 348
 
349
-		if( ( $item = reset( $items ) ) === false ) {
350
-			throw new \RuntimeException( 'No order base item found' );
349
+		if (($item = reset($items)) === false) {
350
+			throw new \RuntimeException('No order base item found');
351 351
 		}
352 352
 
353 353
 		return $item;
Please login to merge, or discard this patch.