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

systemsdk / docker-apache-php-laravel / #83

04 May 2025 03:35PM UTC coverage: 12.5%. Remained the same
#83

push

DKravtsov
Updated composer dependencies. Added xalan tool for generating phpcpd html report.

2 of 16 relevant lines covered (12.5%)

0.13 hits per line

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

0.0
/app/Console/Commands/DbWaitDatabase.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace App\Console\Commands;
6

7
use Illuminate\Console\Command;
8
use Illuminate\Database\QueryException;
9
use Illuminate\Support\Facades\DB;
10

11
class DbWaitDatabase extends Command
12
{
13
    /**
14
     * Wait sleep time for db connection in seconds
15
     */
16
    private const int WAIT_SLEEP_TIME = 2;
17

18
    /**
19
     * The name and signature of the console command.
20
     *
21
     * @var string
22
     */
23
    protected $signature = 'db:wait';
24

25
    /**
26
     * The console command description.
27
     *
28
     * @var string
29
     */
30
    protected $description = 'Waits for database availability.';
31

32
    /**
33
     * Execute the console command.
34
     */
35
    public function handle(DB $database): int
36
    {
37
        for ($i = 0; $i < 60; $i += self::WAIT_SLEEP_TIME) {
×
38
            try {
39
                $database::select('SHOW TABLES');
×
40
                $this->info('Connection to the database is ok!');
×
41

42
                return 0;
×
43
            } catch (QueryException $exception) {
×
44
                $this->comment('Trying to connect to the database seconds:' . $i);
×
45
                sleep(self::WAIT_SLEEP_TIME);
×
46

47
                continue;
×
48
            }
49
        }
50

51
        $this->error('Can not connect to the database');
×
52

53
        return 1;
×
54
    }
55
}
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