Completed
Push — master ( f157ac...a775dd )
by Aimeos
03:15
created

FactoryTest   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 6
c 1
b 0
f 0
lcom 1
cbo 3
dl 0
loc 49
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 6 1
A testCreateClient() 0 5 1
A testCreateClientName() 0 5 1
A testCreateClientNameEmpty() 0 5 1
A testCreateClientNameInvalid() 0 5 1
A testCreateClientNameNotFound() 0 5 1
1
<?php
2
3
namespace Aimeos\Admin\JQAdm\Product;
4
5
6
/**
7
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
8
 * @copyright Aimeos (aimeos.org), 2016
9
 */
10
class FactoryTest extends \PHPUnit_Framework_TestCase
11
{
12
	private $context;
13
	private $templatePaths;
14
15
16
	protected function setUp()
17
	{
18
		$this->templatePaths = \TestHelperJqadm::getTemplatePaths();
19
		$this->context = \TestHelperJqadm::getContext();
20
		$this->context->setView( \TestHelperJqadm::getView() );
21
	}
22
23
24
	public function testCreateClient()
25
	{
26
		$client = \Aimeos\Admin\JQAdm\Product\Factory::createClient( $this->context, $this->templatePaths );
27
		$this->assertInstanceOf( '\\Aimeos\\Admin\\JQAdm\\Iface', $client );
28
	}
29
30
31
	public function testCreateClientName()
32
	{
33
		$client = \Aimeos\Admin\JQAdm\Product\Factory::createClient( $this->context, $this->templatePaths, 'Standard' );
34
		$this->assertInstanceOf( '\\Aimeos\\Admin\\JQAdm\\Iface', $client );
35
	}
36
37
38
	public function testCreateClientNameEmpty()
39
	{
40
		$this->setExpectedException( '\\Aimeos\\Admin\\JQAdm\\Exception' );
1 ignored issue
show
Deprecated Code introduced by
The method PHPUnit_Framework_TestCase::setExpectedException() has been deprecated with message: Method deprecated since Release 5.2.0

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
41
		\Aimeos\Admin\JQAdm\Product\Factory::createClient( $this->context, $this->templatePaths, '' );
42
	}
43
44
45
	public function testCreateClientNameInvalid()
46
	{
47
		$this->setExpectedException( '\\Aimeos\\Admin\\JQAdm\\Exception' );
1 ignored issue
show
Deprecated Code introduced by
The method PHPUnit_Framework_TestCase::setExpectedException() has been deprecated with message: Method deprecated since Release 5.2.0

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
48
		\Aimeos\Admin\JQAdm\Product\Factory::createClient( $this->context, $this->templatePaths, '%product' );
49
	}
50
51
52
	public function testCreateClientNameNotFound()
53
	{
54
		$this->setExpectedException( '\\Aimeos\\Admin\\JQAdm\\Exception' );
1 ignored issue
show
Deprecated Code introduced by
The method PHPUnit_Framework_TestCase::setExpectedException() has been deprecated with message: Method deprecated since Release 5.2.0

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
55
		\Aimeos\Admin\JQAdm\Product\Factory::createClient( $this->context, $this->templatePaths, 'test' );
56
	}
57
58
}
59