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

StandardTest::testMismatch()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 5
rs 10
c 1
b 0
f 0
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