Files
Testbed/tests/Feature/Db2/Db2TestCase.php
T
2026-11-11 10:48:53 +00:00

38 lines
850 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()
);
}
}
}