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
d56e0201
Commit
d56e0201
authored
Nov 25, 2013
by
Carsten Brandt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more random test fixes
parent
c1febb74
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
7 deletions
+10
-7
ActiveRecordTest.php
tests/unit/extensions/elasticsearch/ActiveRecordTest.php
+2
-2
ActiveRecordTestTrait.php
tests/unit/framework/ar/ActiveRecordTestTrait.php
+8
-5
No files found.
tests/unit/extensions/elasticsearch/ActiveRecordTest.php
View file @
d56e0201
...
...
@@ -33,7 +33,7 @@ class ActiveRecordTest extends ElasticSearchTestCase
*/
public
function
afterSave
()
{
$this
->
getConnection
()
->
createCommand
()
->
flushIndex
();
$this
->
getConnection
()
->
createCommand
()
->
flushIndex
(
'yiitest'
);
}
public
function
setUp
()
...
...
@@ -129,7 +129,7 @@ class ActiveRecordTest extends ElasticSearchTestCase
$orderItem
->
setAttributes
([
'order_id'
=>
3
,
'item_id'
=>
2
,
'quantity'
=>
1
,
'subtotal'
=>
40.0
],
false
);
$orderItem
->
save
(
false
);
Customer
::
getDb
()
->
createCommand
()
->
flushIndex
(
);
$db
->
createCommand
()
->
flushIndex
(
'yiitest'
);
}
public
function
testGetDb
()
...
...
tests/unit/framework/ar/ActiveRecordTestTrait.php
View file @
d56e0201
...
...
@@ -352,14 +352,17 @@ trait ActiveRecordTestTrait
public
function
testFindEager
()
{
/** @var TestCase|ActiveRecordTestTrait $this */
$customers
=
$this
->
callCustomerFind
()
->
with
(
'orders'
)
->
all
();
$customers
=
$this
->
callCustomerFind
()
->
with
(
'orders'
)
->
indexBy
(
'id'
)
->
all
();
ksort
(
$customers
);
$this
->
assertEquals
(
3
,
count
(
$customers
));
$this
->
assertTrue
(
$customers
[
0
]
->
isRelationPopulated
(
'orders'
));
$this
->
assertTrue
(
$customers
[
1
]
->
isRelationPopulated
(
'orders'
));
$this
->
assertEquals
(
1
,
count
(
$customers
[
0
]
->
orders
));
$this
->
assertEquals
(
2
,
count
(
$customers
[
1
]
->
orders
));
$this
->
assertTrue
(
$customers
[
2
]
->
isRelationPopulated
(
'orders'
));
$this
->
assertTrue
(
$customers
[
3
]
->
isRelationPopulated
(
'orders'
));
$this
->
assertEquals
(
1
,
count
(
$customers
[
1
]
->
orders
));
$this
->
assertEquals
(
2
,
count
(
$customers
[
2
]
->
orders
));
$this
->
assertEquals
(
0
,
count
(
$customers
[
3
]
->
orders
));
$customer
=
$this
->
callCustomerFind
()
->
with
(
'orders'
)
->
one
();
$customer
=
$this
->
callCustomerFind
()
->
w
here
([
'id'
=>
1
])
->
w
ith
(
'orders'
)
->
one
();
$this
->
assertTrue
(
$customer
->
isRelationPopulated
(
'orders'
));
$this
->
assertEquals
(
1
,
count
(
$customer
->
orders
));
$this
->
assertEquals
(
1
,
count
(
$customer
->
populatedRelations
));
...
...
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