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

FactoryTest::testCreateClientInvalidName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 0
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
}