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

BladeTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 1
dl 0
loc 44
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 13 2
A tearDown() 0 4 1
A testRender() 0 16 1
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