diff --git a/tests/OracleDBOCIStatementTest.php b/tests/OracleDBOCIStatementTest.php index 749785f..19d208e 100644 --- a/tests/OracleDBOCIStatementTest.php +++ b/tests/OracleDBOCIStatementTest.php @@ -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 */ diff --git a/tests/mocks/OCIFunctions.php b/tests/mocks/OCIFunctions.php index c956a2f..15e1bc7 100644 --- a/tests/mocks/OCIFunctions.php +++ b/tests/mocks/OCIFunctions.php @@ -7,6 +7,7 @@ $OCIExecuteStatus = true; $OCIFetchStatus = true; $OCIBindChangeStatus = false; + $OCIBindByNameTypeReceived = null; } namespace Jfelder\OracleDB\OCI_PDO { @@ -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'; }