Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
L
laravel-mongodb
Project
Project
Details
Activity
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
sinan
laravel-mongodb
Commits
96f07a9f
Commit
96f07a9f
authored
May 24, 2014
by
Jens Segers
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding tests for #212
parent
79c0fdbc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
0 deletions
+17
-0
ConnectionTest.php
tests/ConnectionTest.php
+3
-0
RelationsTest.php
tests/RelationsTest.php
+14
-0
No files found.
tests/ConnectionTest.php
View file @
96f07a9f
...
...
@@ -6,7 +6,10 @@ class ConnectionTest extends TestCase {
{
$connection
=
DB
::
connection
(
'mongodb'
);
$this
->
assertInstanceOf
(
'Jenssegers\Mongodb\Connection'
,
$connection
);
}
public
function
testReconnect
()
{
$c1
=
DB
::
connection
(
'mongodb'
);
$c2
=
DB
::
connection
(
'mongodb'
);
$this
->
assertEquals
(
spl_object_hash
(
$c1
),
spl_object_hash
(
$c2
));
...
...
tests/RelationsTest.php
View file @
96f07a9f
...
...
@@ -57,6 +57,20 @@ class RelationsTest extends TestCase {
$role
=
$user
->
role
;
$this
->
assertEquals
(
'admin'
,
$role
->
type
);
$this
->
assertEquals
(
$user
->
_id
,
$role
->
user_id
);
$user
=
User
::
create
(
array
(
'name'
=>
'Jane Doe'
));
$role
=
new
Role
(
array
(
'type'
=>
'user'
));
$user
->
role
()
->
save
(
$role
);
$role
=
$user
->
role
;
$this
->
assertEquals
(
'user'
,
$role
->
type
);
$this
->
assertEquals
(
$user
->
_id
,
$role
->
user_id
);
$user
=
User
::
where
(
'name'
,
'Jane Doe'
)
->
first
();
$role
=
$user
->
role
;
$this
->
assertEquals
(
'user'
,
$role
->
type
);
$this
->
assertEquals
(
$user
->
_id
,
$role
->
user_id
);
}
public
function
testWithBelongsTo
()
...
...
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