-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathInstallerMariaDbVersionTest.php
More file actions
61 lines (52 loc) · 2.19 KB
/
Copy pathInstallerMariaDbVersionTest.php
File metadata and controls
61 lines (52 loc) · 2.19 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
declare(strict_types=1);
use PHPUnit\Framework\TestCase;
final class InstallerMariaDbVersionTest extends TestCase
{
private string $script;
protected function setUp(): void
{
$this->script = file_get_contents(__DIR__ . '/../install/debian13.sh');
}
public function testDebian13InstallerConfiguresMariaDbRepositoryWithRequestedVersion(): void
{
$this->assertStringContainsString(
'--mariadb-server-version="mariadb-${VERSION_MARIADB}"',
$this->script
);
}
public function testDebian13InstallerDownloadsRepositorySetupBeforeExecutingIt(): void
{
$this->assertStringContainsString('repo_setup_script=$(mktemp)', $this->script);
$this->assertStringContainsString(
'curl -fsSL https://r.mariadb.com/downloads/mariadb_repo_setup -o "${repo_setup_script}"',
$this->script
);
$this->assertStringContainsString(
'bash "${repo_setup_script}" --mariadb-server-version="mariadb-${VERSION_MARIADB}"',
$this->script
);
$this->assertStringNotContainsString('| bash -s -- --mariadb-server-version', $this->script);
}
public function testDebian13InstallerPinsMariaDbPackagesToResolvedVersion(): void
{
$this->assertMatchesRegularExpression(
'/resolve_mariadb_package_version\(\).*apt-cache madison mariadb-server/s',
$this->script
);
$this->assertStringContainsString('"mariadb-server=${mariadb_package_version}"', $this->script);
$this->assertStringContainsString('"mariadb-client=${mariadb_package_version}"', $this->script);
$this->assertStringContainsString('"mariadb-plugin-rocksdb=${mariadb_package_version}"', $this->script);
$this->assertStringNotContainsString(
'apt-get install -y mariadb-server mariadb-client mariadb-plugin-rocksdb',
$this->script
);
}
public function testDebian13InstallerFailsWhenRequestedMariaDbVersionIsUnavailable(): void
{
$this->assertStringContainsString(
'MariaDB ${VERSION_MARIADB} is not available in the configured APT repositories.',
$this->script
);
}
}