Passed
Push — master ( 7d59ae...ea2796 )
by Aimeos
04:11
created

StandardTest::testGetDescription()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 4
rs 10
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\Jobs\Customer\Group\Import\Xml;
10
11
12
class StandardTest extends \PHPUnit\Framework\TestCase
13
{
14
	private $object;
15
	private $context;
16
	private $aimeos;
17
18
19
	protected function setUp() : void
20
	{
21
		\Aimeos\MShop::cache( true );
22
23
		$this->context = \TestHelperJobs::getContext();
24
		$this->aimeos = \TestHelperJobs::getAimeos();
25
26
		$config = $this->context->getConfig();
27
		$config->set( 'controller/jobs/customer/group/import/xml/location', __DIR__ . '/_testfiles' );
28
29
		$this->object = new \Aimeos\Controller\Jobs\Customer\Group\Import\Xml\Standard( $this->context, $this->aimeos );
30
	}
31
32
33
	protected function tearDown() : void
34
	{
35
		\Aimeos\MShop::cache( false );
36
		unset( $this->object, $this->context, $this->aimeos );
37
	}
38
39
40
	public function testGetName()
41
	{
42
		$this->assertEquals( 'Customer group import XML', $this->object->getName() );
43
	}
44
45
46
	public function testGetDescription()
47
	{
48
		$text = 'Imports new and updates existing customer groups from XML files';
49
		$this->assertEquals( $text, $this->object->getDescription() );
50
	}
51
52
53
	public function testRun()
54
	{
55
		$this->object->run();
56
57
		$manager = \Aimeos\MShop::create( $this->context, 'customer/group' );
58
		$item = $manager->findItem( 'test' );
59
		$manager->deleteItem( $item );
60
61
		$this->assertEquals( 'Test group', $item->getLabel() );
62
		$this->assertEquals( 'test', $item->getCode() );
63
	}
64
}
65