Passed
Push — master ( c9c1dd...eb7532 )
by Aimeos
18:11
created

StandardTest::testPush()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 7
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
/**
4
 * @license LGPLv3, https://opensource.org/licenses/LGPL-3.0
5
 * @copyright Metaways Infosystems GmbH, 2011
6
 * @copyright Aimeos (aimeos.org), 2015-2023
7
 */
8
9
10
namespace Aimeos\MShop\Service\Provider\Delivery;
11
12
13
class StandardTest extends \PHPUnit\Framework\TestCase
14
{
15
	private $context;
16
	private $object;
17
18
19
	protected function setUp() : void
20
	{
21
		$this->context = \TestHelper::context();
22
		$serviceManager = \Aimeos\MShop::create( $this->context, 'service' );
23
		$serviceItem = $serviceManager->create();
24
25
		$this->object = new \Aimeos\MShop\Service\Provider\Delivery\Standard( $this->context, $serviceItem );
26
	}
27
28
29
	protected function tearDown() : void
30
	{
31
		unset( $this->object );
32
	}
33
34
35
	public function testGetConfigBE()
36
	{
37
		$this->assertEquals( [], $this->object->getConfigBE() );
38
	}
39
40
41
	public function testGetConfigFE()
42
	{
43
		$basket = \Aimeos\MShop::create( $this->context, 'order' )->create();
44
45
		$this->assertEquals( [], $this->object->getConfigFE( $basket ) );
46
	}
47
48
49
	public function testPush()
50
	{
51
		$order = \Aimeos\MShop::create( $this->context, 'order' )->create();
52
53
		$result = $this->object->push( [$order] );
54
55
		$this->assertEquals( \Aimeos\MShop\Order\Item\Base::STAT_PENDING, $result->getStatusDelivery()->first() );
56
	}
57
58
59
	public function testSetConfigFE()
60
	{
61
		$item = \Aimeos\MShop::create( $this->context, 'order/service' )->create();
62
		$this->object->setConfigFE( $item, array( 'test.code' => 'abc', 'test.number' => 123 ) );
63
64
		$this->assertEquals( 2, count( $item->getAttributeItems() ) );
65
		$this->assertEquals( 'abc', $item->getAttribute( 'test.code', 'delivery' ) );
66
		$this->assertEquals( 123, $item->getAttribute( 'test.number', 'delivery' ) );
67
		$this->assertEquals( 'delivery', $item->getAttributeItem( 'test.code', 'delivery' )->getType() );
68
		$this->assertEquals( 'delivery', $item->getAttributeItem( 'test.number', 'delivery' )->getType() );
69
	}
70
71
}
72