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 ViewAssertions |
||||
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 | abstract public static function assertFalse($condition, string $message = ''): void; |
||||
19 | |||||
20 | protected function assertSameView(string $expectedDef, string $view): void |
||||
21 | { |
||||
22 | $definition = $this->getViewDefinition($view); |
||||
23 | |||||
24 | $this->assertSame($expectedDef, $definition); |
||||
25 | } |
||||
26 | |||||
27 | protected function seeView(string $view): void |
||||
28 | { |
||||
29 | $this->assertTrue(Schema::hasView($view)); |
||||
0 ignored issues
–
show
|
|||||
30 | } |
||||
31 | |||||
32 | protected function notSeeView(string $view): void |
||||
33 | { |
||||
34 | $this->assertFalse(Schema::hasView($view)); |
||||
35 | } |
||||
36 | |||||
37 | private function getViewDefinition(string $view): string |
||||
38 | { |
||||
39 | return preg_replace( |
||||
40 | "#\s+#", |
||||
41 | ' ', |
||||
42 | strtolower(trim(str_replace("\n", ' ', Schema::getViewDefinition($view)))) |
||||
0 ignored issues
–
show
The method
getViewDefinition() 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. ![]() |
|||||
43 | ); |
||||
44 | } |
||||
45 | } |
||||
46 |
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.