Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
syncEnrollments
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
Yeray Santana Hualde
syncEnrollments
Commits
590872d3
Commit
590872d3
authored
Nov 29, 2012
by
crynobone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update auth test case
Signed-off-by:
crynobone
<
crynobone@gmail.com
>
parent
ba661e57
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
0 deletions
+37
-0
auth.test.php
laravel/tests/cases/auth.test.php
+37
-0
No files found.
laravel/tests/cases/auth.test.php
View file @
590872d3
...
...
@@ -17,6 +17,9 @@ class AuthTest extends PHPUnit_Framework_TestCase {
public
function
setUp
()
{
$_SERVER
[
'auth.login.stub'
]
=
null
;
$_SERVER
[
'test.user.login'
]
=
null
;
$_SERVER
[
'test.user.logout'
]
=
null
;
Cookie
::
$jar
=
array
();
Config
::
$items
=
array
();
Auth
::
driver
()
->
user
=
null
;
...
...
@@ -30,6 +33,9 @@ class AuthTest extends PHPUnit_Framework_TestCase {
public
function
tearDown
()
{
$_SERVER
[
'auth.login.stub'
]
=
null
;
$_SERVER
[
'test.user.login'
]
=
null
;
$_SERVER
[
'test.user.logout'
]
=
null
;
Cookie
::
$jar
=
array
();
Config
::
$items
=
array
();
Auth
::
driver
()
->
user
=
null
;
...
...
@@ -300,6 +306,37 @@ class AuthTest extends PHPUnit_Framework_TestCase {
$this
->
assertTrue
(
Cookie
::
$jar
[
'laravel_auth_drivers_fluent_remember'
][
'expiration'
]
<
time
());
}
/**
* Test `laravel.auth: login` and `laravel.auth: logout` is called properly
*
* @group laravel
*/
public
function
testAuthEventIsCalledProperly
()
{
Session
::
$instance
=
new
Payload
(
$this
->
getMock
(
'Laravel\\Session\\Drivers\\Driver'
));
Event
::
listen
(
'laravel.auth: login'
,
function
()
{
$_SERVER
[
'test.user.login'
]
=
'foo'
;
});
Event
::
listen
(
'laravel.auth: logout'
,
function
()
{
$_SERVER
[
'test.user.logout'
]
=
'foo'
;
});
$this
->
assertNull
(
$_SERVER
[
'test.user.login'
]);
$this
->
assertNull
(
$_SERVER
[
'test.user.logout'
]);
Auth
::
login
(
1
,
true
);
$this
->
assertEquals
(
'foo'
,
$_SERVER
[
'test.user.login'
]);
Auth
::
logout
();
$this
->
assertEquals
(
'foo'
,
$_SERVER
[
'test.user.logout'
]);
}
}
class
AuthUserReturnsNull
extends
Laravel\Auth\Drivers\Driver
{
...
...
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