Completed
Push — master ( 819e18...3a2973 )
by Aimeos
07:33
created

FactoryTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

4 Methods

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