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
7f467291
Commit
7f467291
authored
Feb 10, 2012
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
37220ee8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
28 deletions
+15
-28
ActiveRecordTest.php
tests/unit/framework/db/ar/ActiveRecordTest.php
+15
-28
No files found.
tests/unit/framework/db/ar/ActiveRecordTest.php
View file @
7f467291
...
@@ -41,6 +41,7 @@ class ActiveRecordTest extends \yiiunit\MysqlTestCase
...
@@ -41,6 +41,7 @@ class ActiveRecordTest extends \yiiunit\MysqlTestCase
$customer
->
name
=
'user2x'
;
$customer
->
name
=
'user2x'
;
$customer
->
save
();
$customer
->
save
();
$this
->
assertEquals
(
'user2x'
,
$customer
->
name
);
$this
->
assertEquals
(
'user2x'
,
$customer
->
name
);
$this
->
assertFalse
(
$customer
->
isNewRecord
);
$customer2
=
Customer
::
find
(
2
)
->
one
();
$customer2
=
Customer
::
find
(
2
)
->
one
();
$this
->
assertEquals
(
'user2x'
,
$customer2
->
name
);
$this
->
assertEquals
(
'user2x'
,
$customer2
->
name
);
...
@@ -89,19 +90,20 @@ class ActiveRecordTest extends \yiiunit\MysqlTestCase
...
@@ -89,19 +90,20 @@ class ActiveRecordTest extends \yiiunit\MysqlTestCase
public
function
testDelete
()
public
function
testDelete
()
{
{
$post
=
Post2
::
model
()
->
findByPk
(
1
);
// delete
$this
->
assertTrue
(
$post
->
delete
());
$customer
=
Customer
::
find
(
2
)
->
one
();
$this
->
assertNull
(
Post2
::
model
()
->
findByPk
(
1
));
$this
->
assertTrue
(
$customer
instanceof
Customer
);
$this
->
assertEquals
(
'user2'
,
$customer
->
name
);
$this
->
assertTrue
(
Post2
::
model
()
->
findByPk
(
2
)
instanceof
Post2
);
$customer
->
delete
();
$this
->
assertTrue
(
Post2
::
model
()
->
findByPk
(
3
)
instanceof
Post2
);
$customer
=
Customer
::
find
(
2
)
->
one
();
$this
->
assertEquals
(
2
,
Post2
::
model
()
->
deleteByPk
(
array
(
2
,
3
)));
$this
->
assertNull
(
$customer
);
$this
->
assertNull
(
Post2
::
model
()
->
findByPk
(
2
));
$this
->
assertNull
(
Post2
::
model
()
->
findByPk
(
3
));
// deleteAll
$customers
=
Customer
::
find
()
->
all
();
$this
->
assertTrue
(
Post2
::
model
()
->
findByPk
(
5
)
instanceof
Post2
);
$this
->
assertEquals
(
2
,
count
(
$customers
));
$this
->
assertEquals
(
1
,
Post2
::
model
()
->
deleteAll
(
'id=5'
));
Customer
::
deleteAll
();
$this
->
assertNull
(
Post2
::
model
()
->
findByPk
(
5
));
$customers
=
Customer
::
find
()
->
all
();
$this
->
assertEquals
(
0
,
count
(
$customers
));
}
}
public
function
testFind
()
public
function
testFind
()
...
@@ -248,21 +250,6 @@ class ActiveRecordTest extends \yiiunit\MysqlTestCase
...
@@ -248,21 +250,6 @@ class ActiveRecordTest extends \yiiunit\MysqlTestCase
// Customer::deleteAll()
// Customer::deleteAll()
}
}
public function testInsert()
{
}
public function testUpdate()
{
}
public function testDelete()
{
}
public function testLazyLoading()
public function testLazyLoading()
{
{
...
...
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