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
bace8878
Commit
bace8878
authored
Dec 08, 2011
by
Fabio B. Silva
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
functional tests
parent
5244b8f8
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
54 additions
and
3 deletions
+54
-3
AbstractPlatform.php
lib/Doctrine/DBAL/Platforms/AbstractPlatform.php
+1
-1
OraclePlatform.php
lib/Doctrine/DBAL/Platforms/OraclePlatform.php
+1
-1
DataAccessTest.php
tests/Doctrine/Tests/DBAL/Functional/DataAccessTest.php
+51
-0
AbstractPlatformTestCase.php
...octrine/Tests/DBAL/Platforms/AbstractPlatformTestCase.php
+1
-1
No files found.
lib/Doctrine/DBAL/Platforms/AbstractPlatform.php
View file @
bace8878
...
...
@@ -797,7 +797,7 @@ abstract class AbstractPlatform
{
return
'('
.
$value1
.
' & '
.
$value2
.
')'
;
}
/**
* Gets SQL bit OR comparison expression
*
...
...
lib/Doctrine/DBAL/Platforms/OraclePlatform.php
View file @
bace8878
...
...
@@ -147,7 +147,7 @@ class OraclePlatform extends AbstractPlatform
{
return
"ADD_MONTHS("
.
$date
.
", -"
.
$months
.
")"
;
}
/**
* {@inheritdoc}
*/
...
...
tests/Doctrine/Tests/DBAL/Functional/DataAccessTest.php
View file @
bace8878
...
...
@@ -318,6 +318,57 @@ class DataAccessTest extends \Doctrine\Tests\DbalFunctionalTestCase
$this
->
assertEquals
(
0
,
count
(
$rows
),
"no result should be returned, otherwise SQL injection is possible"
);
}
/**
* @group DDC-1213
*/
public
function
testBitComparisonExpressionSupport
()
{
$this
->
_conn
->
executeQuery
(
'DELETE FROM fetch_table'
)
->
execute
();
$platform
=
$this
->
_conn
->
getDatabasePlatform
();;
$bitmap
=
array
();
for
(
$i
=
2
;
$i
<
9
;
$i
=
$i
+
2
)
{
$bitmap
[
$i
]
=
array
(
'bit_or'
=>
(
$i
|
2
),
'bit_and'
=>
(
$i
&
2
)
);
$this
->
_conn
->
insert
(
'fetch_table'
,
array
(
'test_int'
=>
$i
,
'test_string'
=>
json_encode
(
$bitmap
[
$i
]),
'test_datetime'
=>
'2010-01-01 10:10:10'
));
}
$sql
[]
=
'SELECT '
;
$sql
[]
=
'test_int, '
;
$sql
[]
=
'test_string, '
;
$sql
[]
=
$platform
->
getBitOrComparisonExpression
(
'test_int'
,
2
)
.
' AS bit_or, '
;
$sql
[]
=
$platform
->
getBitAndComparisonExpression
(
'test_int'
,
2
)
.
' AS bit_and '
;
$sql
[]
=
'FROM fetch_table'
;
$stmt
=
$this
->
_conn
->
executeQuery
(
implode
(
PHP_EOL
,
$sql
));
$data
=
$stmt
->
fetchAll
(
PDO
::
FETCH_ASSOC
);
$this
->
assertEquals
(
4
,
count
(
$data
));
$this
->
assertEquals
(
count
(
$bitmap
),
count
(
$data
));
foreach
(
$data
as
$row
)
{
$this
->
assertArrayHasKey
(
'test_int'
,
$row
);
$id
=
$row
[
'test_int'
];
$this
->
assertArrayHasKey
(
$id
,
$bitmap
);
$this
->
assertArrayHasKey
(
$id
,
$bitmap
);
$this
->
assertArrayHasKey
(
'bit_or'
,
$row
);
$this
->
assertArrayHasKey
(
'bit_and'
,
$row
);
$this
->
assertEquals
(
$row
[
'bit_or'
],
$bitmap
[
$id
][
'bit_or'
]);
$this
->
assertEquals
(
$row
[
'bit_and'
],
$bitmap
[
$id
][
'bit_and'
]);
}
}
public
function
testSetDefaultFetchMode
()
{
...
...
tests/Doctrine/Tests/DBAL/Platforms/AbstractPlatformTestCase.php
View file @
bace8878
...
...
@@ -130,7 +130,7 @@ abstract class AbstractPlatformTestCase extends \Doctrine\Tests\DbalTestCase
$sql
=
$this
->
_platform
->
getCreateConstraintSQL
(
$fk
,
'test'
);
$this
->
assertEquals
(
$this
->
getGenerateConstraintForeignKeySql
(),
$sql
);
}
protected
function
getBitAndComparisonExpressionSql
(
$value1
,
$value2
)
{
return
'('
.
$value1
.
' & '
.
$value2
.
')'
;
...
...
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