Completed
Push — master ( 9109fd...709bda )
by Aimeos
02:33
created

StandardTest::testGetItems()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 9.9
c 0
b 0
f 0
cc 1
nc 1
nop 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A StandardTest::testParse() 0 5 1
1
<?php
2
3
/**
4
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
5
 * @copyright Aimeos (aimeos.org), 2018
6
 */
7
8
9
namespace Aimeos\Controller\Frontend\Supplier;
10
11
12
class StandardTest extends \PHPUnit\Framework\TestCase
13
{
14
	private $object;
15
	private $context;
16
17
18
	protected function setUp()
19
	{
20
		$this->context = \TestHelperFrontend::getContext();
21
		$this->object = new \Aimeos\Controller\Frontend\Supplier\Standard( $this->context );
22
	}
23
24
25
	protected function tearDown()
26
	{
27
		unset( $this->object, $this->context );
28
	}
29
30
31
	public function testCompare()
32
	{
33
		$this->assertEquals( 2, count( $this->object->compare( '=~', 'supplier.label', 'unit' )->search() ) );
34
	}
35
36
37
	public function testGet()
38
	{
39
		$iface = \Aimeos\MShop\Supplier\Item\Iface::class;
40
		$item = \Aimeos\MShop::create( $this->context, 'supplier' )->findItem( 'unitCode001' );
41
42
		$this->assertInstanceOf( $iface, $this->object->get( $item->getId() ) );
43
	}
44
45
46
	public function testFind()
47
	{
48
		$iface = \Aimeos\MShop\Supplier\Item\Iface::class;
49
		$this->assertInstanceOf( $iface, $this->object->find( 'unitCode001' ) );
50
	}
51
52
53
	public function testParse()
54
	{
55
		$cond = ['&&' => [['==' => ['supplier.status' => 1]], ['=~' => ['supplier.label' => 'unit']]]];
56
		$this->assertEquals( 2, count( $this->object->parse( $cond )->search() ) );
57
	}
58
59
60
	public function testSearch()
61
	{
62
		$total = 0;
63
		$this->assertGreaterThanOrEqual( 2, count( $this->object->search( [], $total ) ) );
64
		$this->assertGreaterThanOrEqual( 2, $total );
65
	}
66
67
68
	public function testSlice()
69
	{
70
		$this->assertEquals( 1, count( $this->object->slice( 0, 1 )->search() ) );
71
	}
72
73
74
	public function testSort()
75
	{
76
		$this->assertGreaterThanOrEqual( 2, count( $this->object->sort()->search() ) );
77
	}
78
79
80
	public function testSortGeneric()
81
	{
82
		$this->assertGreaterThanOrEqual( 2, count( $this->object->sort( 'supplier.label' )->search() ) );
83
	}
84
}
85