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

orchestral / testbench-core / 11777378954

11 Nov 2024 11:11AM UTC coverage: 92.043% (+0.01%) from 92.031%
11777378954

push

github

web-flow
[7.x] Uses PHPStan 2 (#256)

Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>

5 of 5 new or added lines in 3 files covered. (100.0%)

2 existing lines in 2 files now uncovered.

1203 of 1307 relevant lines covered (92.04%)

62.04 hits per line

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

94.12
/src/Foundation/Console/DropSqliteDbCommand.php
1
<?php
2

3
namespace Orchestra\Testbench\Foundation\Console;
4

5
use Illuminate\Console\Command;
6
use Illuminate\Filesystem\Filesystem;
7
use Illuminate\Support\Str;
8
use Symfony\Component\Console\Attribute\AsCommand;
9

10
use function Orchestra\Testbench\join_paths;
11

12
#[AsCommand(name: 'package:drop-sqlite-db', description: 'Drop sqlite database file')]
13
class DropSqliteDbCommand extends Command
14
{
15
    /**
16
     * The name and signature of the console command.
17
     *
18
     * @var string
19
     */
20
    protected $signature = 'package:drop-sqlite-db
21
                                {--database=database.sqlite : Set the database name}
22
                                {--all : Delete all SQLite databases}';
23

24
    /**
25
     * Execute the console command.
26
     *
27
     * @param  \Illuminate\Filesystem\Filesystem  $filesystem
28
     * @return int
29
     */
30
    public function handle(Filesystem $filesystem)
31
    {
32
        $workingPath = $this->laravel->basePath();
2✔
33
        $databasePath = $this->laravel->databasePath();
2✔
34

35
        (new Actions\DeleteFiles(
2✔
36
            filesystem: $filesystem,
2✔
37
            components: $this->components,
2✔
38
            workingPath: $workingPath,
2✔
39
        ))->handle(
2✔
40
            match ($this->option('all')) {
2✔
41
                true => [...$filesystem->glob(join_paths($databasePath, '*.sqlite'))],
2✔
42
                default => [join_paths($databasePath, $this->databaseName())],
2✔
43
            }
2✔
44
        );
2✔
45

46
        return Command::SUCCESS;
2✔
47
    }
48

49
    /**
50
     * Resolve the database name.
51
     *
52
     * @return string
53
     */
54
    protected function databaseName(): string
55
    {
56
        /** @var string|null $database */
57
        $database = $this->option('database');
2✔
58

59
        if (empty($database)) {
2✔
UNCOV
60
            $database = 'database';
×
61
        }
62

63
        return \sprintf('%s.sqlite', Str::before((string) $database, '.sqlite'));
2✔
64
    }
65
}
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