diff --git a/tests/OracleDBQueryBuilderTest.php b/tests/OracleDBQueryBuilderTest.php index 723c8cb..c929b4b 100644 --- a/tests/OracleDBQueryBuilderTest.php +++ b/tests/OracleDBQueryBuilderTest.php @@ -290,24 +290,29 @@ public function testBasicWheres() public function testWheresWithArrayValue() { $builder = $this->getOracleBuilder(); - $builder->select('*')->from('users')->where('id', [12, 30]); + $builder->select('*')->from('users')->where('id', [12]); $this->assertSame('select * from "users" where "id" = ?', $builder->toSql()); - $this->assertEquals([0 => 12, 1 => 30], $builder->getBindings()); + $this->assertEquals([0 => 12], $builder->getBindings()); $builder = $this->getOracleBuilder(); $builder->select('*')->from('users')->where('id', '=', [12, 30]); $this->assertSame('select * from "users" where "id" = ?', $builder->toSql()); - $this->assertEquals([0 => 12, 1 => 30], $builder->getBindings()); + $this->assertEquals([0 => 12], $builder->getBindings()); $builder = $this->getOracleBuilder(); $builder->select('*')->from('users')->where('id', '!=', [12, 30]); $this->assertSame('select * from "users" where "id" != ?', $builder->toSql()); - $this->assertEquals([0 => 12, 1 => 30], $builder->getBindings()); + $this->assertEquals([0 => 12], $builder->getBindings()); $builder = $this->getOracleBuilder(); $builder->select('*')->from('users')->where('id', '<>', [12, 30]); $this->assertSame('select * from "users" where "id" <> ?', $builder->toSql()); - $this->assertEquals([0 => 12, 1 => 30], $builder->getBindings()); + $this->assertEquals([0 => 12], $builder->getBindings()); + + $builder = $this->getOracleBuilder(); + $builder->select('*')->from('users')->where('id', '=', [[12, 30]]); + $this->assertSame('select * from "users" where "id" = ?', $builder->toSql()); + $this->assertEquals([0 => 12], $builder->getBindings()); } public function testDateBasedWheresAcceptsTwoArguments() diff --git a/tests/mocks/OCIFunctions.php b/tests/mocks/OCIFunctions.php index 15e1bc7..de4a3f5 100644 --- a/tests/mocks/OCIFunctions.php +++ b/tests/mocks/OCIFunctions.php @@ -15,7 +15,11 @@ if (! function_exists("Jfelder\OracleDB\OCI_PDO\oci_error")) { function oci_error($a = '') { - return ['code' => 0,'message' => '', 'sqltext' => '']; + global $OCIExecuteStatus, $OCIFetchStatus, $OCITransactionStatus; + + return ($OCIExecuteStatus && $OCIFetchStatus && $OCITransactionStatus) + ? false + : ['code' => 0,'message' => '', 'sqltext' => '']; } }