Completed
Pull Request — master (#25)
by
unknown
02:59
created

BaseTest   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 62
Duplicated Lines 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
eloc 19
c 1
b 1
f 0
dl 0
loc 62
rs 10
wmc 8

8 Methods

Rating   Name   Duplication   Size   Complexity  
A testGetCacheInvalidType() 0 4 1
A testGetProcessorsInvalidInterface() 0 4 1
A setUp() 0 8 1
A testGetProcessors() 0 5 1
A testGetCacheInvalidClass() 0 4 1
A testGetProcessorsInvalidClass() 0 4 1
A tearDown() 0 3 1
A testGetProcessorsInvalidType() 0 4 1
1
<?php
2
3
/**
4
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
5
 * @copyright Aimeos (aimeos.org), 2015-2020
6
 */
7
8
9
namespace Aimeos\Controller\Common\Supplier\Import\Csv;
10
11
12
class BaseTest extends \PHPUnit\Framework\TestCase
13
{
14
	private $object;
15
16
17
	protected function setUp() : void
18
	{
19
		\Aimeos\MShop::cache( true );
20
21
		$context = \TestHelperCntl::getContext();
22
		$aimeos = \TestHelperCntl::getAimeos();
23
24
		$this->object = new TestAbstract( $context, $aimeos );
25
	}
26
27
28
	protected function tearDown() : void
29
	{
30
		\Aimeos\MShop::cache( false );
31
	}
32
33
34
	public function testGetCacheInvalidType()
35
	{
36
		$this->expectException( '\\Aimeos\\Controller\\Jobs\\Exception' );
37
		$this->object->getCachePublic( '$' );
38
	}
39
40
41
	public function testGetCacheInvalidClass()
42
	{
43
		$this->expectException( '\\Aimeos\\Controller\\Jobs\\Exception' );
44
		$this->object->getCachePublic( 'unknown' );
45
	}
46
47
48
	public function testGetProcessors()
49
	{
50
		$processor = $this->object->getProcessorsPublic( array( 'media' => [] ) );
51
52
		$this->assertInstanceOf( '\\Aimeos\\Controller\\Common\\Supplier\\Import\\Csv\\Processor\\Iface', $processor );
53
	}
54
55
56
	public function testGetProcessorsInvalidType()
57
	{
58
		$this->expectException( '\\Aimeos\\Controller\\Jobs\\Exception' );
59
		$this->object->getProcessorsPublic( array( '$' => [] ) );
60
	}
61
62
63
	public function testGetProcessorsInvalidClass()
64
	{
65
		$this->expectException( '\\Aimeos\\Controller\\Jobs\\Exception' );
66
		$this->object->getProcessorsPublic( array( 'unknown' => [] ) );
67
	}
68
69
70
	public function testGetProcessorsInvalidInterface()
71
	{
72
		$this->expectException( '\\Aimeos\\Controller\\Jobs\\Exception' );
73
		$this->object->getProcessorsPublic( array( 'unknown' => [] ) );
74
	}
75
}
76
77
78
class TestAbstract
79
	extends \Aimeos\Controller\Common\Supplier\Import\Csv\Base
80
{
81
	public function getCachePublic( $type, $name = null )
82
	{
83
		return $this->getCache( $type, $name );
84
	}
85
86
87
	public function getProcessorsPublic( array $mappings )
88
	{
89
		return $this->getProcessors( $mappings );
90
	}
91
}
92
93
94
class TestInvalid
95
{
96
}
97