Completed
Push — master ( 222791...8272bb )
by Aimeos
02:51
created

FactoryTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 2
dl 0
loc 41
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A testCreateClient() 0 8 1
A testCreateClientEmpty() 0 8 1
A testCreateClientInvalidPath() 0 8 1
A testCreateClientInvalidName() 0 8 1
1
<?php
2
3
/**
4
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
5
 * @copyright Aimeos (aimeos.org), 2017
6
 */
7
8
9
namespace Aimeos\Client\JsonApi\Customer\Relationships;
10
11
12
class FactoryTest extends \PHPUnit\Framework\TestCase
13
{
14
	public function testCreateClient()
15
	{
16
		$context = \TestHelperJapi::getContext();
17
		$templatePaths = \TestHelperJapi::getTemplatePaths();
18
19
		$client = \Aimeos\Client\JsonApi\Customer\Relationships\Factory::createClient( $context, $templatePaths, 'customer/relationships' );
20
		$this->assertInstanceOf( '\Aimeos\Client\JsonApi\Iface', $client );
21
	}
22
23
24
	public function testCreateClientEmpty()
25
	{
26
		$context = \TestHelperJapi::getContext();
27
		$templatePaths = \TestHelperJapi::getTemplatePaths();
28
29
		$this->setExpectedException( '\Aimeos\Client\JsonApi\Exception' );
30
		\Aimeos\Client\JsonApi\Customer\Relationships\Factory::createClient( $context, $templatePaths, '' );
31
	}
32
33
34
	public function testCreateClientInvalidPath()
35
	{
36
		$context = \TestHelperJapi::getContext();
37
		$templatePaths = \TestHelperJapi::getTemplatePaths();
38
39
		$this->setExpectedException( '\Aimeos\Client\JsonApi\Exception' );
40
		\Aimeos\Client\JsonApi\Customer\Relationships\Factory::createClient( $context, $templatePaths, '%^' );
41
	}
42
43
44
	public function testCreateClientInvalidName()
45
	{
46
		$context = \TestHelperJapi::getContext();
47
		$templatePaths = \TestHelperJapi::getTemplatePaths();
48
49
		$this->setExpectedException( '\Aimeos\Client\JsonApi\Exception' );
50
		\Aimeos\Client\JsonApi\Customer\Relationships\Factory::createClient( $context, $templatePaths, 'customer/relationships', '%^' );
51
	}
52
}