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
db622f7a
Commit
db622f7a
authored
Aug 22, 2013
by
Jens Segers
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tweaked tests
parent
209b3013
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
6 deletions
+14
-6
QueryBuilderTest.php
tests/QueryBuilderTest.php
+12
-4
QueryTest.php
tests/QueryTest.php
+2
-2
No files found.
tests/QueryBuilderTest.php
View file @
db622f7a
...
@@ -234,10 +234,10 @@ class QueryBuilderTest extends PHPUnit_Framework_TestCase {
...
@@ -234,10 +234,10 @@ class QueryBuilderTest extends PHPUnit_Framework_TestCase {
public
function
testDistinct
()
public
function
testDistinct
()
{
{
DB
::
collection
(
'items'
)
->
insert
(
array
(
DB
::
collection
(
'items'
)
->
insert
(
array
(
array
(
'name'
=>
'knife'
,
'type'
=>
'sharp'
,
'amount'
=>
34
),
array
(
'name'
=>
'knife'
,
'type'
=>
'sharp'
,),
array
(
'name'
=>
'fork'
,
'type'
=>
'sharp'
,
'amount'
=>
20
),
array
(
'name'
=>
'fork'
,
'type'
=>
'sharp'
),
array
(
'name'
=>
'spoon'
,
'type'
=>
'round'
,
'amount'
=>
3
),
array
(
'name'
=>
'spoon'
,
'type'
=>
'round'
),
array
(
'name'
=>
'spoon'
,
'type'
=>
'round'
,
'amount'
=>
14
)
array
(
'name'
=>
'spoon'
,
'type'
=>
'round'
)
));
));
$items
=
DB
::
collection
(
'items'
)
->
distinct
(
'name'
)
->
get
();
$items
=
DB
::
collection
(
'items'
)
->
distinct
(
'name'
)
->
get
();
...
@@ -260,6 +260,14 @@ class QueryBuilderTest extends PHPUnit_Framework_TestCase {
...
@@ -260,6 +260,14 @@ class QueryBuilderTest extends PHPUnit_Framework_TestCase {
$item
=
DB
::
collection
(
'items'
)
->
where
(
'_id'
,
'fork'
)
->
first
();
$item
=
DB
::
collection
(
'items'
)
->
where
(
'_id'
,
'fork'
)
->
first
();
$this
->
assertEquals
(
'fork'
,
$item
[
'_id'
]);
$this
->
assertEquals
(
'fork'
,
$item
[
'_id'
]);
DB
::
collection
(
'users'
)
->
insert
(
array
(
array
(
'_id'
=>
1
,
'name'
=>
'Jane Doe'
),
array
(
'_id'
=>
2
,
'name'
=>
'John Doe'
)
));
$item
=
DB
::
collection
(
'users'
)
->
find
(
1
);
$this
->
assertEquals
(
1
,
$item
[
'_id'
]);
}
}
public
function
testTake
()
public
function
testTake
()
...
...
tests/QueryTest.php
View file @
db622f7a
...
@@ -3,7 +3,7 @@ require_once('tests/app.php');
...
@@ -3,7 +3,7 @@ require_once('tests/app.php');
class
QueryTest
extends
PHPUnit_Framework_TestCase
{
class
QueryTest
extends
PHPUnit_Framework_TestCase
{
public
function
setUp
()
public
static
function
setUpBeforeClass
()
{
{
// test data
// test data
User
::
create
(
array
(
'name'
=>
'John Doe'
,
'age'
=>
35
,
'title'
=>
'admin'
));
User
::
create
(
array
(
'name'
=>
'John Doe'
,
'age'
=>
35
,
'title'
=>
'admin'
));
...
@@ -17,7 +17,7 @@ class QueryTest extends PHPUnit_Framework_TestCase {
...
@@ -17,7 +17,7 @@ class QueryTest extends PHPUnit_Framework_TestCase {
User
::
create
(
array
(
'name'
=>
'Error'
,
'age'
=>
null
,
'title'
=>
null
));
User
::
create
(
array
(
'name'
=>
'Error'
,
'age'
=>
null
,
'title'
=>
null
));
}
}
public
function
tearDown
()
public
static
function
tearDownAfterClass
()
{
{
User
::
truncate
();
User
::
truncate
();
}
}
...
...
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