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
e5a1244e
Commit
e5a1244e
authored
Nov 01, 2013
by
Carsten Brandt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
moved unit test from cubrid to general
should be tested for all dbms not only cubrid even if the problem may not exist in all of them it is good to verify that.
parent
1bee8474
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
28 deletions
+28
-28
ActiveRecordTest.php
tests/unit/framework/db/ActiveRecordTest.php
+28
-0
CubridActiveRecordTest.php
tests/unit/framework/db/cubrid/CubridActiveRecordTest.php
+0
-28
No files found.
tests/unit/framework/db/ActiveRecordTest.php
View file @
e5a1244e
...
...
@@ -426,4 +426,32 @@ class ActiveRecordTest extends DatabaseTestCase
$this
->
assertEquals
(
0
,
$record
->
var3
);
$this
->
assertEquals
(
''
,
$record
->
stringcol
);
}
/**
* Some PDO implementations(e.g. cubrid) do not support boolean values.
* Make sure this does not affect AR layer.
*/
public
function
testBooleanAttribute
()
{
$customer
=
new
Customer
();
$customer
->
name
=
'boolean customer'
;
$customer
->
email
=
'mail@example.com'
;
$customer
->
status
=
true
;
$customer
->
save
(
false
);
$customer
->
refresh
();
$this
->
assertEquals
(
1
,
$customer
->
status
);
$customer
->
status
=
false
;
$customer
->
save
(
false
);
$customer
->
refresh
();
$this
->
assertEquals
(
0
,
$customer
->
status
);
$customers
=
Customer
::
find
()
->
where
([
'status'
=>
true
])
->
all
();
$this
->
assertEquals
(
2
,
count
(
$customers
));
$customers
=
Customer
::
find
()
->
where
([
'status'
=>
false
])
->
all
();
$this
->
assertEquals
(
1
,
count
(
$customers
));
}
}
tests/unit/framework/db/cubrid/CubridActiveRecordTest.php
View file @
e5a1244e
...
...
@@ -11,32 +11,4 @@ use yiiunit\framework\db\ActiveRecordTest;
class
CubridActiveRecordTest
extends
ActiveRecordTest
{
public
$driverName
=
'cubrid'
;
/**
* cubrid PDO does not support boolean values.
* Make sure this does not affect AR layer.
*/
public
function
testBooleanAttribute
()
{
$customer
=
new
Customer
();
$customer
->
name
=
'boolean customer'
;
$customer
->
email
=
'mail@example.com'
;
$customer
->
status
=
true
;
$customer
->
save
(
false
);
$customer
->
refresh
();
$this
->
assertEquals
(
1
,
$customer
->
status
);
$customer
->
status
=
false
;
$customer
->
save
(
false
);
$customer
->
refresh
();
$this
->
assertEquals
(
0
,
$customer
->
status
);
$customers
=
Customer
::
find
()
->
where
([
'status'
=>
true
])
->
all
();
$this
->
assertEquals
(
2
,
count
(
$customers
));
$customers
=
Customer
::
find
()
->
where
([
'status'
=>
false
])
->
all
();
$this
->
assertEquals
(
1
,
count
(
$customers
));
}
}
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