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
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Rotua Panjaitan
yii2
Commits
0208f289
Commit
0208f289
authored
Jun 04, 2014
by
Carsten Brandt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed test breaks
parent
59b9065c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
14 deletions
+14
-14
ActiveRecordTestTrait.php
tests/unit/framework/ar/ActiveRecordTestTrait.php
+5
-5
ActiveRecordTest.php
tests/unit/framework/db/ActiveRecordTest.php
+9
-9
No files found.
tests/unit/framework/ar/ActiveRecordTestTrait.php
View file @
0208f289
...
@@ -773,23 +773,23 @@ trait ActiveRecordTestTrait
...
@@ -773,23 +773,23 @@ trait ActiveRecordTestTrait
/** @var Order $order */
/** @var Order $order */
$order
=
$orderClass
::
findOne
(
1
);
$order
=
$orderClass
::
findOne
(
1
);
$this
->
assertEquals
(
2
,
count
(
$order
->
books
));
$this
->
assertEquals
(
2
,
count
(
$order
->
books
));
$
this
->
assertEquals
(
6
,
$orderItemClass
::
find
()
->
count
()
);
$
orderItemCount
=
$orderItemClass
::
find
()
->
count
(
);
$this
->
assertEquals
(
5
,
$itemClass
::
find
()
->
count
());
$this
->
assertEquals
(
5
,
$itemClass
::
find
()
->
count
());
$order
->
unlinkAll
(
'books'
,
true
);
$order
->
unlinkAll
(
'books'
,
true
);
$this
->
afterSave
();
$this
->
afterSave
();
$this
->
assertEquals
(
5
,
$itemClass
::
find
()
->
count
());
$this
->
assertEquals
(
5
,
$itemClass
::
find
()
->
count
());
$this
->
assertEquals
(
4
,
$orderItemClass
::
find
()
->
count
());
$this
->
assertEquals
(
$orderItemCount
-
2
,
$orderItemClass
::
find
()
->
count
());
$this
->
assertEquals
(
0
,
count
(
$order
->
books
));
$this
->
assertEquals
(
0
,
count
(
$order
->
books
));
// via model without delete
// via model without delete
$this
->
assertEquals
(
2
,
count
(
$order
->
booksWithNullFK
));
$this
->
assertEquals
(
2
,
count
(
$order
->
booksWithNullFK
));
$
this
->
assertEquals
(
6
,
$orderItemsWithNullFKClass
::
find
()
->
count
()
);
$
orderItemCount
=
$orderItemsWithNullFKClass
::
find
()
->
count
(
);
$this
->
assertEquals
(
5
,
$itemClass
::
find
()
->
count
());
$this
->
assertEquals
(
5
,
$itemClass
::
find
()
->
count
());
$order
->
unlinkAll
(
'booksWithNullFK'
,
false
);
$order
->
unlinkAll
(
'booksWithNullFK'
,
false
);
$this
->
afterSave
();
$this
->
afterSave
();
$this
->
assertEquals
(
0
,
count
(
$order
->
booksWithNullFK
));
$this
->
assertEquals
(
0
,
count
(
$order
->
booksWithNullFK
));
$this
->
assertEquals
(
2
,
$orderItemsWithNullFKClass
::
find
()
->
where
([
'AND'
,
[
'item_id'
=>
[
1
,
2
]],
[
'order_id'
=>
null
]])
->
count
());
$this
->
assertEquals
(
2
,
$orderItemsWithNullFKClass
::
find
()
->
where
([
'AND'
,
[
'item_id'
=>
[
1
,
2
]],
[
'order_id'
=>
null
]])
->
count
());
$this
->
assertEquals
(
6
,
$orderItemsWithNullFKClass
::
find
()
->
count
());
$this
->
assertEquals
(
$orderItemCount
,
$orderItemsWithNullFKClass
::
find
()
->
count
());
$this
->
assertEquals
(
5
,
$itemClass
::
find
()
->
count
());
$this
->
assertEquals
(
5
,
$itemClass
::
find
()
->
count
());
// via table is covered in \yiiunit\framework\db\ActiveRecordTest::testUnlinkAllViaTable()
// via table is covered in \yiiunit\framework\db\ActiveRecordTest::testUnlinkAllViaTable()
...
...
tests/unit/framework/db/ActiveRecordTest.php
View file @
0208f289
...
@@ -543,30 +543,30 @@ class ActiveRecordTest extends DatabaseTestCase
...
@@ -543,30 +543,30 @@ class ActiveRecordTest extends DatabaseTestCase
/** @var \yii\db\ActiveRecordInterface $orderItemClass */
/** @var \yii\db\ActiveRecordInterface $orderItemClass */
$orderItemClass
=
$this
->
getOrderItemClass
();
$orderItemClass
=
$this
->
getOrderItemClass
();
/** @var \yii\db\ActiveRecordInterface $itemClass */
/** @var \yii\db\ActiveRecordInterface $itemClass */
$itemClass
=
$this
->
get
Order
ItemClass
();
$itemClass
=
$this
->
getItemClass
();
/** @var \yii\db\ActiveRecordInterface $orderItemsWithNullFKClass */
/** @var \yii\db\ActiveRecordInterface $orderItemsWithNullFKClass */
$orderItemsWithNullFKClass
=
$this
->
getOrderItemWithNullFKmClass
();
$orderItemsWithNullFKClass
=
$this
->
getOrderItemWithNullFKmClass
();
// via table with delete
// via table with delete
/** @var Order $order */
/** @var Order $order */
$order
=
$orderClass
::
findOne
(
1
);
$order
=
$orderClass
::
findOne
(
1
);
$this
->
assertEquals
(
2
,
count
(
$order
->
books
));
$this
->
assertEquals
(
2
,
count
(
$order
->
books
ViaTable
));
$
this
->
assertEquals
(
6
,
$orderItemClass
::
find
()
->
count
()
);
$
orderItemCount
=
$orderItemClass
::
find
()
->
count
(
);
$this
->
assertEquals
(
5
,
$itemClass
::
find
()
->
count
());
$this
->
assertEquals
(
5
,
$itemClass
::
find
()
->
count
());
$order
->
unlinkAll
(
'booksViaTable'
,
true
);
$order
->
unlinkAll
(
'booksViaTable'
,
true
);
$this
->
afterSave
();
$this
->
afterSave
();
$this
->
assertEquals
(
5
,
$itemClass
::
find
()
->
count
());
$this
->
assertEquals
(
5
,
$itemClass
::
find
()
->
count
());
$this
->
assertEquals
(
4
,
$orderItemClass
::
find
()
->
count
());
$this
->
assertEquals
(
$orderItemCount
-
2
,
$orderItemClass
::
find
()
->
count
());
$this
->
assertEquals
(
0
,
count
(
$order
->
books
));
$this
->
assertEquals
(
0
,
count
(
$order
->
books
ViaTable
));
// via table without delete
// via table without delete
$this
->
assertEquals
(
2
,
count
(
$order
->
booksWithNullFK
));
$this
->
assertEquals
(
2
,
count
(
$order
->
booksWithNullFK
ViaTable
));
$
this
->
assertEquals
(
6
,
$orderItemsWithNullFKClass
::
find
()
->
count
()
);
$
orderItemCount
=
$orderItemsWithNullFKClass
::
find
()
->
count
(
);
$this
->
assertEquals
(
5
,
$itemClass
::
find
()
->
count
());
$this
->
assertEquals
(
5
,
$itemClass
::
find
()
->
count
());
$order
->
unlinkAll
(
'booksWithNullFKViaTable'
,
false
);
$order
->
unlinkAll
(
'booksWithNullFKViaTable'
,
false
);
$this
->
assertEquals
(
0
,
count
(
$order
->
booksWithNullFK
));
$this
->
assertEquals
(
0
,
count
(
$order
->
booksWithNullFK
ViaTable
));
$this
->
assertEquals
(
2
,
$orderItemsWithNullFKClass
::
find
()
->
where
([
'AND'
,
[
'item_id'
=>
[
1
,
2
]],
[
'order_id'
=>
null
]])
->
count
());
$this
->
assertEquals
(
2
,
$orderItemsWithNullFKClass
::
find
()
->
where
([
'AND'
,
[
'item_id'
=>
[
1
,
2
]],
[
'order_id'
=>
null
]])
->
count
());
$this
->
assertEquals
(
6
,
$orderItemsWithNullFKClass
::
find
()
->
count
());
$this
->
assertEquals
(
$orderItemCount
,
$orderItemsWithNullFKClass
::
find
()
->
count
());
$this
->
assertEquals
(
5
,
$itemClass
::
find
()
->
count
());
$this
->
assertEquals
(
5
,
$itemClass
::
find
()
->
count
());
}
}
}
}
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