Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Зуев Егор
/
wiki.dev
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Authored by
Dan Brown
2015-10-18 16:06:06 +0100
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Commit
13fa1080dc08fa0bc175e799a9f49cdd6e3a7e3a
13fa1080
1 parent
68a14910
Added tests for user crud
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
49 additions
and
3 deletions
resources/assets/sass/styles.scss
resources/views/users/edit.blade.php
resources/views/users/index.blade.php
tests/AuthTest.php
resources/assets/sass/styles.scss
View file @
13fa108
...
...
@@ -30,6 +30,11 @@ body.dragging, body.dragging * {
// User Avatar Images
.avatar
{
border-radius
:
100%
;
background-color
:
#EEE
;
&
.med
{
width
:
40px
;
height
:
40px
;
}
}
// System wide notifications
...
...
resources/views/users/edit.blade.php
View file @
13fa108
...
...
@@ -9,7 +9,7 @@
<div
class=
"col-md-6"
></div>
<div
class=
"col-md-6 faded"
>
<div
class=
"action-buttons"
>
<a
href=
"/users/{{$user->id}}/delete"
class=
"text-neg text-button"
><i
class=
"zmdi zmdi-delete"
></i>
Delete
U
ser
</a>
<a
href=
"/users/{{$user->id}}/delete"
class=
"text-neg text-button"
><i
class=
"zmdi zmdi-delete"
></i>
Delete
u
ser
</a>
</div>
</div>
</div>
...
...
resources/views/users/index.blade.php
View file @
13fa108
...
...
@@ -10,7 +10,7 @@
<h1>
Users
</h1>
@if($currentUser->can('user-create'))
<p>
<a
href=
"/users/create"
class=
"text-pos"
><i
class=
"zmdi zmdi-account-add"
></i>
Add
New U
ser
</a>
<a
href=
"/users/create"
class=
"text-pos"
><i
class=
"zmdi zmdi-account-add"
></i>
Add
new u
ser
</a>
</p>
@endif
<table
class=
"table"
>
...
...
@@ -22,7 +22,7 @@
</tr>
@foreach($users as $user)
<tr>
<td
style=
"line-height: 0;"
><img
class=
"avatar"
src=
"{{$user->getAvatar(40)}}"
alt=
"{{$user->name}}"
></td>
<td
style=
"line-height: 0;"
><img
class=
"avatar
med
"
src=
"{{$user->getAvatar(40)}}"
alt=
"{{$user->name}}"
></td>
<td>
@if($currentUser->can('user-update') || $currentUser->id == $user->id)
<a
href=
"/users/{{$user->id}}"
>
...
...
tests/AuthTest.php
View file @
13fa108
...
...
@@ -102,6 +102,47 @@ class AuthTest extends TestCase
->
seeInDatabase
(
'users'
,
[
'name'
=>
$user
->
name
,
'email'
=>
$user
->
email
,
'email_confirmed'
=>
true
]);
}
public
function
testUserControl
()
{
$user
=
factory
(
\BookStack\User
::
class
)
->
make
();
// Test creation
$this
->
asAdmin
()
->
visit
(
'/users'
)
->
click
(
'Add new user'
)
->
type
(
$user
->
name
,
'#name'
)
->
type
(
$user
->
email
,
'#email'
)
->
select
(
2
,
'#role'
)
->
type
(
$user
->
password
,
'#password'
)
->
type
(
$user
->
password
,
'#password-confirm'
)
->
press
(
'Save'
)
->
seeInDatabase
(
'users'
,
$user
->
toArray
())
->
seePageIs
(
'/users'
)
->
see
(
$user
->
name
);
$user
=
$user
->
where
(
'email'
,
'='
,
$user
->
email
)
->
first
();
// Test editing
$this
->
asAdmin
()
->
visit
(
'/users'
)
->
click
(
$user
->
name
)
->
seePageIs
(
'/users/'
.
$user
->
id
)
->
see
(
$user
->
email
)
->
type
(
'Barry Scott'
,
'#name'
)
->
press
(
'Save'
)
->
seePageIs
(
'/users'
)
->
seeInDatabase
(
'users'
,
[
'id'
=>
$user
->
id
,
'name'
=>
'Barry Scott'
])
->
notSeeInDatabase
(
'users'
,
[
'name'
=>
$user
->
name
]);
$user
=
$user
->
find
(
$user
->
id
);
// Test Deletion
$this
->
asAdmin
()
->
visit
(
'/users/'
.
$user
->
id
)
->
click
(
'Delete user'
)
->
see
(
$user
->
name
)
->
press
(
'Confirm'
)
->
seePageIs
(
'/users'
)
->
notSeeInDatabase
(
'users'
,
[
'name'
=>
$user
->
name
]);
}
public
function
testLogout
()
{
$this
->
asAdmin
()
...
...
Please
register
or
sign in
to post a comment