forked from fschmtt/keycloak-rest-api-client-php
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIntegrationTestBehaviour.php
More file actions
39 lines (31 loc) · 1.04 KB
/
Copy pathIntegrationTestBehaviour.php
File metadata and controls
39 lines (31 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
declare(strict_types=1);
namespace Fschmtt\Keycloak\Test\Integration;
use Fschmtt\Keycloak\Keycloak;
trait IntegrationTestBehaviour
{
private static ?Keycloak $keycloak = null;
public static function getKeycloak(): Keycloak
{
if (!self::$keycloak) {
self::$keycloak = new Keycloak(
$_SERVER['KEYCLOAK_BASE_URL'] ?? 'http://keycloak:8080',
'admin',
'admin',
);
}
return self::$keycloak;
}
protected function skipIfKeycloakVersionIsLessThan(string $version): void
{
if (version_compare(self::getKeycloak()->getVersion(), $version, '<')) {
$this->markTestSkipped(sprintf('Keycloak version is less than %s', $version));
}
}
protected function skipIfKeycloakVersionIsGreaterThan(string $version): void
{
if (version_compare(self::getKeycloak()->getVersion(), $version, '>')) {
$this->markTestSkipped(sprintf('Keycloak version is greater than %s', $version));
}
}
}