Completed
Push — master ( 709bda...74f662 )
by Aimeos
02:08
created

StandardTest::testGet()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
rs 9.9666
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
/**
4
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
5
 * @copyright Aimeos (aimeos.org), 2017-2018
6
 */
7
8
9
namespace Aimeos\Controller\Frontend\Locale;
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\Locale\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( 1, count( $this->object->compare( '>', 'locale.status', 0 )->search() ) );
34
	}
35
36
37
	public function testGet()
38
	{
39
		$expected = \Aimeos\MShop\Locale\Item\Iface::class;
40
41
		$manager = \Aimeos\MShop::create( $this->context, 'locale' );
42
		$items = $manager->searchItems( $manager->createSearch( true ) );
43
44
		$this->assertInstanceOf( $expected, $this->object->get( reset( $items )->getId() ) );
45
	}
46
47
48
	public function testParse()
49
	{
50
		$cond = ['>' => ['locale.status' => 0]];
51
		$this->assertEquals( 1, count( $this->object->parse( $cond )->search() ) );
52
	}
53
54
55
	public function testSearch()
56
	{
57
		$total = 0;
58
		$this->assertGreaterThanOrEqual( 1, count( $this->object->search( $total ) ) );
59
		$this->assertGreaterThanOrEqual( 1, $total );
60
	}
61
62
63
	public function testSlice()
64
	{
65
		$this->assertEquals( 1, count( $this->object->slice( 0, 1 )->search() ) );
66
	}
67
68
69
	public function testSort()
70
	{
71
		$this->assertEquals( 1, count( $this->object->sort()->search() ) );
72
	}
73
74
75
	public function testSortPosition()
76
	{
77
		$this->assertEquals( 1, count( $this->object->sort( 'position' )->search() ) );
78
	}
79
80
81
	public function testSortGeneric()
82
	{
83
		$this->assertEquals( 1, count( $this->object->sort( 'locale.status' )->search() ) );
84
	}
85
}
86