Code Duplication    Length = 17-17 lines in 6 locations

admin/jsonadm/tests/Admin/JsonAdm/StandardTest.php 6 locations

@@ 93-109 (lines=17) @@
90
	}
91
92
93
	public function testDeleteException()
94
	{
95
		$this->getProductMock( array( 'deleteItem' ) )->expects( $this->once() )->method( 'deleteItem' )
96
			->will( $this->throwException( new \Exception( 'test exception' ) ) );
97
98
		$params = array( 'id' => $this->getProductItem()->getId() );
99
		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
100
		$this->view->addHelper( 'param', $helper );
101
102
		$header = array();
103
		$status = 500;
104
105
		$result = json_decode( $this->object->delete( '', $header, $status ), true );
106
107
		$this->assertEquals( 500, $status );
108
		$this->assertArrayHasKey( 'errors', $result );
109
	}
110
111
112
	public function testDeleteMAdminException()
@@ 112-128 (lines=17) @@
109
	}
110
111
112
	public function testDeleteMAdminException()
113
	{
114
		$this->getProductMock( array( 'deleteItem' ) )->expects( $this->once() )->method( 'deleteItem' )
115
			->will( $this->throwException( new \Aimeos\MAdmin\Exception( 'test exception' ) ) );
116
117
		$params = array( 'id' => $this->getProductItem()->getId() );
118
		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
119
		$this->view->addHelper( 'param', $helper );
120
121
		$header = array();
122
		$status = 500;
123
124
		$result = json_decode( $this->object->delete( '', $header, $status ), true );
125
126
		$this->assertEquals( 404, $status );
127
		$this->assertArrayHasKey( 'errors', $result );
128
	}
129
130
131
	public function testDeleteMShopException()
@@ 131-147 (lines=17) @@
128
	}
129
130
131
	public function testDeleteMShopException()
132
	{
133
		$this->getProductMock( array( 'deleteItem' ) )->expects( $this->once() )->method( 'deleteItem' )
134
			->will( $this->throwException( new \Aimeos\MShop\Exception( 'test exception' ) ) );
135
136
		$params = array( 'id' => $this->getProductItem()->getId() );
137
		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
138
		$this->view->addHelper( 'param', $helper );
139
140
		$header = array();
141
		$status = 500;
142
143
		$result = json_decode( $this->object->delete( '', $header, $status ), true );
144
145
		$this->assertEquals( 404, $status );
146
		$this->assertArrayHasKey( 'errors', $result );
147
	}
148
149
150
	public function testGet()
@@ 210-226 (lines=17) @@
207
	}
208
209
210
	public function testGetException()
211
	{
212
		$this->getProductMock( array( 'getItem' ) )->expects( $this->once() )->method( 'getItem' )
213
			->will( $this->throwException( new \Exception( 'test exception' ) ) );
214
215
		$params = array( 'id' => -1 );
216
		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
217
		$this->view->addHelper( 'param', $helper );
218
219
		$header = array();
220
		$status = 500;
221
222
		$result = json_decode( $this->object->get( '', $header, $status ), true );
223
224
		$this->assertEquals( 500, $status );
225
		$this->assertArrayHasKey( 'errors', $result );
226
	}
227
228
229
	public function testGetMAdminException()
@@ 229-245 (lines=17) @@
226
	}
227
228
229
	public function testGetMAdminException()
230
	{
231
		$this->getProductMock( array( 'getItem' ) )->expects( $this->once() )->method( 'getItem' )
232
			->will( $this->throwException( new \Aimeos\MAdmin\Exception( 'test exception' ) ) );
233
234
		$params = array( 'id' => -1 );
235
		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
236
		$this->view->addHelper( 'param', $helper );
237
238
		$header = array();
239
		$status = 500;
240
241
		$result = json_decode( $this->object->get( '', $header, $status ), true );
242
243
		$this->assertEquals( 404, $status );
244
		$this->assertArrayHasKey( 'errors', $result );
245
	}
246
247
248
	public function testGetMShopException()
@@ 248-264 (lines=17) @@
245
	}
246
247
248
	public function testGetMShopException()
249
	{
250
		$this->getProductMock( array( 'getItem' ) )->expects( $this->once() )->method( 'getItem' )
251
			->will( $this->throwException( new \Aimeos\MShop\Exception( 'test exception' ) ) );
252
253
		$params = array( 'id' => -1 );
254
		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
255
		$this->view->addHelper( 'param', $helper );
256
257
		$header = array();
258
		$status = 500;
259
260
		$result = json_decode( $this->object->get( '', $header, $status ), true );
261
262
		$this->assertEquals( 404, $status );
263
		$this->assertArrayHasKey( 'errors', $result );
264
	}
265
266
267
	public function testGetFilter()