JQAdmTest   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 21
c 1
b 0
f 0
dl 0
loc 56
rs 10
wmc 7

7 Methods

Rating   Name   Duplication   Size   Complexity  
A testCreateClient() 0 5 1
A testCreateClientNameNotFound() 0 4 1
A testCreateClientName() 0 5 1
A testCreateClientNameEmpty() 0 4 1
A setUp() 0 5 1
A testCreateClientNameInvalid() 0 4 1
A testCreateSubClient() 0 5 1
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\Admin;
10
11
12
class JQAdmTest extends \PHPUnit\Framework\TestCase
13
{
14
	private $aimeos;
15
	private $context;
16
17
18
	protected function setUp() : void
19
	{
20
		$this->aimeos = \TestHelper::getAimeos();
21
		$this->context = \TestHelper::context();
22
		$this->context->setView( \TestHelper::view() );
23
	}
24
25
26
	public function testCreateClient()
27
	{
28
		$this->context->config()->set( 'admin/jqadm/resources', ['product'] );
29
		$client = \Aimeos\Admin\JQAdm::create( $this->context, $this->aimeos, 'product' );
30
		$this->assertInstanceOf( '\\Aimeos\\Admin\\JQAdm\\Iface', $client );
31
	}
32
33
34
	public function testCreateClientName()
35
	{
36
		$this->context->config()->set( 'admin/jqadm/resources', ['product'] );
37
		$client = \Aimeos\Admin\JQAdm::create( $this->context, $this->aimeos, 'product', 'Standard' );
38
		$this->assertInstanceOf( '\\Aimeos\\Admin\\JQAdm\\Iface', $client );
39
	}
40
41
42
	public function testCreateSubClient()
43
	{
44
		$this->context->config()->set( 'admin/jqadm/resources', ['type'] );
45
		$client = \Aimeos\Admin\JQAdm::create( $this->context, $this->aimeos, 'type' );
46
		$this->assertInstanceOf( '\\Aimeos\\Admin\\JQAdm\\Iface', $client );
47
	}
48
49
50
	public function testCreateClientNameEmpty()
51
	{
52
		$this->expectException( '\\Aimeos\\Admin\\JQAdm\\Exception' );
53
		\Aimeos\Admin\JQAdm::create( $this->context, $this->aimeos, '' );
54
	}
55
56
57
	public function testCreateClientNameInvalid()
58
	{
59
		$this->expectException( \LogicException::class );
60
		\Aimeos\Admin\JQAdm::create( $this->context, $this->aimeos, '%^unknown' );
61
	}
62
63
64
	public function testCreateClientNameNotFound()
65
	{
66
		$this->expectException( \LogicException::class );
67
		\Aimeos\Admin\JQAdm::create( $this->context, $this->aimeos, 'unknown' );
68
	}
69
70
}
71