Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing failing tests #302

Merged
merged 2 commits into from
Jun 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions Tests/Pgsql/PgsqlPreparedStatementTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
use Joomla\Database\Exception\ExecutionFailureException;
use Joomla\Test\DatabaseTestCase;

/**
* Test class for Joomla\Database\Pgsql\PgsqlStatement
*/
class PgsqlPreparedStatementTest extends DatabaseTestCase
{
/**
Expand All @@ -19,14 +22,11 @@ class PgsqlPreparedStatementTest extends DatabaseTestCase
*/
public static function setUpBeforeClass(): void
{
$manager = static::getDatabaseManager();
parent::setUpBeforeClass();

$connection = $manager->getConnection();
$manager->dropDatabase();
$manager->createDatabase();
$connection->select($manager->getDbName());

static::$connection = $connection;
if (!static::$connection || static::$connection->getName() !== 'pgsql') {
self::markTestSkipped('PostgreSQL database not configured.');
}
}

/**
Expand Down
16 changes: 8 additions & 8 deletions Tests/Sqlsrv/SqlsrvPreparedStatementTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
use Joomla\Database\Sqlsrv\SqlsrvStatement;
use Joomla\Test\DatabaseTestCase;

/**
* Test class for Joomla\Database\Sqlsrv\SqlsrvStatement
*/
class SqlsrvPreparedStatementTest extends DatabaseTestCase
{
/**
Expand All @@ -20,14 +23,11 @@ class SqlsrvPreparedStatementTest extends DatabaseTestCase
*/
public static function setUpBeforeClass(): void
{
$manager = static::getDatabaseManager();
parent::setUpBeforeClass();

$connection = $manager->getConnection();
$manager->dropDatabase();
$manager->createDatabase();
$connection->select($manager->getDbName());

static::$connection = $connection;
if (!static::$connection || static::$connection->getName() !== 'sqlsrv') {
self::markTestSkipped('SQL Server database not configured.');
}
}

/**
Expand All @@ -49,7 +49,7 @@ protected function setUp(): void
} catch (ExecutionFailureException $exception) {
$this->markTestSkipped(
\sprintf(
'Could not load MS SQL Server database: %s',
'Could not load SQL Server database: %s',
$exception->getMessage()
)
);
Expand Down
2 changes: 1 addition & 1 deletion Tests/Sqlsrv/SqlsrvStatementTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @license GNU General Public License version 2 or later; see LICENSE
*/

namespace Joomla\Database\Tests\Sqlqrv;
namespace Joomla\Database\Tests\Sqlsrv;

use Joomla\Database\DatabaseDriver;
use Joomla\Database\Exception\ExecutionFailureException;
Expand Down
1 change: 0 additions & 1 deletion src/Mysqli/MysqliStatement.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@ public function prepareParameterKeyMapping($sql)
if (isset($mapping[$match[0]])) {
$mapping[$match[0]] = is_array($mapping[$match[0]]) ? $mapping[$match[0]] : [$mapping[$match[0]]];
$mapping[$match[0]][] = \count($mapping);

} else {
$mapping[$match[0]] = \count($mapping);
}
Expand Down
1 change: 0 additions & 1 deletion src/Sqlsrv/SqlsrvStatement.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,6 @@ public function prepareParameterKeyMapping($sql)
if (isset($mapping[$match[0]])) {
$mapping[$match[0]] = is_array($mapping[$match[0]]) ? $mapping[$match[0]] : [$mapping[$match[0]]];
$mapping[$match[0]][] = \count($mapping);

} else {
$mapping[$match[0]] = \count($mapping);
}
Expand Down