Completed
Push — master ( 9a7fc1...319399 )
by Peter
01:58
created

testIfWillPassVariableToViewWithRendererDetection()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 6

Duplication

Lines 10
Ratio 100 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
c 1
b 1
f 0
dl 10
loc 10
rs 9.4285
cc 1
eloc 6
nc 1
nop 0
1
<?php
2
3
namespace Renderers;
4
5
use Maslosoft\MiniView\MiniView;
6
use Maslosoft\MiniView\Renderers\PhpRenderer;
7
use UnitTester;
8
9
class PhpTest extends \Codeception\TestCase\Test
10
{
11
12
	/**
13
	 * @var UnitTester
14
	 */
15
	protected $tester;
16
17
	/**
18
	 * NOTE: Do not remove, part of test
19
	 * @var string
20
	 */
21
	public $value = 'property value';
22
23
	// tests
24 View Code Duplication
	public function testIfWillPassVariableToView()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
25
	{
26
		$var = 'New Variable';
27
28
		$view = new MiniView($this);
29
30
		$result = $view->render('passVariable', ['var' => $var], true);
31
32
		$this->assertSame($var, $result);
33
	}
34
35
	// tests
36 View Code Duplication
	public function testIfWillPassVariableToViewWithRendererDetection()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
37
	{
38
		$var = 'New Variable';
39
40
		$view = new MiniView($this);
41
		$view->setRenderer(new PhpRenderer());
42
		$result = $view->render('passVariable.php', ['var' => $var], true);
43
44
		$this->assertSame($var, $result);
45
	}
46
47
	public function testIfWillForwardMethodToOwner()
48
	{
49
		$view = new MiniView($this);
50
51
		$result = $view->render('forwardMethod', [], true);
52
53
		$this->assertSame($this->getValue(), $result);
54
	}
55
56
	public function testIfWillForwardPropertyToOwner()
57
	{
58
		$view = new MiniView($this);
59
60
		$result = $view->render('forwardProperty', [], true);
61
62
		$this->assertSame($this->value, $result);
63
	}
64
65
	public function getValue()
66
	{
67
		return 'my value from method';
68
	}
69
70
}
71