Passed
Push — master ( bfeba0...b198de )
by Aimeos
06:28 queued 03:22
created

BladeTest::tearDown()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
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), 2017-2022
6
 */
7
8
namespace Aimeos\Base\View\Engine;
9
10
11
class BladeTest extends \PHPUnit\Framework\TestCase
12
{
13
	private $object;
14
	private $mock;
15
16
17
	protected function setUp() : void
18
	{
19
		if( !class_exists( '\Illuminate\View\Factory' ) ) {
20
			$this->markTestSkipped( '\Illuminate\View\Factory is not available' );
21
		}
22
23
		$this->mock = $this->getMockBuilder( \Illuminate\View\Factory::class )
24
			->setMethods( array( 'file' ) )
25
			->disableOriginalConstructor()
26
			->getMock();
27
28
		$this->object = new \Aimeos\Base\View\Engine\Blade( $this->mock );
29
	}
30
31
32
	protected function tearDown() : void
33
	{
34
		unset( $this->object, $this->mock );
35
	}
36
37
38
	public function testRender()
39
	{
40
		$v = new \Aimeos\Base\View\Standard( [] );
41
42
		$view = $this->getMockBuilder( \Illuminate\View\View::class )
43
			->setMethods( array( 'render' ) )
44
			->disableOriginalConstructor()
45
			->getMock();
46
47
		$view->expects( $this->once() )->method( 'render' )
48
			->will( $this->returnValue( 'test' ) );
49
50
		$this->mock->expects( $this->once() )->method( 'file' )
51
			->will( $this->returnValue( $view ) );
52
53
		$result = $this->object->render( $v, 'filepath', array( 'key' => 'value' ) );
54
		$this->assertEquals( 'test', $result );
55
	}
56
}
57