Code Duplication    Length = 27-27 lines in 2 locations

lib/custom/tests/MShop/Customer/Manager/Lists/LaravelTest.php 2 locations

@@ 165-191 (lines=27) @@
162
	}
163
164
165
	public function testMoveItemFirstToLast()
166
	{
167
		$listItems = $this->getListItems();
168
		$this->assertGreaterThan( 1, count( $listItems ) );
169
170
		if( ( $first = reset( $listItems ) ) === false ) {
171
			throw new \RuntimeException( 'No first customer list item' );
172
		}
173
174
		if( ( $second = next( $listItems ) ) === false ) {
175
			throw new \RuntimeException( 'No second customer list item' );
176
		}
177
178
		if( ( $last = end( $listItems ) ) === false ) {
179
			throw new \RuntimeException( 'No last customer list item' );
180
		}
181
182
		$this->object->moveItem( $first->getId() );
183
184
		$newBefore = $this->object->getItem( $last->getId() );
185
		$newLast = $this->object->getItem( $first->getId() );
186
187
		$this->object->moveItem( $first->getId(), $second->getId() );
188
189
		$this->assertEquals( $last->getPosition() - 1, $newBefore->getPosition() );
190
		$this->assertEquals( $last->getPosition(), $newLast->getPosition() );
191
	}
192
193
194
	public function testMoveItemFirstUp()
@@ 194-220 (lines=27) @@
191
	}
192
193
194
	public function testMoveItemFirstUp()
195
	{
196
		$listItems = $this->getListItems();
197
		$this->assertGreaterThan( 1, count( $listItems ) );
198
199
		if( ( $first = reset( $listItems ) ) === false ) {
200
			throw new \RuntimeException( 'No first customer list item' );
201
		}
202
203
		if( ( $second = next( $listItems ) ) === false ) {
204
			throw new \RuntimeException( 'No second customer list item' );
205
		}
206
207
		if( ( $last = end( $listItems ) ) === false ) {
208
			throw new \RuntimeException( 'No last customer list item' );
209
		}
210
211
		$this->object->moveItem( $first->getId(), $last->getId() );
212
213
		$newLast = $this->object->getItem( $last->getId() );
214
		$newUp = $this->object->getItem( $first->getId() );
215
216
		$this->object->moveItem( $first->getId(), $second->getId() );
217
218
		$this->assertEquals( $last->getPosition() - 1, $newUp->getPosition() );
219
		$this->assertEquals( $last->getPosition(), $newLast->getPosition() );
220
	}
221
222
223
	public function testSearchItems()