Skip to content
This repository has been archived by the owner on Nov 21, 2023. It is now read-only.

Commit

Permalink
ci: 🎡 Workaround for sqlsrv
Browse files Browse the repository at this point in the history
  • Loading branch information
mpyw committed Aug 23, 2023
1 parent 08ec8d3 commit 0049281
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

namespace Mpyw\LaravelUniqueViolationDetector\Tests;

use Illuminate\Database\Connection;
use Illuminate\Database\Connectors\SqlServerConnector;
use Illuminate\Database\QueryException;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\SQLiteConnection;
Expand Down Expand Up @@ -40,6 +42,19 @@ protected function setUp(): void
{
parent::setUp();

// https://github.com/laravel/framework/issues/47937#issuecomment-1678200201
$this->app->instance(
'db.connector.sqlsrv',
new class() extends SqlServerConnector {
protected $options = [
PDO::ATTR_CASE => PDO::CASE_NATURAL,
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_ORACLE_NULLS => PDO::NULL_NATURAL,
PDO::SQLSRV_ATTR_FETCHES_NUMERIC_TYPE => true,
];
},
);

config(['database.connections' => require __DIR__ . '/config/database.php']);
config(['database.default' => getenv('DB') ?: 'sqlite']);

Expand Down

0 comments on commit 0049281

Please sign in to comment.