• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

tempestphp / tempest-framework / 14161923512

30 Mar 2025 01:41PM UTC coverage: 80.964% (+0.2%) from 80.716%
14161923512

push

github

web-flow
ci: prevent coveralls failures from failing tests (#1104)

11058 of 13658 relevant lines covered (80.96%)

100.68 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

95.45
/src/Tempest/Framework/Commands/MigrateValidateCommand.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace Tempest\Framework\Commands;
6

7
use Tempest\Console\Console;
8
use Tempest\Console\ConsoleCommand;
9
use Tempest\Console\ExitCode;
10
use Tempest\Container\Singleton;
11
use Tempest\Database\Migrations\MigrationHashMismatchException;
12
use Tempest\Database\Migrations\MigrationManager;
13
use Tempest\Database\Migrations\MigrationValidationFailed;
14
use Tempest\Database\Migrations\MissingMigrationFileException;
15
use Tempest\EventBus\EventHandler;
16

17
#[Singleton]
18
final class MigrateValidateCommand
19
{
20
    private bool $validationPassed = true;
21

22
    public function __construct(
15✔
23
        private readonly Console $console,
24
        private readonly MigrationManager $migrationManager,
25
    ) {}
15✔
26

27
    #[ConsoleCommand(
15✔
28
        name: 'migrate:validate',
29
        description: 'Validates the integrity of existing migration files by checking if they have been tampered with.',
30
    )]
31
    public function __invoke(): ExitCode
32
    {
33
        $this->console->header('Validating migration files');
15✔
34
        $this->migrationManager->validate();
15✔
35

36
        if (! $this->validationPassed) {
15✔
37
            $this->console->writeln();
4✔
38
            $this->console->error('Migration files are invalid.');
4✔
39

40
            return ExitCode::ERROR;
4✔
41
        }
42

43
        $this->console->success('Migration files are valid.');
15✔
44

45
        return ExitCode::SUCCESS;
15✔
46
    }
47

48
    #[EventHandler]
4✔
49
    public function onMigrationValidationFailed(MigrationValidationFailed $event): void
50
    {
51
        $error = match ($event->exception::class) {
4✔
52
            MigrationHashMismatchException::class => 'Hash mismatch',
3✔
53
            MissingMigrationFileException::class => 'Missing file',
1✔
54
            default => 'Unknown error',
×
55
        };
4✔
56

57
        $this->console->keyValue(
4✔
58
            key: "<style='fg-gray'>{$event->name}</style>",
4✔
59
            value: "<style='fg-red'>" . strtoupper($error) . '</style>',
4✔
60
        );
4✔
61

62
        $this->validationPassed = false;
4✔
63
    }
64
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc