Skip to content

Commit 0e551c7

Browse files
authored
Do not run the migrations and git pull when testing (#3304)
1 parent 9be4edf commit 0e551c7

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

app/Actions/Diagnostics/Pipes/Checks/UpdatableCheck.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
use App\Metadata\Versions\GitHubVersion;
2020
use App\Metadata\Versions\InstalledVersion;
2121
use App\Models\Configs;
22+
use Illuminate\Support\Facades\App;
2223
use Illuminate\Support\Facades\Schema;
2324
use function Safe\exec;
2425

@@ -92,10 +93,14 @@ public static function assertUpdatability(): void
9293
$git_hub_functions = resolve(GitHubVersion::class);
9394
$git_hub_functions->hydrate(false);
9495

96+
if (App::runningUnitTests()) {
97+
throw new ConfigurationException('Unit tests are running, cannot update.');
98+
}
99+
100+
// @codeCoverageIgnoreStart
95101
if (!$git_hub_functions->hasPermissions()) {
96-
// @codeCoverageIgnoreStart
97102
throw new InsufficientFilesystemPermissions(Helpers::censor(base_path('.git'), 1 / 4) . ' (and subdirectories) are not executable, check the permissions');
98-
// @codeCoverageIgnoreEnd
99103
}
104+
// @codeCoverageIgnoreEnd
100105
}
101106
}

tests/Feature_v2/UpdateTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function testForbidden(): void
5050
public function testGet(): void
5151
{
5252
$response = $this->actingAs($this->admin)->get('Update');
53-
$this->assertOk($response);
53+
$this->assertStatus($response, 412); // Precondition failed
5454

5555
$response = $this->actingAs($this->admin)->get('migrate');
5656
$this->assertStatus($response, 307);

0 commit comments

Comments
 (0)