Passed
Push — main ( f9f23c...f7616c )
by Aimeos
05:03
created

FactoryTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 12
c 1
b 0
f 0
dl 0
loc 32
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A testCreateController() 0 9 1
A testCreateControllerInvalidImplementation() 0 4 1
A testCreateControllerInvalidName() 0 4 1
A testCreateControllerNotExisting() 0 4 1
1
<?php
2
3
/**
4
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
5
 * @copyright Aimeos (aimeos.org), 2021
6
 */
7
8
9
namespace Aimeos\Controller\Frontend\Cms;
10
11
12
class FactoryTest extends \PHPUnit\Framework\TestCase
0 ignored issues
show
Bug introduced by
The type PHPUnit\Framework\TestCase was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
13
{
14
	public function testCreateController()
15
	{
16
		$target = '\\Aimeos\\Controller\\Frontend\\Cms\\Iface';
17
18
		$controller = \Aimeos\Controller\Frontend\Cms\Factory::create( \TestHelperFrontend::getContext() );
19
		$this->assertInstanceOf( $target, $controller );
20
21
		$controller = \Aimeos\Controller\Frontend\Cms\Factory::create( \TestHelperFrontend::getContext(), 'Standard' );
22
		$this->assertInstanceOf( $target, $controller );
23
	}
24
25
26
	public function testCreateControllerInvalidImplementation()
27
	{
28
		$this->expectException( '\\Aimeos\\MW\\Common\\Exception' );
29
		\Aimeos\Controller\Frontend\Cms\Factory::create( \TestHelperFrontend::getContext(), 'Invalid' );
30
	}
31
32
33
	public function testCreateControllerInvalidName()
34
	{
35
		$this->expectException( '\\Aimeos\\Controller\\Frontend\\Exception' );
36
		\Aimeos\Controller\Frontend\Cms\Factory::create( \TestHelperFrontend::getContext(), '%^' );
37
	}
38
39
40
	public function testCreateControllerNotExisting()
41
	{
42
		$this->expectException( '\\Aimeos\\Controller\\Frontend\\Exception' );
43
		\Aimeos\Controller\Frontend\Cms\Factory::create( \TestHelperFrontend::getContext(), 'notexist' );
44
	}
45
}
46