|
@@ 44-61 (lines=18) @@
|
| 41 |
|
* @param string $connection |
| 42 |
|
* @return $this |
| 43 |
|
*/ |
| 44 |
|
protected function seeIsNotSoftDeletedInDatabase($table, array $data, $connection = null) |
| 45 |
|
{ |
| 46 |
|
$database = $this->app->make('db'); |
| 47 |
|
|
| 48 |
|
$connection = $connection ?: $database->getDefaultConnection(); |
| 49 |
|
|
| 50 |
|
$count = $database->connection($connection) |
| 51 |
|
->table($table) |
| 52 |
|
->where($data) |
| 53 |
|
->whereNull('deleted_at') |
| 54 |
|
->count(); |
| 55 |
|
|
| 56 |
|
$this->assertGreaterThan(0, $count, sprintf( |
| 57 |
|
'Found unexpected records in database table [%s] that matched attributes [%s].', $table, json_encode($data) |
| 58 |
|
)); |
| 59 |
|
|
| 60 |
|
return $this; |
| 61 |
|
} |
| 62 |
|
|
| 63 |
|
/** |
| 64 |
|
* Assert that a given where condition matches a soft deleted record |
|
@@ 72-89 (lines=18) @@
|
| 69 |
|
* @param string $connection |
| 70 |
|
* @return $this |
| 71 |
|
*/ |
| 72 |
|
protected function seeIsSoftDeletedInDatabase($table, array $data, $connection = null) |
| 73 |
|
{ |
| 74 |
|
$database = $this->app->make('db'); |
| 75 |
|
|
| 76 |
|
$connection = $connection ?: $database->getDefaultConnection(); |
| 77 |
|
|
| 78 |
|
$count = $database->connection($connection) |
| 79 |
|
->table($table) |
| 80 |
|
->where($data) |
| 81 |
|
->whereNotNull('deleted_at') |
| 82 |
|
->count(); |
| 83 |
|
|
| 84 |
|
$this->assertGreaterThan(0, $count, sprintf( |
| 85 |
|
'Found unexpected records in database table [%s] that matched attributes [%s].', $table, json_encode($data) |
| 86 |
|
)); |
| 87 |
|
|
| 88 |
|
return $this; |
| 89 |
|
} |
| 90 |
|
} |
| 91 |
|
|