Skip to content

Commit

Permalink
add test for prev bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
efcor committed Feb 9, 2021
1 parent 534431e commit ac010a6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
7 changes: 7 additions & 0 deletions tests/OracleDBOCIStatementTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,13 @@ public function testBindValueWithValidDataType()
$this->assertTrue($this->stmt->bindValue('param', 'hello'));
}

public function testBindValueWithNullDataType()
{
global $OCIBindByNameTypeReceived;
$this->assertTrue($this->stmt->bindValue('param', null, \PDO::PARAM_NULL));
$this->assertSame(\SQLT_CHR, $OCIBindByNameTypeReceived);
}

/**
* @expectedException \InvalidArgumentException
*/
Expand Down
6 changes: 5 additions & 1 deletion tests/mocks/OCIFunctions.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
$OCIExecuteStatus = true;
$OCIFetchStatus = true;
$OCIBindChangeStatus = false;
$OCIBindByNameTypeReceived = null;
}

namespace Jfelder\OracleDB\OCI_PDO {
Expand Down Expand Up @@ -79,7 +80,10 @@ function get_resource_type($a = '')
if (! function_exists("Jfelder\OracleDB\OCI_PDO\oci_bind_by_name")) {
function oci_bind_by_name($a = '', $b = '', &$c, $d = '', $e = '')
{
global $OCIStatementStatus, $OCIBindChangeStatus;
global $OCIStatementStatus, $OCIBindChangeStatus, $OCIBindByNameTypeReceived;

$OCIBindByNameTypeReceived = $e;

if ($OCIBindChangeStatus) {
$c = 'oci_bind_by_name';
}
Expand Down

0 comments on commit ac010a6

Please sign in to comment.