HomePageTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2
Metric Value
wmc 3
lcom 1
cbo 2
dl 0
loc 37
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testHomePageRedirects() 0 6 1
A testIntroductionPage() 0 8 1
A testRedirectOnFileNotFound() 0 6 1
1
<?php
2
3
class HomePageTest extends TestCase {
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
4
5
	/**
6
	 * Test Home Page Redirects
7
	 *
8
	 */
9
	public function testHomePageRedirects()
10
	{
11
		$page = $this->client->request('GET', '/');
0 ignored issues
show
Unused Code introduced by
$page is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
12
13
		$this->assertTrue($this->client->getResponse()->isRedirect());
14
	}
15
16
	/**
17
	 * Test Introduction Page loads correctly
18
	 *
19
     */
20
	public function testIntroductionPage()
21
	{
22
		$page = $this->client->request('GET', '/4.1/introduction/');
23
24
		$this->assertTrue($this->client->getResponse()->isOk());
25
26
		$this->assertCount(1, $page->filter('h1:contains("Introducción")'));
27
	}
28
29
	/**
30
	 * Test redirect on file not found
31
	 *
32
	 */
33
	public function testRedirectOnFileNotFound()
34
	{
35
		$page = $this->client->request('GET', '6.0/exit');
0 ignored issues
show
Unused Code introduced by
$page is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
36
37
		$this->assertTrue($this->client->getResponse()->isRedirect());
38
	}
39
}
40