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
937a55f4
Commit
937a55f4
authored
Nov 01, 2013
by
Carsten Brandt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed unit test for sqlite
parent
f153ce44
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
0 deletions
+31
-0
SqliteActiveRecordTest.php
tests/unit/framework/db/sqlite/SqliteActiveRecordTest.php
+31
-0
No files found.
tests/unit/framework/db/sqlite/SqliteActiveRecordTest.php
View file @
937a55f4
<?php
namespace
yiiunit\framework\db\sqlite
;
use
yiiunit\data\ar\Customer
;
use
yiiunit\framework\db\ActiveRecordTest
;
/**
...
...
@@ -10,4 +11,34 @@ use yiiunit\framework\db\ActiveRecordTest;
class
SqliteActiveRecordTest
extends
ActiveRecordTest
{
protected
$driverName
=
'sqlite'
;
/**
* 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
();
// sqlite will return empty string here but it would still
// evaluate to false or null so we accept it
$this
->
assertTrue
(
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