StandardTest   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 17
c 1
b 0
f 0
dl 0
loc 39
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A testTransformSingleFailure() 0 7 1
A testTransformMultipleFailure() 0 7 1
A testTransformMultipleOK() 0 7 1
A testTransformSingleOK() 0 7 1
1
<?php
2
3
/**
4
 * @license LGPLv3, https://opensource.org/licenses/LGPL-3.0
5
 * @copyright Aimeos (aimeos.org), 2016-2025
6
 */
7
8
9
namespace Aimeos\Base\View\Helper\Access;
10
11
12
class StandardTest extends \PHPUnit\Framework\TestCase
13
{
14
	public function testTransformSingleOK()
15
	{
16
		$view = new \Aimeos\Base\View\Standard();
17
		$fcn = function() { return array( 'editor' ); };
18
19
		$object = new \Aimeos\Base\View\Helper\Access\Standard( $view, $fcn );
20
		$this->assertTrue( $object->transform( 'editor' ) );
21
	}
22
23
24
	public function testTransformSingleFailure()
25
	{
26
		$view = new \Aimeos\Base\View\Standard();
27
		$fcn = function() { return array( 'editor' ); };
28
29
		$object = new \Aimeos\Base\View\Helper\Access\Standard( $view, $fcn );
30
		$this->assertFalse( $object->transform( 'admin' ) );
31
	}
32
33
34
	public function testTransformMultipleOK()
35
	{
36
		$view = new \Aimeos\Base\View\Standard();
37
		$fcn = function() { return array( 'admin', 'editor' ); };
38
39
		$object = new \Aimeos\Base\View\Helper\Access\Standard( $view, $fcn );
40
		$this->assertTrue( $object->transform( array( 'editor' ) ) );
41
	}
42
43
44
	public function testTransformMultipleFailure()
45
	{
46
		$view = new \Aimeos\Base\View\Standard();
47
		$fcn = function() { return array( 'admin', 'editor' ); };
48
49
		$object = new \Aimeos\Base\View\Helper\Access\Standard( $view, $fcn );
50
		$this->assertFalse( $object->transform( array( 'test', 'example' ) ) );
51
	}
52
}
53