Completed
Push — 2016.04 ( 690368...e61816 )
by Aimeos
04:37
created

Typo3Test   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 57
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 6
c 1
b 0
f 0
lcom 1
cbo 2
dl 0
loc 57
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A tearDown() 0 4 1
A testCleanup() 0 4 1
A setUp() 0 7 1
A testSaveItem() 0 7 1
A testDeleteItem() 0 5 1
A testSearchItem() 0 12 1
1
<?php
2
3
namespace Aimeos\MShop\Common\Manager\Group;
4
5
6
/**
7
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
8
 * @copyright Aimeos (aimeos.org), 2015
9
 */
10
class Typo3Test extends \PHPUnit_Framework_TestCase
11
{
12
	private $object = null;
13
	private $editor = '';
14
15
16
	protected function setUp()
17
	{
18
		$context = \TestHelper::getContext();
19
		$this->editor = $context->getEditor();
20
21
		$this->object = new \Aimeos\MShop\Customer\Manager\Group\Typo3( $context );
22
	}
23
24
25
	protected function tearDown()
26
	{
27
		unset( $this->object );
28
	}
29
30
31
	public function testCleanup()
32
	{
33
		$this->object->cleanup( array( -1 ) );
34
	}
35
36
37
	public function testSaveItem()
38
	{
39
		$item = new \Aimeos\MShop\Customer\Item\Group\Standard();
40
41
		$this->setExpectedException( '\\Aimeos\\MShop\\Customer\\Exception' );
42
		$this->object->saveItem( $item );
43
	}
44
45
46
	public function testDeleteItem()
47
	{
48
		$this->setExpectedException( '\\Aimeos\\MShop\\Customer\\Exception' );
49
		$this->object->deleteItem( -1 );
50
	}
51
52
53
	public function testSearchItem()
54
	{
55
		$search = $this->object->createSearch();
56
		$search->setConditions( $search->compare( '==', 'customer.group.label', 'Unit test group' ) );
57
		$search->setSlice( 0, 1 );
58
59
		$total = 0;
60
		$results = $this->object->searchItems( $search, array(), $total );
61
62
		$this->assertEquals( 1, count( $results ) );
63
		$this->assertEquals( 1, $total );
64
	}
65
66
}
67