Files
2026-11-11 13:18:47 +00:00

38 lines
848 B
PHP

<?php
namespace Tests\Feature\Db2;
use Illuminate\Support\Facades\DB;
use Tests\TestCase;
abstract class Db2TestCase extends TestCase
{
protected function db()
{
return DB::connection('db2_local');
}
protected function setUp(): void
{
parent::setUp();
if (! extension_loaded('pdo_odbc')) {
$this->markTestSkipped('PDO_ODBC extension unavailable.');
}
if (! config('database.connections.db2_local')) {
$this->markTestSkipped('db2_local is not configured.');
}
try {
$this->db()->select(
'SELECT 1 AS "health" FROM SYSIBM.SYSDUMMY1'
);
} catch (\Throwable $e) {
$this->markTestSkipped(
'Db2 connection unavailable: '.$e->getMessage()
);
}
}
}