1 | <?php |
||||
2 | |||||
3 | declare(strict_types=1); |
||||
4 | |||||
5 | namespace Umbrellio\Postgres\Helpers; |
||||
6 | |||||
7 | use Illuminate\Support\Facades\Schema; |
||||
8 | |||||
9 | /** |
||||
10 | * @codeCoverageIgnore |
||||
11 | */ |
||||
12 | trait TableAssertions |
||||
13 | { |
||||
14 | abstract public static function assertSame($expected, $actual, string $message = ''): void; |
||||
15 | |||||
16 | abstract public static function assertTrue($condition, string $message = ''): void; |
||||
17 | |||||
18 | protected function assertCompareTables(string $sourceTable, string $destinationTable): void |
||||
19 | { |
||||
20 | $this->assertSame($this->getTableDefinition($sourceTable), $this->getTableDefinition($destinationTable)); |
||||
21 | } |
||||
22 | |||||
23 | protected function assertSameTable(array $expectedDef, string $table): void |
||||
24 | { |
||||
25 | $definition = $this->getTableDefinition($table); |
||||
26 | |||||
27 | $this->assertSame($expectedDef, $definition); |
||||
28 | } |
||||
29 | |||||
30 | protected function seeTable(string $table): void |
||||
31 | { |
||||
32 | $this->assertTrue(Schema::hasTable($table)); |
||||
0 ignored issues
–
show
|
|||||
33 | } |
||||
34 | |||||
35 | private function getTableDefinition(string $table): array |
||||
36 | { |
||||
37 | return Schema::getColumnListing($table); |
||||
0 ignored issues
–
show
The method
getColumnListing() does not exist on Illuminate\Support\Facades\Schema .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() |
|||||
38 | } |
||||
39 | } |
||||
40 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.