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
Show 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,6 +20,7 @@ class DataAccessTest extends \Doctrine\Tests\DbalFunctionalTestCase
...
@@ -20,6 +20,7 @@ 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
);
...
@@ -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,6 +147,8 @@ class DataAccessTest extends \Doctrine\Tests\DbalFunctionalTestCase
...
@@ -145,6 +147,8 @@ 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'
]);
...
@@ -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
)
);
);
...
...
tests/Doctrine/Tests/DBAL/Functional/NamedParametersTest.php
View file @
b8896c4f
...
@@ -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
();
...
...
tests/Doctrine/Tests/DBAL/Functional/PortabilityTest.php
View file @
b8896c4f
...
@@ -40,12 +40,13 @@ class PortabilityTest extends \Doctrine\Tests\DbalFunctionalTestCase
...
@@ -40,12 +40,13 @@ 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
)
{
}
}
...
@@ -82,7 +83,7 @@ class PortabilityTest extends \Doctrine\Tests\DbalFunctionalTestCase
...
@@ -82,7 +83,7 @@ class PortabilityTest extends \Doctrine\Tests\DbalFunctionalTestCase
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
();
...
...
tests/Doctrine/Tests/DBAL/Types/DateTimeTest.php
View file @
b8896c4f
...
@@ -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
);
}
}
...
...
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