Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
laravel-adminpanel
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
laravel-adminpanel
Commits
48809bd4
Unverified
Commit
48809bd4
authored
Jan 02, 2018
by
Vipul Basapati
Committed by
GitHub
Jan 02, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #124 from bvipul/develop
Blog Tags Test complete
parents
8b8ac133
1c2ee785
Changes
20
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
197 additions
and
61 deletions
+197
-61
BlogCategoriesController.php
...llers/Backend/BlogCategories/BlogCategoriesController.php
+3
-3
BlogTagsController.php
app/Http/Controllers/Backend/BlogTags/BlogTagsController.php
+12
-12
BlogCategoryRelationship.php
...tegories/Traits/Relationship/BlogCategoryRelationship.php
+2
-2
BlogTagRelationship.php
...dels/BlogTags/Traits/Relationship/BlogTagRelationship.php
+2
-2
BlogTagFactory.php
database/factories/BlogTagFactory.php
+15
-0
2017_11_02_060149_create_blog_categories_table.php
...ations/2017_11_02_060149_create_blog_categories_table.php
+1
-1
MenuTableSeeder.php
database/seeds/MenuTableSeeder.php
+1
-1
create.blade.php
resources/views/backend/blogtags/create.blade.php
+2
-2
edit.blade.php
resources/views/backend/blogtags/edit.blade.php
+2
-2
index.blade.php
resources/views/backend/blogtags/index.blade.php
+1
-1
blogtags-header-buttons.blade.php
...ckend/blogtags/partials/blogtags-header-buttons.blade.php
+3
-3
sidebar.blade.php
resources/views/backend/includes/sidebar.blade.php
+2
-2
BlogTags.php
routes/Backend/BlogTags.php
+3
-3
ManageBlogCategoriesTest.php
tests/Feature/Backend/ManageBlogCategoriesTest.php
+9
-8
ManageBlogTagsTest.php
tests/Feature/Backend/ManageBlogTagsTest.php
+80
-0
ManagePagesTest.php
tests/Feature/Backend/ManagePagesTest.php
+12
-0
BlogCategoryTest.php
tests/Unit/BlogCategoryTest.php
+0
-18
BlogCategoryTest.php
tests/Unit/Models/BlogCategoryTest.php
+24
-0
BlogTagTest.php
tests/Unit/Models/BlogTagTest.php
+22
-0
PageTest.php
tests/Unit/Models/PageTest.php
+1
-1
No files found.
app/Http/Controllers/Backend/BlogCategories/BlogCategoriesController.php
View file @
48809bd4
...
...
@@ -62,7 +62,7 @@ class BlogCategoriesController extends Controller
}
/**
* @param \App\Models\BlogCategories\BlogCategory $blog
c
ategory
* @param \App\Models\BlogCategories\BlogCategory $blog
C
ategory
* @param \App\Http\Requests\Backend\BlogCategories\EditBlogCategoriesRequest $request
*
* @return mixed
...
...
@@ -74,7 +74,7 @@ class BlogCategoriesController extends Controller
}
/**
* @param \App\Models\BlogCategories\BlogCategory $blog
c
ategory
* @param \App\Models\BlogCategories\BlogCategory $blog
C
ategory
* @param \App\Http\Requests\Backend\BlogCategories\UpdateBlogCategoriesRequest $request
*
* @return mixed
...
...
@@ -89,7 +89,7 @@ class BlogCategoriesController extends Controller
}
/**
* @param \App\Models\BlogCategories\BlogCategory $blog
c
ategory
* @param \App\Models\BlogCategories\BlogCategory $blog
C
ategory
* @param \App\Http\Requests\Backend\BlogCategories\DeleteBlogCategoriesRequest $request
*
* @return mixed
...
...
app/Http/Controllers/Backend/BlogTags/BlogTagsController.php
View file @
48809bd4
...
...
@@ -60,49 +60,49 @@ class BlogTagsController extends Controller
$this
->
blogtag
->
create
(
$request
->
except
(
'token'
));
return
redirect
()
->
route
(
'admin.blog
t
ags.index'
)
->
route
(
'admin.blog
T
ags.index'
)
->
with
(
'flash_success'
,
trans
(
'alerts.backend.blogtags.created'
));
}
/**
* @param \App\Models\BlogTags\BlogTag $blog
t
ag
* @param \App\Models\BlogTags\BlogTag $blog
T
ag
* @param \App\Http\Requests\Backend\BlogTags\EditBlogTagsRequest $request
*
* @return mixed
*/
public
function
edit
(
BlogTag
$blog
t
ag
,
EditBlogTagsRequest
$request
)
public
function
edit
(
BlogTag
$blog
T
ag
,
EditBlogTagsRequest
$request
)
{
return
view
(
'backend.blogtags.edit'
)
->
with
(
'blogtag'
,
$blog
t
ag
);
->
with
(
'blogtag'
,
$blog
T
ag
);
}
/**
* @param \App\Models\BlogTags\BlogTag $blog
t
ag
* @param \App\Models\BlogTags\BlogTag $blog
T
ag
* @param \App\Http\Requests\Backend\BlogTags\UpdateBlogTagsRequest $request
*
* @return mixed
*/
public
function
update
(
BlogTag
$blog
t
ag
,
UpdateBlogTagsRequest
$request
)
public
function
update
(
BlogTag
$blog
T
ag
,
UpdateBlogTagsRequest
$request
)
{
$this
->
blogtag
->
update
(
$blog
t
ag
,
$request
->
except
([
'_method'
,
'_token'
]));
$this
->
blogtag
->
update
(
$blog
T
ag
,
$request
->
except
([
'_method'
,
'_token'
]));
return
redirect
()
->
route
(
'admin.blog
t
ags.index'
)
->
route
(
'admin.blog
T
ags.index'
)
->
with
(
'flash_success'
,
trans
(
'alerts.backend.blogtags.updated'
));
}
/**
* @param \App\Models\BlogTags\BlogTag $blog
t
ag
* @param \App\Models\BlogTags\BlogTag $blog
T
ag
* @param \App\Http\Requests\Backend\BlogTags\DeleteBlogTagsRequest $request
*
* @return mixed
*/
public
function
destroy
(
BlogTag
$blog
t
ag
,
DeleteBlogTagsRequest
$request
)
public
function
destroy
(
BlogTag
$blog
T
ag
,
DeleteBlogTagsRequest
$request
)
{
$this
->
blogtag
->
delete
(
$blog
t
ag
);
$this
->
blogtag
->
delete
(
$blog
T
ag
);
return
redirect
()
->
route
(
'admin.blog
t
ags.index'
)
->
route
(
'admin.blog
T
ags.index'
)
->
with
(
'flash_success'
,
trans
(
'alerts.backend.blogtags.deleted'
));
}
}
app/Models/BlogCategories/Traits/Relationship/BlogCategoryRelationship.php
View file @
48809bd4
...
...
@@ -12,8 +12,8 @@ trait BlogCategoryRelationship
/**
* BlogCategories belongs to relationship with state.
*/
public
function
creat
edBy
()
public
function
creat
or
()
{
return
$this
->
belongsTo
(
User
::
class
,
'created_by'
,
'id'
);
return
$this
->
belongsTo
(
User
::
class
,
'created_by'
);
}
}
app/Models/BlogTags/Traits/Relationship/BlogTagRelationship.php
View file @
48809bd4
...
...
@@ -12,8 +12,8 @@ trait BlogTagRelationship
/**
* BlogTags belongs to relationship with state.
*/
public
function
creat
edBy
()
public
function
creat
or
()
{
return
$this
->
belongsTo
(
User
::
class
,
'created_by'
,
'id'
);
return
$this
->
belongsTo
(
User
::
class
,
'created_by'
);
}
}
database/factories/BlogTagFactory.php
0 → 100644
View file @
48809bd4
<?php
use
Faker\Generator
as
Faker
;
use
App\Models\BlogTags\BlogTag
;
use
App\Models\Access\User\User
;
$factory
->
define
(
BlogTag
::
class
,
function
(
Faker
$faker
)
{
return
[
'name'
=>
$faker
->
word
,
'status'
=>
$faker
->
numberBetween
(
0
,
1
),
'created_by'
=>
function
()
{
return
factory
(
User
::
class
)
->
create
()
->
id
;
}
];
});
database/migrations/2017_11_02_060149_create_blog_categories_table.php
View file @
48809bd4
...
...
@@ -16,7 +16,7 @@ class CreateBlogCategoriesTable extends Migration
$table
->
increments
(
'id'
);
$table
->
string
(
'name'
,
191
);
$table
->
boolean
(
'status'
)
->
default
(
1
);
$table
->
integer
(
'created_by'
)
->
unsigned
()
->
nullable
()
;
$table
->
integer
(
'created_by'
)
->
unsigned
();
$table
->
integer
(
'updated_by'
)
->
unsigned
()
->
nullable
();
$table
->
timestamps
();
$table
->
softDeletes
();
...
...
database/seeds/MenuTableSeeder.php
View file @
48809bd4
...
...
@@ -18,7 +18,7 @@ class MenuTableSeeder extends Seeder
'id'
=>
1
,
'type'
=>
'backend'
,
'name'
=>
'Backend Sidebar Menu'
,
'items'
=>
'[{"view_permission_id":"view-access-management","icon":"fa-users","open_in_new_tab":0,"url_type":"route","url":"","name":"Access Management","id":11,"content":"Access Management","children":[{"view_permission_id":"view-user-management","open_in_new_tab":0,"url_type":"route","url":"admin.access.user.index","name":"User Management","id":12,"content":"User Management"},{"view_permission_id":"view-role-management","open_in_new_tab":0,"url_type":"route","url":"admin.access.role.index","name":"Role Management","id":13,"content":"Role Management"},{"view_permission_id":"view-permission-management","open_in_new_tab":0,"url_type":"route","url":"admin.access.permission.index","name":"Permission Management","id":14,"content":"Permission Management"}]},{"view_permission_id":"view-module","icon":"fa-wrench","open_in_new_tab":0,"url_type":"route","url":"admin.modules.index","name":"Module","id":1,"content":"Module"},{"view_permission_id":"view-menu","icon":"fa-bars","open_in_new_tab":0,"url_type":"route","url":"admin.menus.index","name":"Menus","id":3,"content":"Menus"},{"view_permission_id":"view-page","icon":"fa-file-text","open_in_new_tab":0,"url_type":"route","url":"admin.pages.index","name":"Pages","id":2,"content":"Pages"},{"view_permission_id":"view-email-template","icon":"fa-envelope","open_in_new_tab":0,"url_type":"route","url":"admin.emailtemplates.index","name":"Email Templates","id":8,"content":"Email Templates"},{"view_permission_id":"edit-settings","icon":"fa-gear","open_in_new_tab":0,"url_type":"route","url":"admin.settings.edit?id=1","name":"Settings","id":9,"content":"Settings"},{"view_permission_id":"view-blog","icon":"fa-commenting","open_in_new_tab":0,"url_type":"route","url":"","name":"Blog Management","id":15,"content":"Blog Management","children":[{"view_permission_id":"view-blog-category","open_in_new_tab":0,"url_type":"route","url":"admin.blogCategories.index","name":"Blog Category Management","id":16,"content":"Blog Category Management"},{"view_permission_id":"view-blog-tag","open_in_new_tab":0,"url_type":"route","url":"admin.blog
t
ags.index","name":"Blog Tag Management","id":17,"content":"Blog Tag Management"},{"view_permission_id":"view-blog","open_in_new_tab":0,"url_type":"route","url":"admin.blogs.index","name":"Blog Management","id":18,"content":"Blog Management"}]},{"view_permission_id":"view-faq","icon":"fa-question-circle","open_in_new_tab":0,"url_type":"route","url":"admin.faqs.index","name":"Faq Management","id":19,"content":"Faq Management"}]'
,
'items'
=>
'[{"view_permission_id":"view-access-management","icon":"fa-users","open_in_new_tab":0,"url_type":"route","url":"","name":"Access Management","id":11,"content":"Access Management","children":[{"view_permission_id":"view-user-management","open_in_new_tab":0,"url_type":"route","url":"admin.access.user.index","name":"User Management","id":12,"content":"User Management"},{"view_permission_id":"view-role-management","open_in_new_tab":0,"url_type":"route","url":"admin.access.role.index","name":"Role Management","id":13,"content":"Role Management"},{"view_permission_id":"view-permission-management","open_in_new_tab":0,"url_type":"route","url":"admin.access.permission.index","name":"Permission Management","id":14,"content":"Permission Management"}]},{"view_permission_id":"view-module","icon":"fa-wrench","open_in_new_tab":0,"url_type":"route","url":"admin.modules.index","name":"Module","id":1,"content":"Module"},{"view_permission_id":"view-menu","icon":"fa-bars","open_in_new_tab":0,"url_type":"route","url":"admin.menus.index","name":"Menus","id":3,"content":"Menus"},{"view_permission_id":"view-page","icon":"fa-file-text","open_in_new_tab":0,"url_type":"route","url":"admin.pages.index","name":"Pages","id":2,"content":"Pages"},{"view_permission_id":"view-email-template","icon":"fa-envelope","open_in_new_tab":0,"url_type":"route","url":"admin.emailtemplates.index","name":"Email Templates","id":8,"content":"Email Templates"},{"view_permission_id":"edit-settings","icon":"fa-gear","open_in_new_tab":0,"url_type":"route","url":"admin.settings.edit?id=1","name":"Settings","id":9,"content":"Settings"},{"view_permission_id":"view-blog","icon":"fa-commenting","open_in_new_tab":0,"url_type":"route","url":"","name":"Blog Management","id":15,"content":"Blog Management","children":[{"view_permission_id":"view-blog-category","open_in_new_tab":0,"url_type":"route","url":"admin.blogCategories.index","name":"Blog Category Management","id":16,"content":"Blog Category Management"},{"view_permission_id":"view-blog-tag","open_in_new_tab":0,"url_type":"route","url":"admin.blog
T
ags.index","name":"Blog Tag Management","id":17,"content":"Blog Tag Management"},{"view_permission_id":"view-blog","open_in_new_tab":0,"url_type":"route","url":"admin.blogs.index","name":"Blog Management","id":18,"content":"Blog Management"}]},{"view_permission_id":"view-faq","icon":"fa-question-circle","open_in_new_tab":0,"url_type":"route","url":"admin.faqs.index","name":"Faq Management","id":19,"content":"Faq Management"}]'
,
'created_by'
=>
1
,
'created_at'
=>
Carbon
::
now
(),
];
...
...
resources/views/backend/blogtags/create.blade.php
View file @
48809bd4
...
...
@@ -10,7 +10,7 @@
@
endsection
@
section
(
'content'
)
{{
Form
::
open
([
'route'
=>
'admin.blog
tags.store'
,
'class'
=>
'form-horizontal'
,
'role'
=>
'form'
,
'method'
=>
'post'
,
'id'
=>
'create-permission
'
])
}}
{{
Form
::
open
([
'route'
=>
'admin.blog
Tags.store'
,
'class'
=>
'form-horizontal'
,
'role'
=>
'form'
,
'method'
=>
'post'
,
'id'
=>
'create-blogtags
'
])
}}
<
div
class
="
box
box
-
info
">
<div class="
box
-
header
with
-
border
">
...
...
@@ -26,7 +26,7 @@
<div class="
form
-
group
">
@include("
backend
.
blogtags
.
form
")
<div class="
edit
-
form
-
btn
">
{{ link_to_route('admin.blog
t
ags.index', trans('buttons.general.cancel'), [], ['class' => 'btn btn-danger btn-md']) }}
{{ link_to_route('admin.blog
T
ags.index', trans('buttons.general.cancel'), [], ['class' => 'btn btn-danger btn-md']) }}
{{ Form::submit(trans('buttons.general.crud.create'), ['class' => 'btn btn-primary btn-md']) }}
<div class="
clearfix
"></div>
</div>
...
...
resources/views/backend/blogtags/edit.blade.php
View file @
48809bd4
...
...
@@ -10,7 +10,7 @@
@
endsection
@
section
(
'content'
)
{{
Form
::
model
(
$blogtag
,
[
'route'
=>
[
'admin.blog
tags.update'
,
$blogtag
],
'class'
=>
'form-horizontal'
,
'role'
=>
'form'
,
'method'
=>
'PATCH'
,
'id'
=>
'edit-role
'
])
}}
{{
Form
::
model
(
$blogtag
,
[
'route'
=>
[
'admin.blog
Tags.update'
,
$blogtag
],
'class'
=>
'form-horizontal'
,
'role'
=>
'form'
,
'method'
=>
'PATCH'
,
'id'
=>
'edit-blogtags
'
])
}}
<
div
class
="
box
box
-
info
">
<div class="
box
-
header
with
-
border
">
...
...
@@ -26,7 +26,7 @@
<div class="
form
-
group
">
@include("
backend
.
blogtags
.
form
")
<div class="
edit
-
form
-
btn
">
{{ link_to_route('admin.blog
t
ags.index', trans('buttons.general.cancel'), [], ['class' => 'btn btn-danger btn-md']) }}
{{ link_to_route('admin.blog
T
ags.index', trans('buttons.general.cancel'), [], ['class' => 'btn btn-danger btn-md']) }}
{{ Form::submit(trans('buttons.general.crud.update'), ['class' => 'btn btn-primary btn-md']) }}
<div class="
clearfix
"></div>
</div>
...
...
resources/views/backend/blogtags/index.blade.php
View file @
48809bd4
...
...
@@ -70,7 +70,7 @@
processing: true,
serverSide: true,
ajax: {
url: '{{ route("
admin
.
blog
t
ags
.
get
") }}',
url: '{{ route("
admin
.
blog
T
ags
.
get
") }}',
type: 'post'
},
columns: [
...
...
resources/views/backend/blogtags/partials/blogtags-header-buttons.blade.php
View file @
48809bd4
<!--Action Button-->
@if(Active::checkUriPattern('admin/blog
t
ags'))
@if(Active::checkUriPattern('admin/blog
T
ags'))
<div
class=
"btn-group"
>
<button
type=
"button"
class=
"btn btn-warning btn-flat dropdown-toggle"
data-toggle=
"dropdown"
>
Export
<span
class=
"caret"
></span>
...
...
@@ -21,9 +21,9 @@
<span
class=
"sr-only"
>
Toggle Dropdown
</span>
</button>
<ul
class=
"dropdown-menu"
role=
"menu"
>
<li><a
href=
"{{route('admin.blog
t
ags.index')}}"
><i
class=
"fa fa-list-ul"
></i>
{{trans('menus.backend.blogtags.all')}}
</a></li>
<li><a
href=
"{{route('admin.blog
T
ags.index')}}"
><i
class=
"fa fa-list-ul"
></i>
{{trans('menus.backend.blogtags.all')}}
</a></li>
@permission('create-blog-tag')
<li><a
href=
"{{route('admin.blog
t
ags.create')}}"
><i
class=
"fa fa-plus"
></i>
{{trans('menus.backend.blogtags.create')}}
</a></li>
<li><a
href=
"{{route('admin.blog
T
ags.create')}}"
><i
class=
"fa fa-plus"
></i>
{{trans('menus.backend.blogtags.create')}}
</a></li>
@endauth
</ul>
</div>
...
...
resources/views/backend/includes/sidebar.blade.php
View file @
48809bd4
...
...
@@ -97,8 +97,8 @@
</li>
@endauth
@permission('view-blog-tag')
<li
class=
"{{ active_class(Active::checkUriPattern('admin/blog
t
ags*')) }}"
>
<a
href=
"{{ route('admin.blog
t
ags.index') }}"
>
<li
class=
"{{ active_class(Active::checkUriPattern('admin/blog
T
ags*')) }}"
>
<a
href=
"{{ route('admin.blog
T
ags.index') }}"
>
<span>
{{ trans('menus.backend.blogtags.management') }}
</span>
</a>
</li>
...
...
routes/Backend/BlogTags.php
View file @
48809bd4
...
...
@@ -4,9 +4,9 @@
* Blogs Tags Management
*/
Route
::
group
([
'namespace'
=>
'BlogTags'
],
function
()
{
Route
::
resource
(
'blog
t
ags'
,
'BlogTagsController'
,
[
'except'
=>
[
'show'
]]);
Route
::
resource
(
'blog
T
ags'
,
'BlogTagsController'
,
[
'except'
=>
[
'show'
]]);
//For DataTables
Route
::
post
(
'blog
t
ags/get'
,
'BlogTagsTableController'
)
->
name
(
'blog
t
ags.get'
);
Route
::
post
(
'blog
T
ags/get'
,
'BlogTagsTableController'
)
->
name
(
'blog
T
ags.get'
);
});
tests/Feature/ManageBlogCategoriesTest.php
→
tests/Feature/
Backend/
ManageBlogCategoriesTest.php
View file @
48809bd4
<?php
namespace
Tests\Feature
;
namespace
Tests\Feature
\Backend
;
use
App\Models\BlogCategories\BlogCategory
;
use
Tests\TestCase
;
...
...
@@ -43,15 +43,16 @@ class ManageBlogCategoriesTest extends TestCase
->
assertSessionHasErrors
(
'name'
);
}
// public function a_blog_category_requires_a_name_while_updating()
// {
// $this->actingAs($this->admin)->withExceptionHandling();
/** @test */
public
function
a_blog_category_requires_a_name_while_updating
()
{
$this
->
actingAs
(
$this
->
admin
)
->
withExceptionHandling
();
//
$category = create(BlogCategory::class);
$category
=
create
(
BlogCategory
::
class
);
// $this->post(route('admin.blogCategories.store'), $category->toArray()
)
//
->assertSessionHasErrors('name');
//
}
$this
->
patch
(
route
(
'admin.blogCategories.update'
,
$category
),
[
'name'
=>
''
]
)
->
assertSessionHasErrors
(
'name'
);
}
/** @test */
public
function
a_user_can_update_a_blog_category
()
...
...
tests/Feature/Backend/ManageBlogTagsTest.php
0 → 100644
View file @
48809bd4
<?php
namespace
Tests\Feature\Backend
;
use
Tests\TestCase
;
use
App\Models\BlogTags\BlogTag
;
class
ManageBlogTagsTest
extends
TestCase
{
/** @test */
public
function
a_user_can_view_blog_tags_index_page
()
{
$this
->
actingAs
(
$this
->
admin
)
->
get
(
route
(
'admin.blogTags.index'
))
->
assertViewIs
(
'backend.blogtags.index'
)
->
assertSee
(
trans
(
'labels.backend.blogtags.management'
))
->
assertSee
(
trans
(
'labels.backend.blogtags.table.title'
))
->
assertSee
(
trans
(
'labels.backend.blogtags.table.status'
))
->
assertSee
(
'Export'
)
->
assertSee
(
'Action'
);
}
/** @test */
public
function
a_user_can_create_a_blog_tag
()
{
$this
->
actingAs
(
$this
->
admin
);
$tag
=
make
(
BlogTag
::
class
);
$this
->
post
(
route
(
'admin.blogTags.store'
),
$tag
->
toArray
());
$this
->
assertDatabaseHas
(
config
(
'module.blog_tags.table'
),
[
'name'
=>
$tag
->
name
]);
}
/** @test */
public
function
a_blog_tag_requires_a_name_while_creating
()
{
$this
->
actingAs
(
$this
->
admin
)
->
withExceptionHandling
();
$tag
=
make
(
BlogTag
::
class
,
[
'name'
=>
''
]);
$this
->
post
(
route
(
'admin.blogTags.store'
),
$tag
->
toArray
())
->
assertSessionHasErrors
(
'name'
);
}
/** @test */
public
function
a_blog_tag_requires_a_name_while_updating
()
{
$this
->
actingAs
(
$this
->
admin
)
->
withExceptionHandling
();
$tag
=
create
(
BlogTag
::
class
);
$this
->
patch
(
route
(
'admin.blogTags.update'
,
$tag
),
[
'name'
=>
''
])
->
assertSessionHasErrors
(
'name'
);
}
/** @test */
public
function
a_user_can_update_a_blog_tag
()
{
$this
->
actingAs
(
$this
->
admin
);
$tag
=
create
(
BlogTag
::
class
);
$this
->
patch
(
route
(
'admin.blogTags.update'
,
$tag
),
[
'name'
=>
'New Tag'
]);
$this
->
assertDatabaseHas
(
config
(
'module.blog_tags.table'
),
[
'name'
=>
'New Tag'
,
'id'
=>
$tag
->
id
]);
}
/** @test */
public
function
a_user_can_delete_a_blog_tag
()
{
$this
->
actingAs
(
$this
->
admin
);
$tag
=
create
(
BlogTag
::
class
);
$this
->
delete
(
route
(
'admin.blogTags.destroy'
,
$tag
));
$this
->
assertDatabaseMissing
(
config
(
'module.blog_tags.table'
),
[
'name'
=>
$tag
->
name
,
'id'
=>
$tag
->
id
,
'deleted_at'
=>
null
]);
}
}
tests/Feature/Backend/ManagePagesTest.php
View file @
48809bd4
...
...
@@ -124,4 +124,16 @@ class ManagePagesTest extends TestCase
->
post
(
route
(
'admin.pages.store'
),
$page3
)
->
assertSessionHasErrors
(
'description'
);
}
/** @test */
public
function
a_user_can_delete_a_page
()
{
$this
->
actingAs
(
$this
->
admin
);
$page
=
create
(
Page
::
class
);
$this
->
delete
(
route
(
'admin.pages.destroy'
,
$page
));
$this
->
assertDatabaseMissing
(
config
(
'module.pages.table'
),
[
'name'
=>
$page
->
name
,
'id'
=>
$page
->
id
,
'deleted_at'
=>
null
]);
}
}
tests/Unit/BlogCategoryTest.php
deleted
100644 → 0
View file @
8b8ac133
<?php
namespace
Tests\Unit
;
use
Tests\TestCase
;
class
BlogCategoryTest
extends
TestCase
{
/**
* A basic test example.
*
* @return void
*/
public
function
testExample
()
{
$this
->
assertTrue
(
true
);
}
}
tests/Unit/Models/BlogCategoryTest.php
0 → 100644
View file @
48809bd4
<?php
namespace
Tests\Unit\Models
;
use
Tests\TestCase
;
use
App\Models\Access\User\User
;
use
App\Models\BlogCategories\BlogCategory
;
use
Illuminate\Foundation\Testing\WithFaker
;
use
Illuminate\Foundation\Testing\RefreshDatabase
;
class
BlogCategoryTest
extends
TestCase
{
/** @test */
public
function
it_has_a_creator
()
{
$this
->
actingAs
(
$this
->
admin
);
$category
=
create
(
BlogCategory
::
class
,
[
'created_by'
=>
access
()
->
id
()]);
$this
->
assertInstanceOf
(
User
::
class
,
$category
->
creator
);
$this
->
assertEquals
(
$category
->
creator
->
id
,
access
()
->
id
());
}
}
tests/Unit/Models/BlogTagTest.php
0 → 100644
View file @
48809bd4
<?php
namespace
Tests\Unit\Models
;
use
Tests\TestCase
;
use
App\Models\BlogTags\BlogTag
;
use
App\Models\Access\User\User
;
class
BlogTagTest
extends
TestCase
{
/** @test */
public
function
it_has_a_creator
()
{
$this
->
actingAs
(
$this
->
admin
);
$tag
=
create
(
BlogTag
::
class
,
[
'created_by'
=>
access
()
->
id
()]);
$this
->
assertInstanceOf
(
User
::
class
,
$tag
->
creator
);
$this
->
assertEquals
(
$tag
->
creator
->
id
,
access
()
->
id
());
}
}
tests/Unit/PageTest.php
→
tests/Unit/
Models/
PageTest.php
View file @
48809bd4
<?php
namespace
Tests\Unit
;
namespace
Tests\Unit
\Models
;
use
App\Models\Access\User\User
;
use
App\Models\Page\Page
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment