Completed
Push — master ( dc433d...4234c3 )
by Aimeos
08:12
created

SingletonTest::tearDown()   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-2016
6
 */
7
8
9
namespace Aimeos\MShop\Plugin\Provider\Decorator;
10
11
12
class SingletonTest extends \PHPUnit\Framework\TestCase
13
{
14
	private $mock;
15
	private $order;
16
	private $object;
17
18
19
	protected function setUp()
20
	{
21
		$context = \TestHelperMShop::getContext();
22
23
		$priceItem = \Aimeos\MShop\Price\Manager\Factory::createManager( $context )->createItem();
24
		$this->order = new \Aimeos\MShop\Order\Item\Base\Standard( $priceItem, $context->getLocale() );
25
26
		$pluginManager = \Aimeos\MShop\Plugin\Manager\Factory::createManager( $context );
27
		$item = $pluginManager->createItem();
28
29
30
		$this->mock = $this->getMockBuilder( '\Aimeos\MShop\Plugin\Provider\Decorator\Example' )
31
			->disableOriginalConstructor()
32
			->setMethods( ['update'] )
33
			->getMock();
34
35
		$this->object = new \Aimeos\MShop\Plugin\Provider\Decorator\Singleton( $context, $item, $this->mock );
36
	}
37
38
39
	protected function tearDown()
40
	{
41
		unset( $this->object, $this->order, $this->mock );
42
	}
43
44
45
	public function testUpdate()
46
	{
47
		$this->mock->expects( $this->once() )->method( 'update' )->will( $this->returnValue( true ) );
48
49
		$this->assertTrue( $this->object->update( $this->order, 'test', 'value' ) );
50
	}
51
}
52