Skip to content

Commit

Permalink
Fix test with pre 8.81.0 Laravel
Browse files Browse the repository at this point in the history
  • Loading branch information
peterfox committed Oct 5, 2022
1 parent c4a0838 commit 98eaa34
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions tests/Database/DatabaseCockroachDbConnectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace YlsIdeas\CockroachDb\Tests\Database;

use Illuminate\Foundation\Application;
use PHPUnit\Framework\TestCase;
use YlsIdeas\CockroachDb\CockroachDbConnector;

Expand All @@ -20,7 +21,11 @@ public function test_dsn_params_with_cluster()
],
);

$this->assertStringContainsString("dbname='cluster-1234.defaultdb'", $dsnConfig);
if (version_compare(Application::VERSION, '8.81.0', '>=')) {
$this->assertStringContainsString('dbname=\'cluster-1234.defaultdb\'', $dsnConfig);
} else {
$this->assertStringContainsString('dbname=cluster-1234.defaultdb', $dsnConfig);
}
}

public function test_dsn_params_without_cluster()
Expand All @@ -36,7 +41,11 @@ public function test_dsn_params_without_cluster()
],
);

$this->assertStringContainsString("dbname='defaultdb'", $dsnConfig);
if (version_compare(Application::VERSION, '8.81.0', '>=')) {
$this->assertStringContainsString('dbname=\'defaultdb\'', $dsnConfig);
} else {
$this->assertStringContainsString('dbname=defaultdb', $dsnConfig);
}
}

protected function getConnector()
Expand Down

0 comments on commit 98eaa34

Please sign in to comment.