EzpublishTest   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 12
c 2
b 0
f 0
dl 0
loc 35
rs 10
wmc 5

4 Methods

Rating   Name   Duplication   Size   Complexity  
A testSetEzUserService() 0 6 1
A testGetEzUserService() 0 4 1
A setUp() 0 8 2
A tearDown() 0 3 1
1
<?php
2
3
/**
4
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
5
 * @copyright Aimeos (aimeos.org), 2016-2020
6
 */
7
8
9
namespace Aimeos\MShop\Context\Item;
10
11
12
class EzpublishTest extends \PHPUnit\Framework\TestCase
13
{
14
	private $object;
15
16
17
	protected function setUp() : void
18
	{
19
		if( !interface_exists( 'eZ\Publish\API\Repository\UserService' ) ) {
20
			$this->markTestSkipped( 'Install ezsystems/ezpublish-api first' );
21
		}
22
23
		$this->mock = $this->getMockBuilder( 'eZ\Publish\API\Repository\UserService' )->getMock();
0 ignored issues
show
Bug Best Practice introduced by
The property mock does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
24
		$this->object = new \Aimeos\MShop\Context\Item\Ezpublish();
25
	}
26
27
28
	protected function tearDown() : void
29
	{
30
		unset( $this->object, $this->mock );
31
	}
32
33
34
	public function testGetEzUserService()
35
	{
36
		$this->expectException( '\\Aimeos\\MShop\\Exception' );
37
		$this->object->getEzUserService();
38
	}
39
40
41
	public function testSetEzUserService()
42
	{
43
		$return = $this->object->setEzUserService( $this->mock );
44
45
		$this->assertSame( $this->mock, $this->object->getEzUserService() );
46
		$this->assertInstanceOf( \Aimeos\MShop\Context\Item\Iface::class, $return );
47
	}
48
}
49