Passed
Push — master ( 456c1d...dbc4ac )
by Aimeos
22:40 queued 19:49
created

StandardTest::testTransformCatalog()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 6
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), 2019-2022
6
 */
7
8
9
namespace Aimeos\Base\View\Helper\Jincluded;
10
11
12
class StandardTest extends \PHPUnit\Framework\TestCase
13
{
14
	private $object;
15
16
17
	protected function setUp() : void
18
	{
19
		$this->object = new \Aimeos\Base\View\Helper\Jincluded\Standard( new \Aimeos\Base\View\Standard() );
20
	}
21
22
23
	protected function tearDown() : void
24
	{
25
		unset( $this->object );
26
	}
27
28
29
	public function testTransformCatalog()
30
	{
31
		$manager = \Aimeos\MShop::create( \TestHelper::context(), 'catalog' );
32
		$tree = $manager->getTree( $manager->find( 'group' )->getId(), ['media', 'text'] );
33
34
		$this->assertEquals( 13, map( $this->object->transform( $tree, [] ) )->flat( 1 )->count() );
35
	}
36
37
38
	public function testTransformCustomer()
39
	{
40
		$domains = ['customer/address', 'customer/property'];
41
		$item = \Aimeos\MShop::create( \TestHelper::context(), 'customer' )->find( '[email protected]', $domains );
42
43
		$this->assertEquals( 2, map( $this->object->transform( $item, [] ) )->flat( 1 )->count() );
44
	}
45
46
47
	public function testTransformProduct()
48
	{
49
		$domains = ['attribute', 'catalog', 'media', 'price', 'product', 'product/property', 'supplier', 'stock', 'text'];
50
		$item = \Aimeos\MShop::create( \TestHelper::context(), 'product' )->find( 'CNE', $domains );
51
52
		$this->assertGreaterThanOrEqual( 74, map( $this->object->transform( $item, [] ) )->flat( 1 )->count() );
53
	}
54
55
56
	public function testTransformProducts()
57
	{
58
		$domains = ['attribute', 'catalog', 'media', 'price', 'product', 'product/property', 'supplier', 'stock', 'text'];
59
		$item = \Aimeos\MShop::create( \TestHelper::context(), 'product' )->find( 'CNE', $domains );
60
61
		$this->assertGreaterThanOrEqual( 74, map( $this->object->transform( [$item], [] ) )->flat( 1 )->count() );
62
	}
63
}
64