Skip to content

Commit 9894c2c

Browse files
[9.x] Remove assertDeleted (#39661)
* Remove assertDeleted * Correct names
1 parent cea563d commit 9894c2c

File tree

2 files changed

+2
-45
lines changed

2 files changed

+2
-45
lines changed

src/Illuminate/Foundation/Testing/Concerns/InteractsWithDatabase.php

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -68,25 +68,6 @@ protected function assertDatabaseCount($table, int $count, $connection = null)
6868
return $this;
6969
}
7070

71-
/**
72-
* Assert the given record has been deleted.
73-
*
74-
* @param \Illuminate\Database\Eloquent\Model|string $table
75-
* @param array $data
76-
* @param string|null $connection
77-
* @return $this
78-
*/
79-
protected function assertDeleted($table, array $data = [], $connection = null)
80-
{
81-
if ($table instanceof Model) {
82-
return $this->assertDatabaseMissing($table->getTable(), [$table->getKeyName() => $table->getKey()], $table->getConnectionName());
83-
}
84-
85-
$this->assertDatabaseMissing($this->getTable($table), $data, $connection);
86-
87-
return $this;
88-
}
89-
9071
/**
9172
* Assert the given record has been "soft deleted".
9273
*

tests/Foundation/FoundationInteractsWithDatabaseTest.php

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -143,14 +143,14 @@ public function testAssertTableEntriesCountWrong()
143143
$this->assertDatabaseCount($this->table, 3);
144144
}
145145

146-
public function testAssertDeletedPassesWhenDoesNotFindResults()
146+
public function testAssertDatabaseMissingPassesWhenDoesNotFindResults()
147147
{
148148
$this->mockCountBuilder(0);
149149

150150
$this->assertDatabaseMissing($this->table, $this->data);
151151
}
152152

153-
public function testAssertDeletedFailsWhenFindsResults()
153+
public function testAssertDatabaseMissingFailsWhenFindsResults()
154154
{
155155
$this->expectException(ExpectationFailedException::class);
156156

@@ -161,17 +161,6 @@ public function testAssertDeletedFailsWhenFindsResults()
161161
$this->assertDatabaseMissing($this->table, $this->data);
162162
}
163163

164-
public function testAssertDeletedPassesWhenDoesNotFindModelResults()
165-
{
166-
$this->data = ['id' => 1];
167-
168-
$builder = $this->mockCountBuilder(0);
169-
170-
$builder->shouldReceive('get')->andReturn(collect());
171-
172-
$this->assertDeleted(new ProductStub($this->data));
173-
}
174-
175164
public function testAssertModelMissingPassesWhenDoesNotFindModelResults()
176165
{
177166
$this->data = ['id' => 1];
@@ -183,19 +172,6 @@ public function testAssertModelMissingPassesWhenDoesNotFindModelResults()
183172
$this->assertModelMissing(new ProductStub($this->data));
184173
}
185174

186-
public function testAssertDeletedFailsWhenFindsModelResults()
187-
{
188-
$this->expectException(ExpectationFailedException::class);
189-
190-
$this->data = ['id' => 1];
191-
192-
$builder = $this->mockCountBuilder(1);
193-
194-
$builder->shouldReceive('get')->andReturn(collect([$this->data]));
195-
196-
$this->assertDeleted(new ProductStub($this->data));
197-
}
198-
199175
public function testAssertSoftDeletedInDatabaseFindsResults()
200176
{
201177
$this->mockCountBuilder(1);

0 commit comments

Comments
 (0)