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
bc686c93
Commit
bc686c93
authored
Aug 26, 2013
by
Jens Segers
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding tests for issue #27
parent
27293757
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
0 deletions
+25
-0
ModelTest.php
tests/ModelTest.php
+13
-0
QueryBuilderTest.php
tests/QueryBuilderTest.php
+12
-0
No files found.
tests/ModelTest.php
View file @
bc686c93
...
@@ -146,6 +146,19 @@ class ModelTest extends PHPUnit_Framework_TestCase {
...
@@ -146,6 +146,19 @@ class ModelTest extends PHPUnit_Framework_TestCase {
$this
->
assertEquals
(
'John Doe'
,
$user
->
name
);
$this
->
assertEquals
(
'John Doe'
,
$user
->
name
);
}
}
public
function
testNoDocument
()
{
$items
=
Item
::
where
(
'name'
,
'nothing'
)
->
get
();
$this
->
assertInstanceOf
(
'Illuminate\Database\Eloquent\Collection'
,
$items
);
$this
->
assertEquals
(
0
,
$items
->
count
());
$item
=
Item
::
where
(
'name'
,
'nothing'
)
->
first
();
$this
->
assertEquals
(
null
,
$item
);
$item
=
Item
::
find
(
'51c33d8981fec6813e00000a'
);
$this
->
assertEquals
(
null
,
$item
);
}
/**
/**
* @expectedException Illuminate\Database\Eloquent\ModelNotFoundException
* @expectedException Illuminate\Database\Eloquent\ModelNotFoundException
*/
*/
...
...
tests/QueryBuilderTest.php
View file @
bc686c93
...
@@ -29,6 +29,18 @@ class QueryBuilderTest extends PHPUnit_Framework_TestCase {
...
@@ -29,6 +29,18 @@ class QueryBuilderTest extends PHPUnit_Framework_TestCase {
$this
->
assertEquals
(
1
,
count
(
$users
));
$this
->
assertEquals
(
1
,
count
(
$users
));
}
}
public
function
testNoDocument
()
{
$items
=
DB
::
collection
(
'items'
)
->
where
(
'name'
,
'nothing'
)
->
get
();
$this
->
assertEquals
(
array
(),
$items
);
$item
=
DB
::
collection
(
'items'
)
->
where
(
'name'
,
'nothing'
)
->
first
();
$this
->
assertEquals
(
null
,
$item
);
$item
=
DB
::
collection
(
'items'
)
->
where
(
'_id'
,
'51c33d8981fec6813e00000a'
)
->
first
();
$this
->
assertEquals
(
null
,
$item
);
}
public
function
testInsert
()
public
function
testInsert
()
{
{
DB
::
collection
(
'users'
)
->
insert
(
array
(
DB
::
collection
(
'users'
)
->
insert
(
array
(
...
...
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