Passed
Push — master ( 9f100a...06f597 )
by Aimeos
13:51 queued 10:18
created

StandardTest::tearDown()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
5
 * @copyright Aimeos (aimeos.org), 2017-2022
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 TestSite( 1, 'label1' );
21
22
		$this->object = new \Aimeos\Base\View\Helper\Site\Standard( $view );
23
	}
24
25
26
	protected function tearDown() : void
27
	{
28
		$this->object = null;
29
	}
30
31
32
	public function testTransform()
33
	{
34
		$this->assertInstanceOf( '\\Aimeos\\Base\\View\\Helper\\Site\\Iface', $this->object->transform() );
35
	}
36
37
38
	public function testLabel()
39
	{
40
		$this->assertEquals( 'label1', $this->object->transform()->label() );
41
	}
42
43
44
	public function testMatch()
45
	{
46
		$this->assertEquals( 'label1', $this->object->transform()->match( 1 ) );
47
	}
48
49
50
	public function testReadonly()
51
	{
52
		$this->assertEquals( 'readonly', $this->object->transform()->readonly( 2 ) );
53
	}
54
55
56
	public function testSiteid()
57
	{
58
		$this->assertEquals( 1, $this->object->transform()->siteid() );
59
	}
60
}
61
62
63
class TestSite
64
{
65
	private $id;
66
	private $label;
67
68
	public function __construct( $id, $label )
69
	{
70
		$this->id = $id;
71
		$this->label = $label;
72
	}
73
74
	public function getSiteId()
75
	{
76
		return $this->id;
77
	}
78
79
	public function getLabel()
80
	{
81
		return $this->label;
82
	}
83
}
84