ContextTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 18
dl 0
loc 37
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A tearDown() 0 3 1
A setUp() 0 11 1
A testData() 0 11 1
1
<?php
2
3
/**
4
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
5
 * @copyright Aimeos (aimeos.org), 2020-2025
6
 */
7
8
9
namespace Aimeos\Client\Html\Common\Decorator;
10
11
12
class ContextTest extends \PHPUnit\Framework\TestCase
13
{
14
	private $client;
15
	private $object;
16
17
18
	protected function setUp() : void
19
	{
20
		$context = \TestHelper::context();
21
22
		$this->client = $this->getMockBuilder( '\\Aimeos\\Client\\Html\\Catalog\\Filter\\Standard' )
23
			->setConstructorArgs( [$context] )
24
			->onlyMethods( ['data'] )
25
			->getMock();
26
27
		$this->object = new \Aimeos\Client\Html\Common\Decorator\Context( $this->client, $context );
28
		$this->object->setView( \TestHelper::view() );
29
	}
30
31
32
	protected function tearDown() : void
33
	{
34
		unset( $this->object, $this->client );
35
	}
36
37
38
	public function testData()
39
	{
40
		$this->client->expects( $this->once() )->method( 'data' ) ->willReturnArgument( 0 );
41
42
		$result = $this->object->data( \TestHelper::view() );
43
44
		$this->assertInstanceOf( '\Aimeos\Base\View\Iface', $result );
45
		$this->assertEquals( 'unittest', $result->get( 'contextSite' ) );
46
		$this->assertIsString( $result->get( 'contextSiteId' ) );
47
		$this->assertEquals( 'de', $result->get( 'contextLanguage' ) );
48
		$this->assertEquals( 'EUR', $result->get( 'contextCurrency' ) );
49
	}
50
}
51