Completed
Push — master ( 33f856...2c02d9 )
by Aimeos
10:22
created

BladeTest::tearDown()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
/**
4
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
5
 * @copyright Aimeos (aimeos.org), 2015-2016
6
 */
7
8
namespace Aimeos\MW\View\Engine;
9
10
11
class BladeTest extends \PHPUnit_Framework_TestCase
12
{
13
	private $object;
14
	private $mock;
15
16
17
	protected function setUp()
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' )
24
			->setMethods( array( 'file' ) )
25
			->disableOriginalConstructor()
26
			->getMock();
27
28
		$this->object = new \Aimeos\MW\View\Engine\Blade( $this->mock );
29
	}
30
31
32
	protected function tearDown()
33
	{
34
		unset( $this->object, $this->mock );
35
	}
36
37
38
	public function testRender()
39
	{
40
		$view = $this->getMockBuilder( '\Illuminate\View\View' )
41
			->setMethods( array( 'render' ) )
42
			->disableOriginalConstructor()
43
			->getMock();
44
45
		$view->expects( $this->once() )->method( 'render' )
46
			->will( $this->returnValue( 'test' ) );
47
48
		$this->mock->expects( $this->once() )->method( 'file' )
49
			->will( $this->returnValue( $view) );
50
51
		$result = $this->object->render( 'filepath', array( 'key' => 'value' ) );
52
		$this->assertEquals( 'test', $result );
53
	}
54
}
55