Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Platform
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
Platform
Commits
910af7fc
Unverified
Commit
910af7fc
authored
Jun 28, 2017
by
Nicolas Widart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Testing a user has an api token created when creating a user via create() method on repository
parent
d8d750b1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
0 deletions
+46
-0
SentinelUserRepositoryTest.php
Modules/User/Tests/SentinelUserRepositoryTest.php
+46
-0
No files found.
Modules/User/Tests/SentinelUserRepositoryTest.php
0 → 100644
View file @
910af7fc
<?php
namespace
Modules\User\Tests
;
use
Modules\User\Entities\UserToken
;
use
Modules\User\Repositories\RoleRepository
;
use
Modules\User\Repositories\UserRepository
;
class
SentinelUserRepositoryTest
extends
BaseUserTestCase
{
/**
* @var RoleRepository
*/
private
$role
;
/**
* @var UserRepository
*/
private
$user
;
public
function
setUp
()
{
parent
::
setUp
();
$this
->
role
=
app
(
RoleRepository
::
class
);
$this
->
user
=
app
(
UserRepository
::
class
);
}
/** @test */
public
function
it_creates_new_user_with_api_keys
()
{
$this
->
user
->
create
([
'email'
=>
'n.widart@gmail.com'
,
'password'
=>
'demo1234'
,
]);
$user
=
$this
->
user
->
find
(
1
);
$this
->
assertCount
(
1
,
$user
->
api_keys
);
}
private
function
createRole
(
$name
)
{
return
$this
->
role
->
create
([
'name'
=>
$name
,
'slug'
=>
str_slug
(
$name
),
]);
}
}
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