Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
Tomáš Trávníček
doctrine-dbal
Commits
f29f0fae
Commit
f29f0fae
authored
Jan 01, 2014
by
Benjamin Eberlei
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'DBAL-630'
parents
0d572181
dc416175
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
77 additions
and
0 deletions
+77
-0
DBAL630Test.php
tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL630Test.php
+77
-0
No files found.
tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL630Test.php
0 → 100644
View file @
f29f0fae
<?php
namespace
Doctrine\Tests\DBAL\Functional\Ticket
;
use
PDO
;
/**
* @group DBAL-630
*/
class
DBAL630Test
extends
\Doctrine\Tests\DbalFunctionalTestCase
{
private
$running
=
false
;
protected
function
setUp
()
{
parent
::
setUp
();
$platform
=
$this
->
_conn
->
getDatabasePlatform
()
->
getName
();
if
(
!
in_array
(
$platform
,
array
(
'postgresql'
)))
{
$this
->
markTestSkipped
(
'Currently restricted to PostgreSQL'
);
}
$sm
=
$this
->
_conn
->
getSchemaManager
();
if
(
!
$sm
->
tablesExist
(
array
(
'dbal630'
)))
{
$this
->
_conn
->
exec
(
'CREATE TABLE dbal630 (id SERIAL, bool_col BOOLEAN NOT NULL);'
);
}
$this
->
running
=
true
;
}
protected
function
tearDown
()
{
if
(
$this
->
running
)
{
$this
->
_conn
->
getWrappedConnection
()
->
setAttribute
(
PDO
::
ATTR_EMULATE_PREPARES
,
false
);
}
}
public
function
testBooleanConversionSqlLiteral
()
{
$this
->
_conn
->
executeUpdate
(
'INSERT INTO dbal630 (bool_col) VALUES(false)'
);
$id
=
$this
->
_conn
->
lastInsertId
(
'dbal630_id_seq'
);
$this
->
assertNotEmpty
(
$id
);
$row
=
$this
->
_conn
->
fetchAssoc
(
'SELECT bool_col FROM dbal630 WHERE id = ?'
,
array
(
$id
));
$this
->
assertFalse
(
$row
[
'bool_col'
]);
}
public
function
testBooleanConversionBoolParamRealPrepares
()
{
$this
->
_conn
->
executeUpdate
(
'INSERT INTO dbal630 (bool_col) VALUES(?)'
,
array
(
'false'
),
array
(
PDO
::
PARAM_BOOL
));
$id
=
$this
->
_conn
->
lastInsertId
(
'dbal630_id_seq'
);
$this
->
assertNotEmpty
(
$id
);
$row
=
$this
->
_conn
->
fetchAssoc
(
'SELECT bool_col FROM dbal630 WHERE id = ?'
,
array
(
$id
));
$this
->
assertFalse
(
$row
[
'bool_col'
]);
}
public
function
testBooleanConversionBoolParamEmulatedPrepares
()
{
$this
->
_conn
->
getWrappedConnection
()
->
setAttribute
(
PDO
::
ATTR_EMULATE_PREPARES
,
true
);
$stmt
=
$this
->
_conn
->
prepare
(
'INSERT INTO dbal630 (bool_col) VALUES(?)'
);
$stmt
->
bindValue
(
1
,
'false'
,
PDO
::
PARAM_BOOL
);
$stmt
->
execute
();
$id
=
$this
->
_conn
->
lastInsertId
(
'dbal630_id_seq'
);
$this
->
assertNotEmpty
(
$id
);
$row
=
$this
->
_conn
->
fetchAssoc
(
'SELECT bool_col FROM dbal630 WHERE id = ?'
,
array
(
$id
));
$this
->
assertFalse
(
$row
[
'bool_col'
]);
}
}
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