Skip to content

Commit 7b5f40b

Browse files
committed
Add menu tests
1 parent 6bedba6 commit 7b5f40b

File tree

6 files changed

+656
-1
lines changed

6 files changed

+656
-1
lines changed

laravel/app/MenuBuilder/MenuBuilder.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,11 +167,13 @@ public function beginDropdown($id, $href, $name, $icon = false, $iconType = 'cor
167167
}
168168

169169
public function endDropdown(){
170-
$this->dropdown = false;
171170
$this->dropdownDeep--;
172171
if($this->dropdownDeep < 0){
173172
$this->dropdownDeep = 0;
174173
}
174+
if($this->dropdownDeep <= 0){
175+
$this->dropdown = false;
176+
}
175177
}
176178

177179
public function getResult(){
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
/** @var \Illuminate\Database\Eloquent\Factory $factory */
4+
5+
use App\Menurole;
6+
use Faker\Generator as Faker;
7+
use Illuminate\Support\Str;
8+
9+
$factory->define(Menurole::class, function (Faker $faker) {
10+
return [
11+
'role_name' => 'guest',
12+
'menus_id' => factory(App\Menus::class)->create()->id,
13+
];
14+
});
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
/** @var \Illuminate\Database\Eloquent\Factory $factory */
4+
5+
use App\Menus;
6+
use Faker\Generator as Faker;
7+
use Illuminate\Support\Str;
8+
9+
$factory->define(Menus::class, function (Faker $faker) {
10+
return [
11+
'name' => $faker->sentence(4,true),
12+
'href' => '/href',
13+
'icon' => NULL,
14+
'slug' => 'link',
15+
'parent_id' => NULL,
16+
'menu_id' => 1,
17+
'sequence' => 1
18+
];
19+
});

0 commit comments

Comments
 (0)