Completed
Push — master ( aa5a0d...109f75 )
by Peter
05:58
created

PhpTest::testIfWillForwardPropertyToOwner()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 8
rs 9.4285
cc 1
eloc 4
nc 1
nop 0
1
<?php
2
3
namespace Renderers;
4
5
use Maslosoft\MiniView\MiniView;
6
use UnitTester;
7
8
class PhpTest extends \Codeception\TestCase\Test
9
{
10
11
	/**
12
	 * @var UnitTester
13
	 */
14
	protected $tester;
15
16
	/**
17
	 * NOTE: Do not remove, part of test
18
	 * @var string
19
	 */
20
	public $value = 'property value';
21
22
	// tests
23 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...
24
	{
25
		$var = 'New Variable';
26
27
		$view = new MiniView($this);
28
29
		$result = $view->render('passVariable', ['var' => $var], true);
30
31
		$this->assertSame($var, $result);
32
	}
33
34
	public function testIfWillForwardMethodToOwner()
35
	{
36
		$view = new MiniView($this);
37
38
		$result = $view->render('forwardMethod', [], true);
39
40
		$this->assertSame($this->getValue(), $result);
41
	}
42
43
	public function testIfWillForwardPropertyToOwner()
44
	{
45
		$view = new MiniView($this);
46
47
		$result = $view->render('forwardProperty', [], true);
48
49
		$this->assertSame($this->value, $result);
50
	}
51
52
	public function getValue()
53
	{
54
		return 'my value from method';
55
	}
56
57
}
58