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

tempestphp / tempest-framework / 14140550176

28 Mar 2025 10:29PM UTC coverage: 80.716% (+1.4%) from 79.334%
14140550176

push

github

web-flow
feat(support): support `$default` on array `first` and `last` methods (#1096)

11 of 12 new or added lines in 2 files covered. (91.67%)

135 existing lines in 16 files now uncovered.

10941 of 13555 relevant lines covered (80.72%)

100.32 hits per line

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

69.23
/src/Tempest/Database/src/QueryStatements/DropTableStatement.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace Tempest\Database\QueryStatements;
6

7
use Tempest\Database\Builder\ModelDefinition;
8
use Tempest\Database\Config\DatabaseDialect;
9
use Tempest\Database\QueryStatement;
10

11
final class DropTableStatement implements QueryStatement
12
{
13
    use CanExecuteStatement;
14

15
    public function __construct(
75✔
16
        private readonly string $tableName,
17
        /** @var \Tempest\Database\QueryStatements\DropConstraintStatement[] $dropReferences */
18
        private array $dropReferences = [],
19
    ) {}
75✔
20

UNCOV
21
    public function dropReference(string $foreign): self
×
22
    {
UNCOV
23
        $this->dropReferences[] = new DropConstraintStatement($this->tableName, $foreign);
×
24

UNCOV
25
        return $this;
×
26
    }
27

28
    /** @param class-string $modelClass */
29
    public static function forModel(string $modelClass): self
65✔
30
    {
31
        return new self(new ModelDefinition($modelClass)->getTableDefinition()->name);
65✔
32
    }
33

34
    public function compile(DatabaseDialect $dialect): string
75✔
35
    {
36
        $statements = [];
75✔
37

38
        foreach ($this->dropReferences as $dropReference) {
75✔
UNCOV
39
            $statements[] = $dropReference->compile($dialect);
×
40
        }
41

42
        $statements[] = sprintf('DROP TABLE IF EXISTS `%s`', $this->tableName);
75✔
43

44
        return implode('; ', $statements) . ';';
75✔
45
    }
46
}
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

© 2025 Coveralls, Inc