@@ 27-44 (lines=18) @@ | ||
24 | * |
|
25 | * @return $this |
|
26 | */ |
|
27 | protected function assertSeeIsNotSoftDeletedInDatabase($table, array $data, $connection = null) |
|
28 | { |
|
29 | $database = $this->app->make('db'); |
|
30 | ||
31 | $connection = $connection ?: $database->getDefaultConnection(); |
|
32 | ||
33 | $count = $database->connection($connection) |
|
34 | ->table($table) |
|
35 | ->where($data) |
|
36 | ->whereNull('deleted_at') |
|
37 | ->count(); |
|
38 | ||
39 | $this->assertGreaterThan(0, $count, sprintf( |
|
40 | 'Found unexpected records in database table [%s] that matched attributes [%s].', $table, json_encode($data) |
|
41 | )); |
|
42 | ||
43 | return $this; |
|
44 | } |
|
45 | ||
46 | /** |
|
47 | * Assert that a given where condition matches a soft deleted record |
|
@@ 56-73 (lines=18) @@ | ||
53 | * |
|
54 | * @return $this |
|
55 | */ |
|
56 | protected function assertIsSoftDeletedInDatabase($table, array $data, $connection = null) |
|
57 | { |
|
58 | $database = $this->app->make('db'); |
|
59 | ||
60 | $connection = $connection ?: $database->getDefaultConnection(); |
|
61 | ||
62 | $count = $database->connection($connection) |
|
63 | ->table($table) |
|
64 | ->where($data) |
|
65 | ->whereNotNull('deleted_at') |
|
66 | ->count(); |
|
67 | ||
68 | $this->assertGreaterThan(0, $count, sprintf( |
|
69 | 'Found unexpected records in database table [%s] that matched attributes [%s].', $table, json_encode($data) |
|
70 | )); |
|
71 | ||
72 | return $this; |
|
73 | } |
|
74 | ||
75 | /** |
|
76 | * Assert that a given where condition exists in the database and return the first occurrence. |