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; |
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\Factory::createClient( $context, $templatePaths, 'customer' ); |
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\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\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\Factory::createClient( $context, $templatePaths, 'customer', '%^' ); |
51
|
|
|
} |
52
|
|
|
} |