Commit c1d2c6a8 authored by Sergei Morozov's avatar Sergei Morozov

Added some more code coverage, removed unnecessary condition

parent 4863bd25
...@@ -151,10 +151,7 @@ class OCI8Statement implements \IteratorAggregate, Statement ...@@ -151,10 +151,7 @@ class OCI8Statement implements \IteratorAggregate, Statement
)); ));
} }
if ($fragmentOffset < strlen($statement)) { $fragments[] = substr($statement, $fragmentOffset);
$fragments[] = substr($statement, $fragmentOffset);
}
$statement = implode('', $fragments); $statement = implode('', $fragments);
return array($statement, $paramMap); return array($statement, $paramMap);
......
...@@ -113,24 +113,18 @@ class OCI8StatementTest extends DbalTestCase ...@@ -113,24 +113,18 @@ class OCI8StatementTest extends DbalTestCase
"INSERT INTO table (col1, col2, col3, col4) VALUES('?\"?\'?', :param1, \"?'?\\\"?\", :param2)", "INSERT INTO table (col1, col2, col3, col4) VALUES('?\"?\'?', :param1, \"?'?\\\"?\", :param2)",
2, 2,
), ),
'placeholder-at-the-end' => array(
"SELECT id FROM table WHERE col = ?",
"SELECT id FROM table WHERE col = :param1",
1,
),
); );
} }
/** public function testConvertNonTerminatedLiteral()
* @dataProvider convertFailureProvider
*/
public function testConvertFailure($statement)
{ {
$this->expectException(OCI8Exception::class); $this->expectException(OCI8Exception::class);
OCI8Statement::convertPositionalToNamedPlaceholders($statement); $this->expectExceptionMessageRegExp('/offset 7/');
} OCI8Statement::convertPositionalToNamedPlaceholders('SELECT "literal');
public static function convertFailureProvider()
{
return array(
'non-terminated-literal' => array(
'SELECT "literal',
),
);
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment