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
c68b710a
Commit
c68b710a
authored
Jan 01, 2018
by
bvipul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added page delete test and remaining blog category test
parent
4de44480
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
48 additions
and
11 deletions
+48
-11
BlogCategoryRelationship.php
...tegories/Traits/Relationship/BlogCategoryRelationship.php
+2
-2
ManageBlogCategoriesTest.php
tests/Feature/Backend/ManageBlogCategoriesTest.php
+9
-8
ManagePagesTest.php
tests/Feature/Backend/ManagePagesTest.php
+12
-0
BlogCategoryTest.php
tests/Unit/Models/BlogCategoryTest.php
+24
-0
PageTest.php
tests/Unit/Models/PageTest.php
+1
-1
No files found.
app/Models/BlogCategories/Traits/Relationship/BlogCategoryRelationship.php
View file @
c68b710a
...
...
@@ -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'
);
}
}
tests/Feature/ManageBlogCategoriesTest.php
→
tests/Feature/
Backend/
ManageBlogCategoriesTest.php
View file @
c68b710a
<?php
namespace
Tests\Feature
;
namespace
Tests\Feature
\Backend
;
use
Tests\TestCase
;
use
App\Models\BlogCategories\BlogCategory
;
...
...
@@ -45,15 +45,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/ManagePagesTest.php
View file @
c68b710a
...
...
@@ -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
→
tests/Unit/
Models/
BlogCategoryTest.php
View file @
c68b710a
<?php
namespace
Tests\Unit
;
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
{
/**
* A basic test example.
*
* @return void
*/
public
function
testExample
()
/** @test */
public
function
it_has_a_creator
()
{
$this
->
assertTrue
(
true
);
$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/PageTest.php
→
tests/Unit/
Models/
PageTest.php
View file @
c68b710a
<?php
namespace
Tests\Unit
;
namespace
Tests\Unit
\Models
;
use
Tests\TestCase
;
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