Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
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
PSDI Army
yii2
Commits
6fbd710d
Commit
6fbd710d
authored
Dec 01, 2014
by
Klimov Paul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extra unit test for `yii\mongodb\Query::modify()` added
parent
29c3c248
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
0 deletions
+10
-0
ActiveRecordTest.php
tests/unit/extensions/mongodb/ActiveRecordTest.php
+5
-0
QueryRunTest.php
tests/unit/extensions/mongodb/QueryRunTest.php
+5
-0
No files found.
tests/unit/extensions/mongodb/ActiveRecordTest.php
View file @
6fbd710d
...
@@ -274,6 +274,11 @@ class ActiveRecordTest extends MongoDbTestCase
...
@@ -274,6 +274,11 @@ class ActiveRecordTest extends MongoDbTestCase
->
modify
([
'$set'
=>
[
'name'
=>
$newName
]],
[
'new'
=>
true
]);
->
modify
([
'$set'
=>
[
'name'
=>
$newName
]],
[
'new'
=>
true
]);
$this
->
assertTrue
(
$customer
instanceof
Customer
);
$this
->
assertTrue
(
$customer
instanceof
Customer
);
$this
->
assertEquals
(
$newName
,
$customer
->
name
);
$this
->
assertEquals
(
$newName
,
$customer
->
name
);
$customer
=
Customer
::
find
()
->
where
([
'name'
=>
'not existing name'
])
->
modify
([
'$set'
=>
[
'name'
=>
$newName
]],
[
'new'
=>
false
]);
$this
->
assertNull
(
$customer
);
}
}
/**
/**
...
...
tests/unit/extensions/mongodb/QueryRunTest.php
View file @
6fbd710d
...
@@ -230,6 +230,11 @@ class QueryRunTest extends MongoDbTestCase
...
@@ -230,6 +230,11 @@ class QueryRunTest extends MongoDbTestCase
->
where
([
'name'
=>
$searchName
])
->
where
([
'name'
=>
$searchName
])
->
modify
([
'$set'
=>
[
'name'
=>
$newName
]],
[
'new'
=>
true
],
$connection
);
->
modify
([
'$set'
=>
[
'name'
=>
$newName
]],
[
'new'
=>
true
],
$connection
);
$this
->
assertEquals
(
$newName
,
$row
[
'name'
]);
$this
->
assertEquals
(
$newName
,
$row
[
'name'
]);
$row
=
$query
->
from
(
'customer'
)
->
where
([
'name'
=>
'not existing name'
])
->
modify
([
'$set'
=>
[
'name'
=>
'new name'
]],
[
'new'
=>
false
],
$connection
);
$this
->
assertNull
(
$row
);
}
}
/**
/**
...
...
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