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
73a466ae
Unverified
Commit
73a466ae
authored
Mar 13, 2018
by
Ashley Dawson
Committed by
Sergei Morozov
Jun 11, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added functional test for date arithmetic using a column reference for SQLite
parent
79c732ba
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
0 deletions
+30
-0
DataAccessTest.php
tests/Doctrine/Tests/DBAL/Functional/DataAccessTest.php
+30
-0
No files found.
tests/Doctrine/Tests/DBAL/Functional/DataAccessTest.php
View file @
73a466ae
...
@@ -5,7 +5,9 @@ namespace Doctrine\Tests\DBAL\Functional;
...
@@ -5,7 +5,9 @@ namespace Doctrine\Tests\DBAL\Functional;
use
Doctrine\DBAL\Connection
;
use
Doctrine\DBAL\Connection
;
use
Doctrine\DBAL\FetchMode
;
use
Doctrine\DBAL\FetchMode
;
use
Doctrine\DBAL\ParameterType
;
use
Doctrine\DBAL\ParameterType
;
use
Doctrine\DBAL\Platforms\SqlitePlatform
;
use
Doctrine\DBAL\Platforms\TrimMode
;
use
Doctrine\DBAL\Platforms\TrimMode
;
use
Doctrine\DBAL\Schema\Table
;
use
Doctrine\DBAL\Types\Type
;
use
Doctrine\DBAL\Types\Type
;
use
const
CASE_LOWER
;
use
const
CASE_LOWER
;
use
const
PHP_EOL
;
use
const
PHP_EOL
;
...
@@ -569,6 +571,34 @@ class DataAccessTest extends \Doctrine\Tests\DbalFunctionalTestCase
...
@@ -569,6 +571,34 @@ class DataAccessTest extends \Doctrine\Tests\DbalFunctionalTestCase
self
::
assertEquals
(
'2004-01-01'
,
date
(
'Y-m-d'
,
strtotime
(
$row
[
'sub_years'
])),
"Subtracting years should end up on 2004-01-01"
);
self
::
assertEquals
(
'2004-01-01'
,
date
(
'Y-m-d'
,
strtotime
(
$row
[
'sub_years'
])),
"Subtracting years should end up on 2004-01-01"
);
}
}
public
function
testSqliteDateArithmeticWithDynamicInterval
()
{
$platform
=
$this
->
_conn
->
getDatabasePlatform
();
if
(
!
$platform
instanceof
SqlitePlatform
)
{
$this
->
markTestSkipped
(
'test is for sqlite only'
);
}
$table
=
new
Table
(
'fetch_table_date_math'
);
$table
->
addColumn
(
'test_date'
,
'date'
);
$table
->
addColumn
(
'test_days'
,
'integer'
);
$table
->
setPrimaryKey
([
'test_date'
]);
/* @var $sm \Doctrine\DBAL\Schema\AbstractSchemaManager */
$sm
=
$this
->
_conn
->
getSchemaManager
();
$sm
->
createTable
(
$table
);
$this
->
_conn
->
insert
(
'fetch_table_date_math'
,
[
'test_date'
=>
'2010-01-01'
,
'test_days'
=>
10
]);
$this
->
_conn
->
insert
(
'fetch_table_date_math'
,
[
'test_date'
=>
'2010-06-01'
,
'test_days'
=>
20
]);
$sql
=
'SELECT COUNT(*) FROM fetch_table_date_math WHERE '
;
$sql
.=
$platform
->
getDateSubDaysExpression
(
'test_date'
,
'test_days'
)
.
" < '2010-05-12'"
;
$rowCount
=
$this
->
_conn
->
fetchColumn
(
$sql
,
[],
0
);
$this
->
assertEquals
(
1
,
$rowCount
);
}
public
function
testLocateExpression
()
public
function
testLocateExpression
()
{
{
$platform
=
$this
->
_conn
->
getDatabasePlatform
();
$platform
=
$this
->
_conn
->
getDatabasePlatform
();
...
...
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