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
2179996d
Unverified
Commit
2179996d
authored
Dec 01, 2018
by
Sergei Morozov
Committed by
GitHub
Dec 01, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3339 from morozov/issues/3294
ContinuousPHP configuration for PDO Oracle driver
parents
0b0015e6
b1afc40d
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
164 additions
and
22 deletions
+164
-22
.gitignore
.gitignore
+1
-1
.scrutinizer.yml
.scrutinizer.yml
+1
-1
PDOConnection.php
lib/Doctrine/DBAL/Driver/PDOConnection.php
+5
-1
BlobTest.php
tests/Doctrine/Tests/DBAL/Functional/BlobTest.php
+7
-0
DataAccessTest.php
tests/Doctrine/Tests/DBAL/Functional/DataAccessTest.php
+20
-7
PDOStatementTest.php
tests/Doctrine/Tests/DBAL/Functional/PDOStatementTest.php
+1
-1
OracleSchemaManagerTest.php
.../Tests/DBAL/Functional/Schema/OracleSchemaManagerTest.php
+11
-6
StatementTest.php
tests/Doctrine/Tests/DBAL/Functional/StatementTest.php
+19
-0
TypeConversionTest.php
tests/Doctrine/Tests/DBAL/Functional/TypeConversionTest.php
+7
-0
BinaryTest.php
tests/Doctrine/Tests/DBAL/Functional/Types/BinaryTest.php
+5
-0
WriteTest.php
tests/Doctrine/Tests/DBAL/Functional/WriteTest.php
+27
-5
bootstrap.php
tests/continuousphp/bootstrap.php
+11
-0
install-pdo-oci.sh
tests/continuousphp/install-pdo-oci.sh
+5
-0
pdo-oci.phpunit.xml
tests/continuousphp/pdo-oci.phpunit.xml
+44
-0
No files found.
.gitignore
View file @
2179996d
...
@@ -4,7 +4,7 @@ reports/
...
@@ -4,7 +4,7 @@ reports/
dist/
dist/
download/
download/
vendor/
vendor/
*.phpunit.xml
/
*.phpunit.xml
/phpunit.xml
/phpunit.xml
/.phpcs-cache
/.phpcs-cache
/phpstan.neon
/phpstan.neon
.scrutinizer.yml
View file @
2179996d
...
@@ -21,7 +21,7 @@ before_commands:
...
@@ -21,7 +21,7 @@ before_commands:
tools
:
tools
:
external_code_coverage
:
external_code_coverage
:
timeout
:
3600
timeout
:
3600
runs
:
2
7
# 23x Travis (jobs with COVERAGE=yes) + 3x AppVeyor (jobs with coverage=yes) + 1
x ContinuousPHP
runs
:
2
8
# 23x Travis (jobs with COVERAGE=yes) + 3x AppVeyor (jobs with coverage=yes) + 2
x ContinuousPHP
filter
:
filter
:
excluded_paths
:
excluded_paths
:
...
...
lib/Doctrine/DBAL/Driver/PDOConnection.php
View file @
2179996d
...
@@ -104,7 +104,11 @@ class PDOConnection extends PDO implements Connection, ServerInfoAwareConnection
...
@@ -104,7 +104,11 @@ class PDOConnection extends PDO implements Connection, ServerInfoAwareConnection
*/
*/
public
function
lastInsertId
(
$name
=
null
)
public
function
lastInsertId
(
$name
=
null
)
{
{
return
parent
::
lastInsertId
(
$name
);
try
{
return
parent
::
lastInsertId
(
$name
);
}
catch
(
\PDOException
$exception
)
{
throw
new
PDOException
(
$exception
);
}
}
}
/**
/**
...
...
tests/Doctrine/Tests/DBAL/Functional/BlobTest.php
View file @
2179996d
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
namespace
Doctrine\Tests\DBAL\Functional
;
namespace
Doctrine\Tests\DBAL\Functional
;
use
Doctrine\DBAL\Driver\OCI8\Driver
as
OCI8Driver
;
use
Doctrine\DBAL\Driver\OCI8\Driver
as
OCI8Driver
;
use
Doctrine\DBAL\Driver\PDOOracle\Driver
as
PDOOracleDriver
;
use
Doctrine\DBAL\FetchMode
;
use
Doctrine\DBAL\FetchMode
;
use
Doctrine\DBAL\ParameterType
;
use
Doctrine\DBAL\ParameterType
;
use
Doctrine\DBAL\Schema\Table
;
use
Doctrine\DBAL\Schema\Table
;
...
@@ -21,6 +22,12 @@ class BlobTest extends DbalFunctionalTestCase
...
@@ -21,6 +22,12 @@ class BlobTest extends DbalFunctionalTestCase
{
{
parent
::
setUp
();
parent
::
setUp
();
if
(
$this
->
connection
->
getDriver
()
instanceof
PDOOracleDriver
)
{
// inserting BLOBs as streams on Oracle requires Oracle-specific SQL syntax which is currently not supported
// see http://php.net/manual/en/pdo.lobs.php#example-1035
$this
->
markTestSkipped
(
'DBAL doesn\'t support storing LOBs represented as streams using PDO_OCI'
);
}
$table
=
new
Table
(
'blob_table'
);
$table
=
new
Table
(
'blob_table'
);
$table
->
addColumn
(
'id'
,
'integer'
);
$table
->
addColumn
(
'id'
,
'integer'
);
$table
->
addColumn
(
'clobfield'
,
'text'
);
$table
->
addColumn
(
'clobfield'
,
'text'
);
...
...
tests/Doctrine/Tests/DBAL/Functional/DataAccessTest.php
View file @
2179996d
...
@@ -5,6 +5,9 @@ namespace Doctrine\Tests\DBAL\Functional;
...
@@ -5,6 +5,9 @@ namespace Doctrine\Tests\DBAL\Functional;
use
DateTime
;
use
DateTime
;
use
Doctrine\DBAL\Connection
;
use
Doctrine\DBAL\Connection
;
use
Doctrine\DBAL\Driver\Mysqli\Driver
as
MySQLiDriver
;
use
Doctrine\DBAL\Driver\Mysqli\Driver
as
MySQLiDriver
;
use
Doctrine\DBAL\Driver\OCI8\Driver
as
Oci8Driver
;
use
Doctrine\DBAL\Driver\PDOConnection
;
use
Doctrine\DBAL\Driver\PDOOracle\Driver
as
PDOOracleDriver
;
use
Doctrine\DBAL\Driver\SQLSrv\Driver
as
SQLSrvDriver
;
use
Doctrine\DBAL\Driver\SQLSrv\Driver
as
SQLSrvDriver
;
use
Doctrine\DBAL\FetchMode
;
use
Doctrine\DBAL\FetchMode
;
use
Doctrine\DBAL\ParameterType
;
use
Doctrine\DBAL\ParameterType
;
...
@@ -14,6 +17,7 @@ use Doctrine\DBAL\Schema\Table;
...
@@ -14,6 +17,7 @@ use Doctrine\DBAL\Schema\Table;
use
Doctrine\DBAL\Statement
;
use
Doctrine\DBAL\Statement
;
use
Doctrine\DBAL\Types\Type
;
use
Doctrine\DBAL\Types\Type
;
use
Doctrine\Tests\DbalFunctionalTestCase
;
use
Doctrine\Tests\DbalFunctionalTestCase
;
use
PDO
;
use
const
CASE_LOWER
;
use
const
CASE_LOWER
;
use
const
PHP_EOL
;
use
const
PHP_EOL
;
use
function
array_change_key_case
;
use
function
array_change_key_case
;
...
@@ -749,7 +753,7 @@ class DataAccessTest extends DbalFunctionalTestCase
...
@@ -749,7 +753,7 @@ class DataAccessTest extends DbalFunctionalTestCase
*/
*/
public
function
testFetchAllSupportFetchClass
()
public
function
testFetchAllSupportFetchClass
()
{
{
$this
->
skipOci8AndMysqli
();
$this
->
beforeFetchClassTest
();
$this
->
setupFixture
();
$this
->
setupFixture
();
$sql
=
'SELECT test_int, test_string, test_datetime FROM fetch_table'
;
$sql
=
'SELECT test_int, test_string, test_datetime FROM fetch_table'
;
...
@@ -791,7 +795,7 @@ class DataAccessTest extends DbalFunctionalTestCase
...
@@ -791,7 +795,7 @@ class DataAccessTest extends DbalFunctionalTestCase
*/
*/
public
function
testSetFetchModeClassFetchAll
()
public
function
testSetFetchModeClassFetchAll
()
{
{
$this
->
skipOci8AndMysqli
();
$this
->
beforeFetchClassTest
();
$this
->
setupFixture
();
$this
->
setupFixture
();
$sql
=
'SELECT * FROM fetch_table'
;
$sql
=
'SELECT * FROM fetch_table'
;
...
@@ -813,7 +817,7 @@ class DataAccessTest extends DbalFunctionalTestCase
...
@@ -813,7 +817,7 @@ class DataAccessTest extends DbalFunctionalTestCase
*/
*/
public
function
testSetFetchModeClassFetch
()
public
function
testSetFetchModeClassFetch
()
{
{
$this
->
skipOci8AndMysqli
();
$this
->
beforeFetchClassTest
();
$this
->
setupFixture
();
$this
->
setupFixture
();
$sql
=
'SELECT * FROM fetch_table'
;
$sql
=
'SELECT * FROM fetch_table'
;
...
@@ -908,16 +912,25 @@ class DataAccessTest extends DbalFunctionalTestCase
...
@@ -908,16 +912,25 @@ class DataAccessTest extends DbalFunctionalTestCase
]);
]);
}
}
private
function
skipOci8AndMysqli
()
private
function
beforeFetchClassTest
()
{
{
if
(
isset
(
$GLOBALS
[
'db_type'
])
&&
$GLOBALS
[
'db_type'
]
===
'oci8'
)
{
$driver
=
$this
->
connection
->
getDriver
();
if
(
$driver
instanceof
Oci8Driver
)
{
$this
->
markTestSkipped
(
'Not supported by OCI8'
);
$this
->
markTestSkipped
(
'Not supported by OCI8'
);
}
}
if
(
$this
->
connection
->
getDriver
()
->
getName
()
!==
'mysqli'
)
{
if
(
$driver
instanceof
MySQLiDriver
)
{
$this
->
markTestSkipped
(
'Mysqli driver dont support this feature.'
);
}
if
(
!
$driver
instanceof
PDOOracleDriver
)
{
return
;
return
;
}
}
$this
->
markTestSkipped
(
'Mysqli driver dont support this feature.'
);
/** @var PDOConnection $connection */
$connection
=
$this
->
connection
->
getWrappedConnection
();
$connection
->
setAttribute
(
PDO
::
ATTR_CASE
,
PDO
::
CASE_LOWER
);
}
}
}
}
...
...
tests/Doctrine/Tests/DBAL/Functional/PDOStatementTest.php
View file @
2179996d
...
@@ -24,7 +24,7 @@ class PDOStatementTest extends DbalFunctionalTestCase
...
@@ -24,7 +24,7 @@ class PDOStatementTest extends DbalFunctionalTestCase
$table
=
new
Table
(
'stmt_test'
);
$table
=
new
Table
(
'stmt_test'
);
$table
->
addColumn
(
'id'
,
'integer'
);
$table
->
addColumn
(
'id'
,
'integer'
);
$table
->
addColumn
(
'name'
,
'
text
'
);
$table
->
addColumn
(
'name'
,
'
string
'
);
$this
->
connection
->
getSchemaManager
()
->
dropAndCreateTable
(
$table
);
$this
->
connection
->
getSchemaManager
()
->
dropAndCreateTable
(
$table
);
}
}
...
...
tests/Doctrine/Tests/DBAL/Functional/Schema/OracleSchemaManagerTest.php
View file @
2179996d
...
@@ -11,20 +11,25 @@ use function array_map;
...
@@ -11,20 +11,25 @@ use function array_map;
class
OracleSchemaManagerTest
extends
SchemaManagerFunctionalTestCase
class
OracleSchemaManagerTest
extends
SchemaManagerFunctionalTestCase
{
{
/** @var bool */
private
static
$privilegesGranted
=
false
;
protected
function
setUp
()
protected
function
setUp
()
{
{
parent
::
setUp
();
parent
::
setUp
();
if
(
!
isset
(
$GLOBALS
[
'db_username'
])
)
{
if
(
self
::
$privilegesGranted
)
{
$this
->
markTestSkipped
(
'Foo'
)
;
return
;
}
}
$username
=
$GLOBALS
[
'db_username'
];
if
(
!
isset
(
$GLOBALS
[
'db_username'
]))
{
self
::
markTestSkipped
(
'Username must be explicitly specified in connection parameters for this test'
);
}
$query
=
'GRANT ALL PRIVILEGES TO '
.
$username
;
TestUtil
::
getTempConnection
()
->
exec
(
'GRANT ALL PRIVILEGES TO '
.
$GLOBALS
[
'db_username'
]);
$conn
=
TestUtil
::
getTempConnection
();
self
::
$privilegesGranted
=
true
;
$conn
->
executeUpdate
(
$query
);
}
}
public
function
testRenameTable
()
public
function
testRenameTable
()
...
...
tests/Doctrine/Tests/DBAL/Functional/StatementTest.php
View file @
2179996d
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
namespace
Doctrine\Tests\DBAL\Functional
;
namespace
Doctrine\Tests\DBAL\Functional
;
use
Doctrine\DBAL\Driver\PDOOracle\Driver
as
PDOOracleDriver
;
use
Doctrine\DBAL\Driver\Statement
;
use
Doctrine\DBAL\Driver\Statement
;
use
Doctrine\DBAL\FetchMode
;
use
Doctrine\DBAL\FetchMode
;
use
Doctrine\DBAL\ParameterType
;
use
Doctrine\DBAL\ParameterType
;
...
@@ -25,6 +26,10 @@ class StatementTest extends DbalFunctionalTestCase
...
@@ -25,6 +26,10 @@ class StatementTest extends DbalFunctionalTestCase
public
function
testStatementIsReusableAfterClosingCursor
()
public
function
testStatementIsReusableAfterClosingCursor
()
{
{
if
(
$this
->
connection
->
getDriver
()
instanceof
PDOOracleDriver
)
{
$this
->
markTestIncomplete
(
'See https://bugs.php.net/bug.php?id=77181'
);
}
$this
->
connection
->
insert
(
'stmt_test'
,
[
'id'
=>
1
]);
$this
->
connection
->
insert
(
'stmt_test'
,
[
'id'
=>
1
]);
$this
->
connection
->
insert
(
'stmt_test'
,
[
'id'
=>
2
]);
$this
->
connection
->
insert
(
'stmt_test'
,
[
'id'
=>
2
]);
...
@@ -46,6 +51,10 @@ class StatementTest extends DbalFunctionalTestCase
...
@@ -46,6 +51,10 @@ class StatementTest extends DbalFunctionalTestCase
public
function
testReuseStatementWithLongerResults
()
public
function
testReuseStatementWithLongerResults
()
{
{
if
(
$this
->
connection
->
getDriver
()
instanceof
PDOOracleDriver
)
{
$this
->
markTestIncomplete
(
'PDO_OCI doesn\'t support fetching blobs via PDOStatement::fetchAll()'
);
}
$sm
=
$this
->
connection
->
getSchemaManager
();
$sm
=
$this
->
connection
->
getSchemaManager
();
$table
=
new
Table
(
'stmt_longer_results'
);
$table
=
new
Table
(
'stmt_longer_results'
);
$table
->
addColumn
(
'param'
,
'string'
);
$table
->
addColumn
(
'param'
,
'string'
);
...
@@ -79,6 +88,12 @@ class StatementTest extends DbalFunctionalTestCase
...
@@ -79,6 +88,12 @@ class StatementTest extends DbalFunctionalTestCase
public
function
testFetchLongBlob
()
public
function
testFetchLongBlob
()
{
{
if
(
$this
->
connection
->
getDriver
()
instanceof
PDOOracleDriver
)
{
// inserting BLOBs as streams on Oracle requires Oracle-specific SQL syntax which is currently not supported
// see http://php.net/manual/en/pdo.lobs.php#example-1035
$this
->
markTestSkipped
(
'DBAL doesn\'t support storing LOBs represented as streams using PDO_OCI'
);
}
// make sure memory limit is large enough to not cause false positives,
// make sure memory limit is large enough to not cause false positives,
// but is still not enough to store a LONGBLOB of the max possible size
// but is still not enough to store a LONGBLOB of the max possible size
$this
->
iniSet
(
'memory_limit'
,
'4G'
);
$this
->
iniSet
(
'memory_limit'
,
'4G'
);
...
@@ -138,6 +153,10 @@ EOF
...
@@ -138,6 +153,10 @@ EOF
public
function
testReuseStatementAfterClosingCursor
()
public
function
testReuseStatementAfterClosingCursor
()
{
{
if
(
$this
->
connection
->
getDriver
()
instanceof
PDOOracleDriver
)
{
$this
->
markTestIncomplete
(
'See https://bugs.php.net/bug.php?id=77181'
);
}
$this
->
connection
->
insert
(
'stmt_test'
,
[
'id'
=>
1
]);
$this
->
connection
->
insert
(
'stmt_test'
,
[
'id'
=>
1
]);
$this
->
connection
->
insert
(
'stmt_test'
,
[
'id'
=>
2
]);
$this
->
connection
->
insert
(
'stmt_test'
,
[
'id'
=>
2
]);
...
...
tests/Doctrine/Tests/DBAL/Functional/TypeConversionTest.php
View file @
2179996d
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
namespace
Doctrine\Tests\DBAL\Functional
;
namespace
Doctrine\Tests\DBAL\Functional
;
use
DateTime
;
use
DateTime
;
use
Doctrine\DBAL\Driver\PDOOracle\Driver
as
PDOOracleDriver
;
use
Doctrine\DBAL\Schema\Table
;
use
Doctrine\DBAL\Schema\Table
;
use
Doctrine\DBAL\Types\Type
;
use
Doctrine\DBAL\Types\Type
;
use
Doctrine\Tests\DbalFunctionalTestCase
;
use
Doctrine\Tests\DbalFunctionalTestCase
;
...
@@ -77,6 +78,12 @@ class TypeConversionTest extends DbalFunctionalTestCase
...
@@ -77,6 +78,12 @@ class TypeConversionTest extends DbalFunctionalTestCase
*/
*/
public
function
testIdempotentDataConversion
(
$type
,
$originalValue
,
$expectedPhpType
)
public
function
testIdempotentDataConversion
(
$type
,
$originalValue
,
$expectedPhpType
)
{
{
if
(
$type
===
'text'
&&
$this
->
connection
->
getDriver
()
instanceof
PDOOracleDriver
)
{
// inserting BLOBs as streams on Oracle requires Oracle-specific SQL syntax which is currently not supported
// see http://php.net/manual/en/pdo.lobs.php#example-1035
$this
->
markTestSkipped
(
'DBAL doesn\'t support storing LOBs represented as streams using PDO_OCI'
);
}
$columnName
=
'test_'
.
$type
;
$columnName
=
'test_'
.
$type
;
$typeInstance
=
Type
::
getType
(
$type
);
$typeInstance
=
Type
::
getType
(
$type
);
$insertionValue
=
$typeInstance
->
convertToDatabaseValue
(
$originalValue
,
$this
->
connection
->
getDatabasePlatform
());
$insertionValue
=
$typeInstance
->
convertToDatabaseValue
(
$originalValue
,
$this
->
connection
->
getDatabasePlatform
());
...
...
tests/Doctrine/Tests/DBAL/Functional/Types/BinaryTest.php
View file @
2179996d
...
@@ -5,6 +5,7 @@ declare(strict_types=1);
...
@@ -5,6 +5,7 @@ declare(strict_types=1);
namespace
Doctrine\Tests\DBAL\Functional\Types
;
namespace
Doctrine\Tests\DBAL\Functional\Types
;
use
Doctrine\DBAL\Driver\IBMDB2\DB2Driver
;
use
Doctrine\DBAL\Driver\IBMDB2\DB2Driver
;
use
Doctrine\DBAL\Driver\PDOOracle\Driver
as
PDOOracleDriver
;
use
Doctrine\DBAL\ParameterType
;
use
Doctrine\DBAL\ParameterType
;
use
Doctrine\DBAL\Schema\Table
;
use
Doctrine\DBAL\Schema\Table
;
use
Doctrine\Tests\DbalFunctionalTestCase
;
use
Doctrine\Tests\DbalFunctionalTestCase
;
...
@@ -19,6 +20,10 @@ class BinaryTest extends DbalFunctionalTestCase
...
@@ -19,6 +20,10 @@ class BinaryTest extends DbalFunctionalTestCase
{
{
parent
::
setUp
();
parent
::
setUp
();
if
(
$this
->
connection
->
getDriver
()
instanceof
PDOOracleDriver
)
{
$this
->
markTestSkipped
(
'PDO_OCI doesn\'t support binding binary values'
);
}
$table
=
new
Table
(
'binary_table'
);
$table
=
new
Table
(
'binary_table'
);
$table
->
addColumn
(
'id'
,
'binary'
,
[
$table
->
addColumn
(
'id'
,
'binary'
,
[
'length'
=>
16
,
'length'
=>
16
,
...
...
tests/Doctrine/Tests/DBAL/Functional/WriteTest.php
View file @
2179996d
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
namespace
Doctrine\Tests\DBAL\Functional
;
namespace
Doctrine\Tests\DBAL\Functional
;
use
DateTime
;
use
DateTime
;
use
Doctrine\DBAL\Driver\DriverException
;
use
Doctrine\DBAL\ParameterType
;
use
Doctrine\DBAL\ParameterType
;
use
Doctrine\DBAL\Schema\Sequence
;
use
Doctrine\DBAL\Schema\Sequence
;
use
Doctrine\DBAL\Schema\Table
;
use
Doctrine\DBAL\Schema\Table
;
...
@@ -149,7 +150,7 @@ class WriteTest extends DbalFunctionalTestCase
...
@@ -149,7 +150,7 @@ class WriteTest extends DbalFunctionalTestCase
}
}
self
::
assertEquals
(
1
,
$this
->
connection
->
insert
(
'write_table'
,
[
'test_int'
=>
2
,
'test_string'
=>
'bar'
]));
self
::
assertEquals
(
1
,
$this
->
connection
->
insert
(
'write_table'
,
[
'test_int'
=>
2
,
'test_string'
=>
'bar'
]));
$num
=
$this
->
connection
->
lastInsertId
();
$num
=
$this
->
lastInsertId
();
self
::
assertNotNull
(
$num
,
'LastInsertId() should not be null.'
);
self
::
assertNotNull
(
$num
,
'LastInsertId() should not be null.'
);
self
::
assertGreaterThan
(
0
,
$num
,
'LastInsertId() should be non-negative number.'
);
self
::
assertGreaterThan
(
0
,
$num
,
'LastInsertId() should be non-negative number.'
);
...
@@ -175,7 +176,7 @@ class WriteTest extends DbalFunctionalTestCase
...
@@ -175,7 +176,7 @@ class WriteTest extends DbalFunctionalTestCase
$stmt
=
$this
->
connection
->
query
(
$this
->
connection
->
getDatabasePlatform
()
->
getSequenceNextValSQL
(
'write_table_id_seq'
));
$stmt
=
$this
->
connection
->
query
(
$this
->
connection
->
getDatabasePlatform
()
->
getSequenceNextValSQL
(
'write_table_id_seq'
));
$nextSequenceVal
=
$stmt
->
fetchColumn
();
$nextSequenceVal
=
$stmt
->
fetchColumn
();
$lastInsertId
=
$this
->
connection
->
lastInsertId
(
'write_table_id_seq'
);
$lastInsertId
=
$this
->
lastInsertId
(
'write_table_id_seq'
);
self
::
assertGreaterThan
(
0
,
$lastInsertId
);
self
::
assertGreaterThan
(
0
,
$lastInsertId
);
self
::
assertEquals
(
$nextSequenceVal
,
$lastInsertId
);
self
::
assertEquals
(
$nextSequenceVal
,
$lastInsertId
);
...
@@ -187,7 +188,7 @@ class WriteTest extends DbalFunctionalTestCase
...
@@ -187,7 +188,7 @@ class WriteTest extends DbalFunctionalTestCase
$this
->
markTestSkipped
(
"Test only works consistently on platforms that support sequences and don't support identity columns."
);
$this
->
markTestSkipped
(
"Test only works consistently on platforms that support sequences and don't support identity columns."
);
}
}
self
::
assertFalse
(
$this
->
connection
->
lastInsertId
(
null
));
self
::
assertFalse
(
$this
->
lastInsertId
(
));
}
}
/**
/**
...
@@ -285,11 +286,11 @@ class WriteTest extends DbalFunctionalTestCase
...
@@ -285,11 +286,11 @@ class WriteTest extends DbalFunctionalTestCase
$this
->
connection
->
exec
(
$sql
);
$this
->
connection
->
exec
(
$sql
);
$firstId
=
$this
->
connection
->
lastInsertId
(
$seqName
);
$firstId
=
$this
->
lastInsertId
(
$seqName
);
$this
->
connection
->
exec
(
$sql
);
$this
->
connection
->
exec
(
$sql
);
$secondId
=
$this
->
connection
->
lastInsertId
(
$seqName
);
$secondId
=
$this
->
lastInsertId
(
$seqName
);
self
::
assertGreaterThan
(
$firstId
,
$secondId
);
self
::
assertGreaterThan
(
$firstId
,
$secondId
);
}
}
...
@@ -334,4 +335,25 @@ class WriteTest extends DbalFunctionalTestCase
...
@@ -334,4 +335,25 @@ class WriteTest extends DbalFunctionalTestCase
self
::
assertCount
(
0
,
$data
);
self
::
assertCount
(
0
,
$data
);
}
}
/**
* Returns the ID of the last inserted row or skips the test if the currently used driver
* doesn't support this feature
*
* @return string
*
* @throws DriverException
*/
private
function
lastInsertId
(
?
string
$name
=
null
)
{
try
{
return
$this
->
connection
->
lastInsertId
(
$name
);
}
catch
(
DriverException
$e
)
{
if
(
$e
->
getCode
()
===
'IM001'
)
{
$this
->
markTestSkipped
(
$e
->
getMessage
());
}
throw
$e
;
}
}
}
}
tests/continuousphp/bootstrap.php
View file @
2179996d
...
@@ -2,7 +2,18 @@
...
@@ -2,7 +2,18 @@
declare
(
strict_types
=
1
);
declare
(
strict_types
=
1
);
use
Doctrine\DBAL\DriverManager
;
(
static
function
()
:
void
{
(
static
function
()
:
void
{
// workaround for https://bugs.php.net/bug.php?id=77120
DriverManager
::
getConnection
([
'driver'
=>
'oci8'
,
'host'
=>
'oracle-xe-11'
,
'user'
=>
'ORACLE'
,
'password'
=>
'ORACLE'
,
'dbname'
=>
'XE'
,
])
->
query
(
'ALTER USER ORACLE IDENTIFIED BY ORACLE'
);
$pos
=
array_search
(
'--coverage-clover'
,
$_SERVER
[
'argv'
],
true
);
$pos
=
array_search
(
'--coverage-clover'
,
$_SERVER
[
'argv'
],
true
);
if
(
$pos
===
false
)
{
if
(
$pos
===
false
)
{
...
...
tests/continuousphp/install-pdo-oci.sh
0 → 100755
View file @
2179996d
#!/bin/bash
set
-euo
pipefail
phpbrew ext
install
pdo_oci
--
--with-pdo-oci
=
instantclient,/usr/local/instantclient
tests/continuousphp/pdo-oci.phpunit.xml
0 → 100644
View file @
2179996d
<?xml version="1.0" encoding="utf-8"?>
<phpunit
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation=
"../../vendor/phpunit/phpunit/phpunit.xsd"
colors=
"true"
beStrictAboutOutputDuringTests=
"true"
beStrictAboutTodoAnnotatedTests=
"true"
failOnRisky=
"true"
failOnWarning=
"true"
bootstrap=
"bootstrap.php"
>
<php>
<var
name=
"db_type"
value=
"pdo_oci"
/>
<var
name=
"db_host"
value=
"oracle-xe-11"
/>
<var
name=
"db_username"
value=
"C##doctrine"
/>
<var
name=
"db_password"
value=
"ORACLE"
/>
<var
name=
"db_name"
value=
"XE"
/>
<var
name=
"db_port"
value=
"1521"
/>
<var
name=
"db_event_subscribers"
value=
"Doctrine\DBAL\Event\Listeners\OracleSessionInit"
/>
<var
name=
"tmpdb_type"
value=
"pdo_oci"
/>
<var
name=
"tmpdb_host"
value=
"oracle-xe-11"
/>
<var
name=
"tmpdb_username"
value=
"ORACLE"
/>
<var
name=
"tmpdb_password"
value=
"ORACLE"
/>
<var
name=
"tmpdb_name"
value=
"XE"
/>
<var
name=
"tmpdb_port"
value=
"1521"
/>
</php>
<testsuites>
<testsuite
name=
"Doctrine DBAL Test Suite"
>
<directory>
../Doctrine/Tests/DBAL
</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory
suffix=
".php"
>
../../lib/Doctrine
</directory>
</whitelist>
</filter>
<listeners>
<listener
class=
"Symfony\Bridge\PhpUnit\SymfonyTestsListener"
/>
</listeners>
</phpunit>
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