TestAbstract::getProcessorsPublic()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
5
 * @copyright Aimeos (aimeos.org), 2015-2025
6
 */
7
8
9
namespace Aimeos\Controller\Jobs\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 = \TestHelper::context();
22
		$aimeos = \TestHelper::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( \LogicException::class );
37
		$this->object->getCachePublic( '$' );
38
	}
39
40
41
	public function testGetCacheInvalidClass()
42
	{
43
		$this->expectException( \LogicException::class );
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\\Jobs\\Common\\Supplier\\Import\\Csv\\Processor\\Iface', $processor );
53
	}
54
55
56
	public function testGetProcessorsInvalidType()
57
	{
58
		$this->expectException( \LogicException::class );
59
		$this->object->getProcessorsPublic( array( '$' => [] ) );
60
	}
61
62
63
	public function testGetProcessorsInvalidClass()
64
	{
65
		$this->expectException( \LogicException::class );
66
		$this->object->getProcessorsPublic( array( 'unknown' => [] ) );
67
	}
68
69
70
	public function testGetProcessorsInvalidInterface()
71
	{
72
		$this->expectException( \LogicException::class );
73
		$this->object->getProcessorsPublic( array( 'unknown' => [] ) );
74
	}
75
}
76
77
78
class TestAbstract
79
	extends \Aimeos\Controller\Jobs\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