Completed
Branch master (bb48cc)
by vijay
148:50 queued 92:39
created

ViewTest::setUp()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 33
Code Lines 24

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 33
rs 8.8571
cc 1
eloc 24
nc 1
nop 0
1
<?php
2
3
class ViewTest extends TestCase {
4
5
	public function setUp()
6
	{
7
		parent::setUp();
8
9
		$this->view = app('DaveJamesMiller\Breadcrumbs\View');
0 ignored issues
show
Bug introduced by
The property view does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
10
11
		$this->breadcrumbs = [
0 ignored issues
show
Bug introduced by
The property breadcrumbs does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
12
			(object) [
13
				'title' => 'Home',
14
				'url'   => '/',
15
				'first' => true,
16
				'last'  => false,
17
			],
18
			(object) [
19
				'title' => 'Not a link',
20
				'url'   => null, // Test non-links
21
				'first' => false,
22
				'last'  => false,
23
			],
24
			(object) [
25
				'title' => 'Blog & < >', // Test HTML escaping
26
				'url'   => '/blog',
27
				'first' => false,
28
				'last'  => false,
29
			],
30
			(object) [
31
				'title' => 'Sample Post',
32
				'url'   => '/blog/123',
33
				'first' => false,
34
				'last'  => true,
35
			],
36
		];
37
	}
38
39
	public function testBootstrap2()
40
	{
41
		$html = $this->view->render('breadcrumbs::bootstrap2', $this->breadcrumbs);
42
		$this->assertXmlStringEqualsXmlFile(__DIR__ . '/../fixtures/bootstrap2.html', $html);
43
	}
44
45
	public function testBootstrap3()
46
	{
47
		$html = $this->view->render('breadcrumbs::bootstrap3', $this->breadcrumbs);
48
		$this->assertXmlStringEqualsXmlFile(__DIR__ . '/../fixtures/bootstrap3.html', $html);
49
	}
50
51
}
52