Passed
Push — master ( 629e2d...7e10db )
by Aimeos
04:36
created

StandardTest   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 67
Duplicated Lines 0 %

Importance

Changes 5
Bugs 0 Features 0
Metric Value
eloc 20
dl 0
loc 67
rs 10
c 5
b 0
f 0
wmc 9

9 Methods

Rating   Name   Duplication   Size   Complexity  
A tearDown() 0 3 1
A testLabel() 0 3 1
A testMatch() 0 3 1
A setUp() 0 9 1
A testTransform() 0 3 1
A testCan() 0 5 1
A testMismatch() 0 5 1
A testSiteid() 0 3 1
A testReadonly() 0 4 1
1
<?php
2
3
/**
4
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
5
 * @copyright Aimeos (aimeos.org), 2017-2023
6
 */
7
8
9
namespace Aimeos\Base\View\Helper\Site;
10
11
12
class StandardTest extends \PHPUnit\Framework\TestCase
13
{
14
	private $object;
15
16
17
	protected function setUp() : void
18
	{
19
		$view = new \Aimeos\Base\View\Standard();
20
		$view->pageSiteItem = new \Aimeos\MShop\Locale\Item\Site\Standard( [
21
			'locale.site.siteid' => '0.',
22
			'locale.site.label' => 'label1'
23
		] );
24
25
		$this->object = new \Aimeos\Base\View\Helper\Site\Standard( $view );
26
	}
27
28
29
	protected function tearDown() : void
30
	{
31
		$this->object = null;
32
	}
33
34
35
	public function testTransform()
36
	{
37
		$this->assertInstanceOf( '\\Aimeos\\Base\\View\\Helper\\Site\\Iface', $this->object->transform() );
38
	}
39
40
41
	public function testCan()
42
	{
43
		$this->assertEquals( true, $this->object->transform()->can( '0.' ) );
44
		$this->assertEquals( true, $this->object->transform()->can( '0.2.' ) );
45
		$this->assertEquals( false, $this->object->transform()->can( '3.' ) );
46
	}
47
48
49
	public function testLabel()
50
	{
51
		$this->assertEquals( 'label1', $this->object->transform()->label() );
52
	}
53
54
55
	public function testMatch()
56
	{
57
		$this->assertEquals( 'label1', $this->object->transform()->match( '0.' ) );
58
	}
59
60
61
	public function testMismatch()
62
	{
63
		$this->assertEquals( '', $this->object->transform()->mismatch( '0.' ) );
64
		$this->assertEquals( 'mismatch', $this->object->transform()->mismatch( '3.' ) );
65
		$this->assertEquals( 'mismatch', $this->object->transform()->mismatch( '0.2.' ) );
66
	}
67
68
69
	public function testReadonly()
70
	{
71
		$this->assertEquals( '', $this->object->transform()->readonly( '0.2.' ) );
72
		$this->assertEquals( 'readonly', $this->object->transform()->readonly( '3.' ) );
73
	}
74
75
76
	public function testSiteid()
77
	{
78
		$this->assertEquals( '0.', $this->object->transform()->siteid() );
79
	}
80
}
81