Passed
Push — master ( e3443a...9a4066 )
by Aimeos
01:47
created

StandardTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 13
dl 0
loc 36
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 4 1
A testProcess() 0 17 1
A tearDown() 0 3 1
1
<?php
2
3
/**
4
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
5
 * @copyright Aimeos (aimeos.org), 2019
6
 */
7
8
9
namespace Aimeos\Controller\Common\Common\Import\Xml\Processor\Lists;
10
11
12
class StandardTest extends \PHPUnit\Framework\TestCase
1 ignored issue
show
Bug introduced by
The type PHPUnit\Framework\TestCase was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
13
{
14
	private $context;
15
	private $object;
16
17
18
	protected function setUp()
19
	{
20
		$this->context = \TestHelperCntl::getContext();
21
		$this->object = new \Aimeos\Controller\Common\Common\Import\Xml\Processor\Lists\Standard( $this->context );
22
	}
23
24
25
	protected function tearDown()
26
	{
27
		unset( $this->object, $this->context );
28
	}
29
30
31
	public function testProcess()
32
	{
33
		$dom = new \DOMDocument();
34
		$product = \Aimeos\MShop::create( $this->context, 'product' )->createItem();
35
36
		$dom->loadXML( '<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
37
<lists>
38
	<text><textitem></textitem></text>
39
	<media><mediaitem></mediaitem></media>
40
	<price><priceitem></priceitem></price>
41
</lists>' );
42
43
		$product = $this->object->process( $product, $dom->firstChild );
44
45
		$this->assertEquals( 1, count( $product->getListItems( 'text' ) ) );
46
		$this->assertEquals( 1, count( $product->getListItems( 'media' ) ) );
47
		$this->assertEquals( 1, count( $product->getListItems( 'price' ) ) );
48
	}
49
}
50