MenuRepositoryTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 1
cbo 3
dl 0
loc 18
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A it_creates_menu() 0 7 1
A it_should_create_root_item_when_creating_new_menu() 0 6 1
1
<?php namespace Modules\Menu\Tests;
2
3
class MenuRepositoryTest extends BaseMenuTest
4
{
5
    /** @test */
6
    public function it_creates_menu()
7
    {
8
        $menu = $this->createMenu('main', 'Main Menu');
9
10
        $this->assertEquals(1, $this->menu->find($menu->id)->count());
11
        $this->assertEquals($menu->name, $this->menu->find($menu->id)->name);
12
    }
13
14
    public function it_should_create_root_item_when_creating_new_menu()
15
    {
16
        $menu = $this->createMenu('main', 'Main Menu');
17
18
        $items = $this->menuItem->allRootsForMenu($menu->id);
0 ignored issues
show
Unused Code introduced by
$items 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...
19
    }
20
}
21