Derive mode from DSN function
- Add headers in all files - Minor field name changes
This commit is contained in:
@@ -1,4 +1,10 @@
|
||||
<?php declare(strict_types=1);
|
||||
<?php
|
||||
/**
|
||||
* @author Daniel J. Summers <daniel@bitbadger.solutions>
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Test\Unit;
|
||||
|
||||
@@ -91,11 +97,11 @@ class ParametersTest extends TestCase
|
||||
public function testFieldNamesSucceedsForPostgreSQL(): void
|
||||
{
|
||||
try {
|
||||
Configuration::$mode = Mode::PgSQL;
|
||||
Configuration::overrideMode(Mode::PgSQL);
|
||||
$this->assertEquals([':names' => "{one,two,seven}"],
|
||||
Parameters::fieldNames(':names', ['one', 'two', 'seven']), 'Field name parameters not correct');
|
||||
} finally {
|
||||
Configuration::$mode = null;
|
||||
Configuration::overrideMode(null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,18 +109,18 @@ class ParametersTest extends TestCase
|
||||
public function testFieldNamesSucceedsForSQLite(): void
|
||||
{
|
||||
try {
|
||||
Configuration::$mode = Mode::SQLite;
|
||||
Configuration::overrideMode(Mode::SQLite);
|
||||
$this->assertEquals([':it0' => '$.test', ':it1' => '$.unit', ':it2' => '$.wow'],
|
||||
Parameters::fieldNames(':it', ['test', 'unit', 'wow']), 'Field name parameters not correct');
|
||||
} finally {
|
||||
Configuration::$mode = null;
|
||||
Configuration::overrideMode(null);
|
||||
}
|
||||
}
|
||||
|
||||
public function testFieldNamesFailsWhenModeNotSet(): void
|
||||
{
|
||||
$this->expectException(DocumentException::class);
|
||||
Configuration::$mode = null;
|
||||
Configuration::overrideMode(null);
|
||||
Parameters::fieldNames('', []);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user