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
b8896c4f
Commit
b8896c4f
authored
Oct 30, 2011
by
Benjamin Eberlei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix DBAL tests to make testsuite run on SQL Azure
parent
3fd222f7
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
46 additions
and
37 deletions
+46
-37
DataAccessTest.php
tests/Doctrine/Tests/DBAL/Functional/DataAccessTest.php
+12
-8
NamedParametersTest.php
tests/Doctrine/Tests/DBAL/Functional/NamedParametersTest.php
+11
-10
PortabilityTest.php
tests/Doctrine/Tests/DBAL/Functional/PortabilityTest.php
+14
-13
ResultCacheTest.php
tests/Doctrine/Tests/DBAL/Functional/ResultCacheTest.php
+1
-0
TemporaryTableTest.php
tests/Doctrine/Tests/DBAL/Functional/TemporaryTableTest.php
+3
-1
DateTimeTest.php
tests/Doctrine/Tests/DBAL/Types/DateTimeTest.php
+2
-2
DateTimeTzTest.php
tests/Doctrine/Tests/DBAL/Types/DateTimeTzTest.php
+2
-2
VarDateTimeTest.php
tests/Doctrine/Tests/DBAL/Types/VarDateTimeTest.php
+1
-1
No files found.
tests/Doctrine/Tests/DBAL/Functional/DataAccessTest.php
View file @
b8896c4f
...
@@ -20,13 +20,14 @@ class DataAccessTest extends \Doctrine\Tests\DbalFunctionalTestCase
...
@@ -20,13 +20,14 @@ class DataAccessTest extends \Doctrine\Tests\DbalFunctionalTestCase
$table
->
addColumn
(
'test_int'
,
'integer'
);
$table
->
addColumn
(
'test_int'
,
'integer'
);
$table
->
addColumn
(
'test_string'
,
'string'
);
$table
->
addColumn
(
'test_string'
,
'string'
);
$table
->
addColumn
(
'test_datetime'
,
'datetime'
,
array
(
'notnull'
=>
false
));
$table
->
addColumn
(
'test_datetime'
,
'datetime'
,
array
(
'notnull'
=>
false
));
$table
->
setPrimaryKey
(
array
(
'test_int'
));
$sm
=
$this
->
_conn
->
getSchemaManager
();
$sm
=
$this
->
_conn
->
getSchemaManager
();
$sm
->
createTable
(
$table
);
$sm
->
createTable
(
$table
);
$this
->
_conn
->
insert
(
'fetch_table'
,
array
(
'test_int'
=>
1
,
'test_string'
=>
'foo'
,
'test_datetime'
=>
'2010-01-01 10:10:10'
));
$this
->
_conn
->
insert
(
'fetch_table'
,
array
(
'test_int'
=>
1
,
'test_string'
=>
'foo'
,
'test_datetime'
=>
'2010-01-01 10:10:10'
));
}
catch
(
\Exception
$e
)
{
}
catch
(
\Exception
$e
)
{
}
}
}
}
...
@@ -121,6 +122,7 @@ class DataAccessTest extends \Doctrine\Tests\DbalFunctionalTestCase
...
@@ -121,6 +122,7 @@ class DataAccessTest extends \Doctrine\Tests\DbalFunctionalTestCase
$stmt
->
execute
(
array
(
$paramInt
,
$paramStr
));
$stmt
->
execute
(
array
(
$paramInt
,
$paramStr
));
$row
=
$stmt
->
fetch
(
\PDO
::
FETCH_ASSOC
);
$row
=
$stmt
->
fetch
(
\PDO
::
FETCH_ASSOC
);
$this
->
assertTrue
(
$row
!==
false
);
$row
=
array_change_key_case
(
$row
,
\CASE_LOWER
);
$row
=
array_change_key_case
(
$row
,
\CASE_LOWER
);
$this
->
assertEquals
(
array
(
'test_int'
=>
1
,
'test_string'
=>
'foo'
),
$row
);
$this
->
assertEquals
(
array
(
'test_int'
=>
1
,
'test_string'
=>
'foo'
),
$row
);
}
}
...
@@ -145,8 +147,10 @@ class DataAccessTest extends \Doctrine\Tests\DbalFunctionalTestCase
...
@@ -145,8 +147,10 @@ class DataAccessTest extends \Doctrine\Tests\DbalFunctionalTestCase
$sql
=
"SELECT test_int, test_string FROM fetch_table WHERE test_int = ? AND test_string = ?"
;
$sql
=
"SELECT test_int, test_string FROM fetch_table WHERE test_int = ? AND test_string = ?"
;
$row
=
$this
->
_conn
->
fetchAssoc
(
$sql
,
array
(
1
,
'foo'
));
$row
=
$this
->
_conn
->
fetchAssoc
(
$sql
,
array
(
1
,
'foo'
));
$this
->
assertTrue
(
$row
!==
false
);
$row
=
array_change_key_case
(
$row
,
\CASE_LOWER
);
$row
=
array_change_key_case
(
$row
,
\CASE_LOWER
);
$this
->
assertEquals
(
1
,
$row
[
'test_int'
]);
$this
->
assertEquals
(
1
,
$row
[
'test_int'
]);
$this
->
assertEquals
(
'foo'
,
$row
[
'test_string'
]);
$this
->
assertEquals
(
'foo'
,
$row
[
'test_string'
]);
}
}
...
@@ -196,7 +200,7 @@ class DataAccessTest extends \Doctrine\Tests\DbalFunctionalTestCase
...
@@ -196,7 +200,7 @@ class DataAccessTest extends \Doctrine\Tests\DbalFunctionalTestCase
$sql
=
'INSERT INTO fetch_table (test_int, test_string, test_datetime) VALUES (?, ?, ?)'
;
$sql
=
'INSERT INTO fetch_table (test_int, test_string, test_datetime) VALUES (?, ?, ?)'
;
$affectedRows
=
$this
->
_conn
->
executeUpdate
(
$sql
,
$affectedRows
=
$this
->
_conn
->
executeUpdate
(
$sql
,
array
(
1
=>
1
,
2
=>
'foo'
,
3
=>
$datetime
),
array
(
1
=>
50
,
2
=>
'foo'
,
3
=>
$datetime
),
array
(
1
=>
PDO
::
PARAM_INT
,
2
=>
PDO
::
PARAM_STR
,
3
=>
Type
::
DATETIME
)
array
(
1
=>
PDO
::
PARAM_INT
,
2
=>
PDO
::
PARAM_STR
,
3
=>
Type
::
DATETIME
)
);
);
...
@@ -220,7 +224,7 @@ class DataAccessTest extends \Doctrine\Tests\DbalFunctionalTestCase
...
@@ -220,7 +224,7 @@ class DataAccessTest extends \Doctrine\Tests\DbalFunctionalTestCase
$this
->
assertEquals
(
1
,
$stmt
->
fetchColumn
());
$this
->
assertEquals
(
1
,
$stmt
->
fetchColumn
());
}
}
/**
/**
* @group DBAL-78
* @group DBAL-78
*/
*/
...
@@ -229,17 +233,17 @@ class DataAccessTest extends \Doctrine\Tests\DbalFunctionalTestCase
...
@@ -229,17 +233,17 @@ class DataAccessTest extends \Doctrine\Tests\DbalFunctionalTestCase
for
(
$i
=
100
;
$i
<
110
;
$i
++
)
{
for
(
$i
=
100
;
$i
<
110
;
$i
++
)
{
$this
->
_conn
->
insert
(
'fetch_table'
,
array
(
'test_int'
=>
$i
,
'test_string'
=>
'foo'
.
$i
,
'test_datetime'
=>
'2010-01-01 10:10:10'
));
$this
->
_conn
->
insert
(
'fetch_table'
,
array
(
'test_int'
=>
$i
,
'test_string'
=>
'foo'
.
$i
,
'test_datetime'
=>
'2010-01-01 10:10:10'
));
}
}
$stmt
=
$this
->
_conn
->
executeQuery
(
'SELECT test_int FROM fetch_table WHERE test_int IN (?)'
,
$stmt
=
$this
->
_conn
->
executeQuery
(
'SELECT test_int FROM fetch_table WHERE test_int IN (?)'
,
array
(
array
(
100
,
101
,
102
,
103
,
104
)),
array
(
Connection
::
PARAM_INT_ARRAY
));
array
(
array
(
100
,
101
,
102
,
103
,
104
)),
array
(
Connection
::
PARAM_INT_ARRAY
));
$data
=
$stmt
->
fetchAll
(
PDO
::
FETCH_NUM
);
$data
=
$stmt
->
fetchAll
(
PDO
::
FETCH_NUM
);
$this
->
assertEquals
(
5
,
count
(
$data
));
$this
->
assertEquals
(
5
,
count
(
$data
));
$this
->
assertEquals
(
array
(
array
(
100
),
array
(
101
),
array
(
102
),
array
(
103
),
array
(
104
)),
$data
);
$this
->
assertEquals
(
array
(
array
(
100
),
array
(
101
),
array
(
102
),
array
(
103
),
array
(
104
)),
$data
);
$stmt
=
$this
->
_conn
->
executeQuery
(
'SELECT test_int FROM fetch_table WHERE test_string IN (?)'
,
$stmt
=
$this
->
_conn
->
executeQuery
(
'SELECT test_int FROM fetch_table WHERE test_string IN (?)'
,
array
(
array
(
'foo100'
,
'foo101'
,
'foo102'
,
'foo103'
,
'foo104'
)),
array
(
Connection
::
PARAM_STR_ARRAY
));
array
(
array
(
'foo100'
,
'foo101'
,
'foo102'
,
'foo103'
,
'foo104'
)),
array
(
Connection
::
PARAM_STR_ARRAY
));
$data
=
$stmt
->
fetchAll
(
PDO
::
FETCH_NUM
);
$data
=
$stmt
->
fetchAll
(
PDO
::
FETCH_NUM
);
$this
->
assertEquals
(
5
,
count
(
$data
));
$this
->
assertEquals
(
5
,
count
(
$data
));
$this
->
assertEquals
(
array
(
array
(
100
),
array
(
101
),
array
(
102
),
array
(
103
),
array
(
104
)),
$data
);
$this
->
assertEquals
(
array
(
array
(
100
),
array
(
101
),
array
(
102
),
array
(
103
),
array
(
104
)),
$data
);
...
...
tests/Doctrine/Tests/DBAL/Functional/NamedParametersTest.php
View file @
b8896c4f
...
@@ -27,7 +27,7 @@ class NamedParametersTest extends \Doctrine\Tests\DbalFunctionalTestCase
...
@@ -27,7 +27,7 @@ class NamedParametersTest extends \Doctrine\Tests\DbalFunctionalTestCase
array
(
'id'
=>
3
,
'foo'
=>
1
,
'bar'
=>
3
),
array
(
'id'
=>
3
,
'foo'
=>
1
,
'bar'
=>
3
),
)
)
),
),
array
(
array
(
'SELECT * FROM ddc1372_foobar f WHERE f.foo = :foo AND f.bar IN (:bar)'
,
'SELECT * FROM ddc1372_foobar f WHERE f.foo = :foo AND f.bar IN (:bar)'
,
array
(
'foo'
=>
1
,
'bar'
=>
array
(
1
,
2
,
3
)),
array
(
'foo'
=>
1
,
'bar'
=>
array
(
1
,
2
,
3
)),
...
@@ -38,7 +38,7 @@ class NamedParametersTest extends \Doctrine\Tests\DbalFunctionalTestCase
...
@@ -38,7 +38,7 @@ class NamedParametersTest extends \Doctrine\Tests\DbalFunctionalTestCase
array
(
'id'
=>
3
,
'foo'
=>
1
,
'bar'
=>
3
),
array
(
'id'
=>
3
,
'foo'
=>
1
,
'bar'
=>
3
),
)
)
),
),
array
(
array
(
'SELECT * FROM ddc1372_foobar f WHERE f.bar IN (:bar) AND f.foo = :foo'
,
'SELECT * FROM ddc1372_foobar f WHERE f.bar IN (:bar) AND f.foo = :foo'
,
array
(
'foo'
=>
1
,
'bar'
=>
array
(
1
,
2
,
3
)),
array
(
'foo'
=>
1
,
'bar'
=>
array
(
1
,
2
,
3
)),
...
@@ -49,7 +49,7 @@ class NamedParametersTest extends \Doctrine\Tests\DbalFunctionalTestCase
...
@@ -49,7 +49,7 @@ class NamedParametersTest extends \Doctrine\Tests\DbalFunctionalTestCase
array
(
'id'
=>
3
,
'foo'
=>
1
,
'bar'
=>
3
),
array
(
'id'
=>
3
,
'foo'
=>
1
,
'bar'
=>
3
),
)
)
),
),
array
(
array
(
'SELECT * FROM ddc1372_foobar f WHERE f.bar IN (:bar) AND f.foo = :foo'
,
'SELECT * FROM ddc1372_foobar f WHERE f.bar IN (:bar) AND f.foo = :foo'
,
array
(
'foo'
=>
1
,
'bar'
=>
array
(
'1'
,
'2'
,
'3'
)),
array
(
'foo'
=>
1
,
'bar'
=>
array
(
'1'
,
'2'
,
'3'
)),
...
@@ -60,7 +60,7 @@ class NamedParametersTest extends \Doctrine\Tests\DbalFunctionalTestCase
...
@@ -60,7 +60,7 @@ class NamedParametersTest extends \Doctrine\Tests\DbalFunctionalTestCase
array
(
'id'
=>
3
,
'foo'
=>
1
,
'bar'
=>
3
),
array
(
'id'
=>
3
,
'foo'
=>
1
,
'bar'
=>
3
),
)
)
),
),
array
(
array
(
'SELECT * FROM ddc1372_foobar f WHERE f.bar IN (:bar) AND f.foo IN (:foo)'
,
'SELECT * FROM ddc1372_foobar f WHERE f.bar IN (:bar) AND f.foo IN (:foo)'
,
array
(
'foo'
=>
array
(
'1'
),
'bar'
=>
array
(
1
,
2
,
3
,
4
)),
array
(
'foo'
=>
array
(
'1'
),
'bar'
=>
array
(
1
,
2
,
3
,
4
)),
...
@@ -72,7 +72,7 @@ class NamedParametersTest extends \Doctrine\Tests\DbalFunctionalTestCase
...
@@ -72,7 +72,7 @@ class NamedParametersTest extends \Doctrine\Tests\DbalFunctionalTestCase
array
(
'id'
=>
4
,
'foo'
=>
1
,
'bar'
=>
4
),
array
(
'id'
=>
4
,
'foo'
=>
1
,
'bar'
=>
4
),
)
)
),
),
array
(
array
(
'SELECT * FROM ddc1372_foobar f WHERE f.bar IN (:bar) AND f.foo IN (:foo)'
,
'SELECT * FROM ddc1372_foobar f WHERE f.bar IN (:bar) AND f.foo IN (:foo)'
,
array
(
'foo'
=>
1
,
'bar'
=>
2
),
array
(
'foo'
=>
1
,
'bar'
=>
2
),
...
@@ -81,7 +81,7 @@ class NamedParametersTest extends \Doctrine\Tests\DbalFunctionalTestCase
...
@@ -81,7 +81,7 @@ class NamedParametersTest extends \Doctrine\Tests\DbalFunctionalTestCase
array
(
'id'
=>
2
,
'foo'
=>
1
,
'bar'
=>
2
),
array
(
'id'
=>
2
,
'foo'
=>
1
,
'bar'
=>
2
),
)
)
),
),
array
(
array
(
'SELECT * FROM ddc1372_foobar f WHERE f.bar = :arg AND f.foo <> :arg'
,
'SELECT * FROM ddc1372_foobar f WHERE f.bar = :arg AND f.foo <> :arg'
,
array
(
'arg'
=>
'1'
),
array
(
'arg'
=>
'1'
),
...
@@ -90,7 +90,7 @@ class NamedParametersTest extends \Doctrine\Tests\DbalFunctionalTestCase
...
@@ -90,7 +90,7 @@ class NamedParametersTest extends \Doctrine\Tests\DbalFunctionalTestCase
array
(
'id'
=>
5
,
'foo'
=>
2
,
'bar'
=>
1
),
array
(
'id'
=>
5
,
'foo'
=>
2
,
'bar'
=>
1
),
)
)
),
),
array
(
array
(
'SELECT * FROM ddc1372_foobar f WHERE f.bar NOT IN (:arg) AND f.foo IN (:arg)'
,
'SELECT * FROM ddc1372_foobar f WHERE f.bar NOT IN (:arg) AND f.foo IN (:arg)'
,
array
(
'arg'
=>
array
(
1
,
2
)),
array
(
'arg'
=>
array
(
1
,
2
)),
...
@@ -100,10 +100,10 @@ class NamedParametersTest extends \Doctrine\Tests\DbalFunctionalTestCase
...
@@ -100,10 +100,10 @@ class NamedParametersTest extends \Doctrine\Tests\DbalFunctionalTestCase
array
(
'id'
=>
4
,
'foo'
=>
1
,
'bar'
=>
4
),
array
(
'id'
=>
4
,
'foo'
=>
1
,
'bar'
=>
4
),
)
)
),
),
);
);
}
}
public
function
setUp
()
public
function
setUp
()
{
{
parent
::
setUp
();
parent
::
setUp
();
...
@@ -114,6 +114,7 @@ class NamedParametersTest extends \Doctrine\Tests\DbalFunctionalTestCase
...
@@ -114,6 +114,7 @@ class NamedParametersTest extends \Doctrine\Tests\DbalFunctionalTestCase
$table
->
addColumn
(
'id'
,
'integer'
);
$table
->
addColumn
(
'id'
,
'integer'
);
$table
->
addColumn
(
'foo'
,
'string'
);
$table
->
addColumn
(
'foo'
,
'string'
);
$table
->
addColumn
(
'bar'
,
'string'
);
$table
->
addColumn
(
'bar'
,
'string'
);
$table
->
setPrimaryKey
(
array
(
'id'
));
$sm
=
$this
->
_conn
->
getSchemaManager
();
$sm
=
$this
->
_conn
->
getSchemaManager
();
...
@@ -148,7 +149,7 @@ class NamedParametersTest extends \Doctrine\Tests\DbalFunctionalTestCase
...
@@ -148,7 +149,7 @@ class NamedParametersTest extends \Doctrine\Tests\DbalFunctionalTestCase
* @param string $query
* @param string $query
* @param array $params
* @param array $params
* @param array $types
* @param array $types
* @param array $expected
* @param array $expected
*/
*/
public
function
testTicket
(
$query
,
$params
,
$types
,
$expected
)
public
function
testTicket
(
$query
,
$params
,
$types
,
$expected
)
{
{
...
...
tests/Doctrine/Tests/DBAL/Functional/PortabilityTest.php
View file @
b8896c4f
...
@@ -15,16 +15,16 @@ require_once __DIR__ . '/../../TestInit.php';
...
@@ -15,16 +15,16 @@ require_once __DIR__ . '/../../TestInit.php';
class
PortabilityTest
extends
\Doctrine\Tests\DbalFunctionalTestCase
class
PortabilityTest
extends
\Doctrine\Tests\DbalFunctionalTestCase
{
{
static
private
$hasTable
=
false
;
static
private
$hasTable
=
false
;
private
$portableConnection
;
private
$portableConnection
;
public
function
tearDown
()
public
function
tearDown
()
{
{
if
(
$this
->
portableConnection
)
{
if
(
$this
->
portableConnection
)
{
$this
->
portableConnection
->
close
();
$this
->
portableConnection
->
close
();
}
}
}
}
private
function
getPortableConnection
(
$portabilityMode
=
\Doctrine\DBAL\Portability\Connection
::
PORTABILITY_ALL
,
$case
=
\PDO
::
CASE_LOWER
)
private
function
getPortableConnection
(
$portabilityMode
=
\Doctrine\DBAL\Portability\Connection
::
PORTABILITY_ALL
,
$case
=
\PDO
::
CASE_LOWER
)
{
{
if
(
!
$this
->
portableConnection
)
{
if
(
!
$this
->
portableConnection
)
{
...
@@ -40,38 +40,39 @@ class PortabilityTest extends \Doctrine\Tests\DbalFunctionalTestCase
...
@@ -40,38 +40,39 @@ class PortabilityTest extends \Doctrine\Tests\DbalFunctionalTestCase
$table
->
addColumn
(
'Test_Int'
,
'integer'
);
$table
->
addColumn
(
'Test_Int'
,
'integer'
);
$table
->
addColumn
(
'Test_String'
,
'string'
,
array
(
'fixed'
=>
true
,
'length'
=>
32
));
$table
->
addColumn
(
'Test_String'
,
'string'
,
array
(
'fixed'
=>
true
,
'length'
=>
32
));
$table
->
addColumn
(
'Test_Null'
,
'string'
,
array
(
'notnull'
=>
false
));
$table
->
addColumn
(
'Test_Null'
,
'string'
,
array
(
'notnull'
=>
false
));
$table
->
setPrimaryKey
(
array
(
'Test_Int'
));
$sm
=
$this
->
portableConnection
->
getSchemaManager
();
$sm
=
$this
->
portableConnection
->
getSchemaManager
();
$sm
->
createTable
(
$table
);
$sm
->
createTable
(
$table
);
$this
->
portableConnection
->
insert
(
'portability_table'
,
array
(
'Test_Int'
=>
1
,
'Test_String'
=>
'foo'
,
'Test_Null'
=>
''
));
$this
->
portableConnection
->
insert
(
'portability_table'
,
array
(
'Test_Int'
=>
1
,
'Test_String'
=>
'foo'
,
'Test_Null'
=>
''
));
$this
->
portableConnection
->
insert
(
'portability_table'
,
array
(
'Test_Int'
=>
1
,
'Test_String'
=>
'foo '
,
'Test_Null'
=>
null
));
$this
->
portableConnection
->
insert
(
'portability_table'
,
array
(
'Test_Int'
=>
2
,
'Test_String'
=>
'foo '
,
'Test_Null'
=>
null
));
}
catch
(
\Exception
$e
)
{
}
catch
(
\Exception
$e
)
{
}
}
}
}
return
$this
->
portableConnection
;
return
$this
->
portableConnection
;
}
}
public
function
testFullFetchMode
()
public
function
testFullFetchMode
()
{
{
$rows
=
$this
->
getPortableConnection
()
->
fetchAll
(
'SELECT * FROM portability_table'
);
$rows
=
$this
->
getPortableConnection
()
->
fetchAll
(
'SELECT * FROM portability_table'
);
$this
->
assertFetchResultRows
(
$rows
);
$this
->
assertFetchResultRows
(
$rows
);
$stmt
=
$this
->
getPortableConnection
()
->
query
(
'SELECT * FROM portability_table'
);
$stmt
=
$this
->
getPortableConnection
()
->
query
(
'SELECT * FROM portability_table'
);
while
(
$row
=
$stmt
->
fetch
(
\PDO
::
FETCH_ASSOC
))
{
while
(
$row
=
$stmt
->
fetch
(
\PDO
::
FETCH_ASSOC
))
{
$this
->
assertFetchResultRow
(
$row
);
$this
->
assertFetchResultRow
(
$row
);
}
}
$stmt
=
$this
->
getPortableConnection
()
->
prepare
(
'SELECT * FROM portability_table'
);
$stmt
=
$this
->
getPortableConnection
()
->
prepare
(
'SELECT * FROM portability_table'
);
$stmt
->
execute
();
$stmt
->
execute
();
while
(
$row
=
$stmt
->
fetch
(
\PDO
::
FETCH_ASSOC
))
{
while
(
$row
=
$stmt
->
fetch
(
\PDO
::
FETCH_ASSOC
))
{
$this
->
assertFetchResultRow
(
$row
);
$this
->
assertFetchResultRow
(
$row
);
}
}
}
}
public
function
assertFetchResultRows
(
$rows
)
public
function
assertFetchResultRows
(
$rows
)
{
{
$this
->
assertEquals
(
2
,
count
(
$rows
));
$this
->
assertEquals
(
2
,
count
(
$rows
));
...
@@ -79,10 +80,10 @@ class PortabilityTest extends \Doctrine\Tests\DbalFunctionalTestCase
...
@@ -79,10 +80,10 @@ class PortabilityTest extends \Doctrine\Tests\DbalFunctionalTestCase
$this
->
assertFetchResultRow
(
$row
);
$this
->
assertFetchResultRow
(
$row
);
}
}
}
}
public
function
assertFetchResultRow
(
$row
)
public
function
assertFetchResultRow
(
$row
)
{
{
$this
->
assert
Equals
(
1
,
$row
[
'test_int'
]
);
$this
->
assert
True
(
in_array
(
$row
[
'test_int'
],
array
(
1
,
2
)),
"Primary key test_int should either be 1 or 2."
);
$this
->
assertArrayHasKey
(
'test_string'
,
$row
,
"Case should be lowered."
);
$this
->
assertArrayHasKey
(
'test_string'
,
$row
,
"Case should be lowered."
);
$this
->
assertEquals
(
3
,
strlen
(
$row
[
'test_string'
]),
"test_string should be rtrimed to length of three for CHAR(32) column."
);
$this
->
assertEquals
(
3
,
strlen
(
$row
[
'test_string'
]),
"test_string should be rtrimed to length of three for CHAR(32) column."
);
$this
->
assertNull
(
$row
[
'test_null'
]);
$this
->
assertNull
(
$row
[
'test_null'
]);
...
...
tests/Doctrine/Tests/DBAL/Functional/ResultCacheTest.php
View file @
b8896c4f
...
@@ -24,6 +24,7 @@ class ResultCacheTest extends \Doctrine\Tests\DbalFunctionalTestCase
...
@@ -24,6 +24,7 @@ class ResultCacheTest extends \Doctrine\Tests\DbalFunctionalTestCase
$table
=
new
\Doctrine\DBAL\Schema\Table
(
"caching"
);
$table
=
new
\Doctrine\DBAL\Schema\Table
(
"caching"
);
$table
->
addColumn
(
'test_int'
,
'integer'
);
$table
->
addColumn
(
'test_int'
,
'integer'
);
$table
->
addColumn
(
'test_string'
,
'string'
,
array
(
'notnull'
=>
false
));
$table
->
addColumn
(
'test_string'
,
'string'
,
array
(
'notnull'
=>
false
));
$table
->
setPrimaryKey
(
array
(
'test_int'
));
$sm
=
$this
->
_conn
->
getSchemaManager
();
$sm
=
$this
->
_conn
->
getSchemaManager
();
$sm
->
createTable
(
$table
);
$sm
->
createTable
(
$table
);
...
...
tests/Doctrine/Tests/DBAL/Functional/TemporaryTableTest.php
View file @
b8896c4f
...
@@ -33,6 +33,7 @@ class TemporaryTableTest extends \Doctrine\Tests\DbalFunctionalTestCase
...
@@ -33,6 +33,7 @@ class TemporaryTableTest extends \Doctrine\Tests\DbalFunctionalTestCase
$table
=
new
Table
(
"non_temporary"
);
$table
=
new
Table
(
"non_temporary"
);
$table
->
addColumn
(
"id"
,
"integer"
);
$table
->
addColumn
(
"id"
,
"integer"
);
$table
->
setPrimaryKey
(
array
(
'id'
));
$this
->
_conn
->
getSchemaManager
()
->
createTable
(
$table
);
$this
->
_conn
->
getSchemaManager
()
->
createTable
(
$table
);
$this
->
_conn
->
beginTransaction
();
$this
->
_conn
->
beginTransaction
();
...
@@ -64,6 +65,7 @@ class TemporaryTableTest extends \Doctrine\Tests\DbalFunctionalTestCase
...
@@ -64,6 +65,7 @@ class TemporaryTableTest extends \Doctrine\Tests\DbalFunctionalTestCase
$table
=
new
Table
(
"non_temporary"
);
$table
=
new
Table
(
"non_temporary"
);
$table
->
addColumn
(
"id"
,
"integer"
);
$table
->
addColumn
(
"id"
,
"integer"
);
$table
->
setPrimaryKey
(
array
(
'id'
));
$this
->
_conn
->
getSchemaManager
()
->
createTable
(
$table
);
$this
->
_conn
->
getSchemaManager
()
->
createTable
(
$table
);
$this
->
_conn
->
beginTransaction
();
$this
->
_conn
->
beginTransaction
();
...
@@ -77,7 +79,7 @@ class TemporaryTableTest extends \Doctrine\Tests\DbalFunctionalTestCase
...
@@ -77,7 +79,7 @@ class TemporaryTableTest extends \Doctrine\Tests\DbalFunctionalTestCase
try
{
try
{
$this
->
_conn
->
exec
(
$platform
->
getDropTemporaryTableSQL
(
$tempTable
));
$this
->
_conn
->
exec
(
$platform
->
getDropTemporaryTableSQL
(
$tempTable
));
}
catch
(
\Exception
$e
)
{
}
catch
(
\Exception
$e
)
{
}
}
$rows
=
$this
->
_conn
->
fetchAll
(
'SELECT * FROM non_temporary'
);
$rows
=
$this
->
_conn
->
fetchAll
(
'SELECT * FROM non_temporary'
);
...
...
tests/Doctrine/Tests/DBAL/Types/DateTimeTest.php
View file @
b8896c4f
...
@@ -6,7 +6,7 @@ use Doctrine\DBAL\Types\Type;
...
@@ -6,7 +6,7 @@ use Doctrine\DBAL\Types\Type;
use
Doctrine\Tests\DBAL\Mocks
;
use
Doctrine\Tests\DBAL\Mocks
;
require_once
__DIR__
.
'/../../TestInit.php'
;
require_once
__DIR__
.
'/../../TestInit.php'
;
class
DateTimeTest
extends
\Doctrine\Tests\DbalTestCase
class
DateTimeTest
extends
\Doctrine\Tests\DbalTestCase
{
{
protected
protected
...
@@ -24,7 +24,7 @@ class DateTimeTest extends \Doctrine\Tests\DbalTestCase
...
@@ -24,7 +24,7 @@ class DateTimeTest extends \Doctrine\Tests\DbalTestCase
$date
=
new
\DateTime
(
'1985-09-01 10:10:10'
);
$date
=
new
\DateTime
(
'1985-09-01 10:10:10'
);
$expected
=
$date
->
format
(
$this
->
_platform
->
getDateTimeTzFormatString
());
$expected
=
$date
->
format
(
$this
->
_platform
->
getDateTimeTzFormatString
());
$actual
=
is_string
(
$this
->
_type
->
convertToDatabaseValue
(
$date
,
$this
->
_platform
)
);
$actual
=
$this
->
_type
->
convertToDatabaseValue
(
$date
,
$this
->
_platform
);
$this
->
assertEquals
(
$expected
,
$actual
);
$this
->
assertEquals
(
$expected
,
$actual
);
}
}
...
...
tests/Doctrine/Tests/DBAL/Types/DateTimeTzTest.php
View file @
b8896c4f
...
@@ -24,7 +24,7 @@ class DateTimeTzTest extends \Doctrine\Tests\DbalTestCase
...
@@ -24,7 +24,7 @@ class DateTimeTzTest extends \Doctrine\Tests\DbalTestCase
$date
=
new
\DateTime
(
'1985-09-01 10:10:10'
);
$date
=
new
\DateTime
(
'1985-09-01 10:10:10'
);
$expected
=
$date
->
format
(
$this
->
_platform
->
getDateTimeTzFormatString
());
$expected
=
$date
->
format
(
$this
->
_platform
->
getDateTimeTzFormatString
());
$actual
=
is_string
(
$this
->
_type
->
convertToDatabaseValue
(
$date
,
$this
->
_platform
)
);
$actual
=
$this
->
_type
->
convertToDatabaseValue
(
$date
,
$this
->
_platform
);
$this
->
assertEquals
(
$expected
,
$actual
);
$this
->
assertEquals
(
$expected
,
$actual
);
}
}
...
@@ -36,7 +36,7 @@ class DateTimeTzTest extends \Doctrine\Tests\DbalTestCase
...
@@ -36,7 +36,7 @@ class DateTimeTzTest extends \Doctrine\Tests\DbalTestCase
$this
->
assertInstanceOf
(
'DateTime'
,
$date
);
$this
->
assertInstanceOf
(
'DateTime'
,
$date
);
$this
->
assertEquals
(
'1985-09-01 00:00:00'
,
$date
->
format
(
'Y-m-d H:i:s'
));
$this
->
assertEquals
(
'1985-09-01 00:00:00'
,
$date
->
format
(
'Y-m-d H:i:s'
));
}
}
public
function
testInvalidDateFormatConversion
()
public
function
testInvalidDateFormatConversion
()
{
{
$this
->
setExpectedException
(
'Doctrine\DBAL\Types\ConversionException'
);
$this
->
setExpectedException
(
'Doctrine\DBAL\Types\ConversionException'
);
...
...
tests/Doctrine/Tests/DBAL/Types/VarDateTimeTest.php
View file @
b8896c4f
...
@@ -27,7 +27,7 @@ class VarDateTimeTest extends \Doctrine\Tests\DbalTestCase
...
@@ -27,7 +27,7 @@ class VarDateTimeTest extends \Doctrine\Tests\DbalTestCase
$date
=
new
\DateTime
(
'1985-09-01 10:10:10'
);
$date
=
new
\DateTime
(
'1985-09-01 10:10:10'
);
$expected
=
$date
->
format
(
$this
->
_platform
->
getDateTimeTzFormatString
());
$expected
=
$date
->
format
(
$this
->
_platform
->
getDateTimeTzFormatString
());
$actual
=
is_string
(
$this
->
_type
->
convertToDatabaseValue
(
$date
,
$this
->
_platform
)
);
$actual
=
$this
->
_type
->
convertToDatabaseValue
(
$date
,
$this
->
_platform
);
$this
->
assertEquals
(
$expected
,
$actual
);
$this
->
assertEquals
(
$expected
,
$actual
);
}
}
...
...
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