Completed
Push — master ( c1ac02...038e21 )
by Aimeos
02:23
created

FactoryTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A testCreateController() 0 10 1
A testCreateControllerInvalidImplementation() 0 5 1
A testCreateControllerInvalidName() 0 5 1
A testCreateControllerNotExisting() 0 5 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\Controller\Frontend\Supplier;
10
11
12
class FactoryTest extends \PHPUnit\Framework\TestCase
13
{
14
	public function testCreateController()
15
	{
16
		$target = '\\Aimeos\\Controller\\Frontend\\Supplier\\Iface';
17
18
		$controller = \Aimeos\Controller\Frontend\Supplier\Factory::createController( \TestHelperFrontend::getContext() );
19
		$this->assertInstanceOf( $target, $controller );
20
21
		$controller = \Aimeos\Controller\Frontend\Supplier\Factory::createController( \TestHelperFrontend::getContext(), 'Standard' );
22
		$this->assertInstanceOf( $target, $controller );
23
	}
24
25
26
	public function testCreateControllerInvalidImplementation()
27
	{
28
		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Exception' );
29
		\Aimeos\Controller\Frontend\Supplier\Factory::createController( \TestHelperFrontend::getContext(), 'Invalid' );
30
	}
31
32
33
	public function testCreateControllerInvalidName()
34
	{
35
		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Exception' );
36
		\Aimeos\Controller\Frontend\Supplier\Factory::createController( \TestHelperFrontend::getContext(), '%^' );
37
	}
38
39
40
	public function testCreateControllerNotExisting()
41
	{
42
		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Exception' );
43
		\Aimeos\Controller\Frontend\Supplier\Factory::createController( \TestHelperFrontend::getContext(), 'notexist' );
44
	}
45
}
46