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
));
}
if ($fragmentOffset < strlen($statement)) {
$fragments[] = substr($statement, $fragmentOffset);
}
$fragments[] = substr($statement, $fragmentOffset);
$statement = implode('', $fragments);
return array($statement, $paramMap);
......
......@@ -113,24 +113,18 @@ class OCI8StatementTest extends DbalTestCase
"INSERT INTO table (col1, col2, col3, col4) VALUES('?\"?\'?', :param1, \"?'?\\\"?\", :param2)",
2,
),
'placeholder-at-the-end' => array(
"SELECT id FROM table WHERE col = ?",
"SELECT id FROM table WHERE col = :param1",
1,
),
);
}
/**
* @dataProvider convertFailureProvider
*/
public function testConvertFailure($statement)
public function testConvertNonTerminatedLiteral()
{
$this->expectException(OCI8Exception::class);
OCI8Statement::convertPositionalToNamedPlaceholders($statement);
}
public static function convertFailureProvider()
{
return array(
'non-terminated-literal' => array(
'SELECT "literal',
),
);
$this->expectExceptionMessageRegExp('/offset 7/');
OCI8Statement::convertPositionalToNamedPlaceholders('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