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-09-10 20:28:53 +0100
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Commit
e8dd7fda1ff08f0a2eb496ec827a5fad7b7b0463
e8dd7fda
1 parent
88049476
Added some basic registration testing
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
1 deletions
app/Http/Controllers/Auth/AuthController.php
database/factories/ModelFactory.php
tests/AuthTest.php
app/Http/Controllers/Auth/AuthController.php
View file @
e8dd7fd
...
...
@@ -155,6 +155,7 @@ class AuthController extends Controller
return
redirect
(
'/register/confirm'
);
}
$newUser
->
email_confirmed
=
true
;
auth
()
->
login
(
$newUser
);
session
()
->
flash
(
'success'
,
'Thanks for signing up! You are now registered and signed in.'
);
return
redirect
(
$this
->
redirectPath
());
...
...
database/factories/ModelFactory.php
View file @
e8dd7fd
...
...
@@ -39,4 +39,4 @@ $factory->define(BookStack\Page::class, function ($faker) {
'name'
=>
$faker
->
sentence
,
'html'
=>
'<p>'
.
implode
(
'</p>'
,
$faker
->
paragraphs
(
5
))
.
'</p>'
];
});
\ No newline at end of file
});
...
...
tests/AuthTest.php
View file @
e8dd7fd
...
...
@@ -20,6 +20,48 @@ class AuthTest extends TestCase
->
see
(
'BookStack'
);
}
public
function
testPublicViewing
()
{
$settings
=
app
(
'BookStack\Services\SettingService'
);
$settings
->
put
(
'app-public'
,
'true'
);
$this
->
visit
(
'/'
)
->
seePageIs
(
'/'
)
->
see
(
'Sign In'
);
}
public
function
testRegistrationShowing
()
{
// Ensure registration form is showing
$this
->
setSettings
([
'registration-enabled'
=>
'true'
]);
$this
->
visit
(
'/login'
)
->
see
(
'Sign up'
)
->
click
(
'Sign up'
)
->
seePageIs
(
'/register'
);
}
public
function
testNormalRegistration
()
{
$this
->
setSettings
([
'registration-enabled'
=>
'true'
]);
$user
=
factory
(
\BookStack\User
::
class
)
->
make
();
$this
->
visit
(
'/register'
)
->
see
(
'Sign Up'
)
->
type
(
$user
->
name
,
'#name'
)
->
type
(
$user
->
email
,
'#email'
)
->
type
(
$user
->
password
,
'#password'
)
->
press
(
'Create Account'
)
->
seePageIs
(
'/'
)
->
see
(
$user
->
name
);
}
private
function
setSettings
(
$settingsArray
)
{
$settings
=
app
(
'BookStack\Services\SettingService'
);
foreach
(
$settingsArray
as
$key
=>
$value
)
{
$settings
->
put
(
$key
,
$value
);
}
}
public
function
testLogout
()
{
$this
->
asAdmin
()
...
...
Please
register
or
sign in
to post a comment