Skip to content
This repository was archived by the owner on Aug 22, 2023. It is now read-only.

Commit 1df06f9

Browse files
committed
Skip MySQL tests if database is not available
1 parent 1303b5f commit 1df06f9

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

tests/HybridRelationsTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,22 @@
33
declare(strict_types=1);
44

55
use Illuminate\Database\MySqlConnection;
6+
use Illuminate\Support\Facades\DB;
7+
use PDOException;
68

79
class HybridRelationsTest extends TestCase
810
{
911
public function setUp(): void
1012
{
1113
parent::setUp();
1214

15+
/** @var Connection */
16+
try {
17+
DB::connection('mysql')->select('SELECT 1');
18+
} catch (PDOException) {
19+
$this->markTestSkipped('MySQL connection is not available.');
20+
}
21+
1322
MysqlUser::executeSchema();
1423
MysqlBook::executeSchema();
1524
MysqlRole::executeSchema();

0 commit comments

Comments
 (0)