Skip to content

Commit 6bab035

Browse files
committed
PHPORM-231 Remove MongoFailedJobProvider
1 parent ebda1fa commit 6bab035

File tree

4 files changed

+13
-198
lines changed

4 files changed

+13
-198
lines changed

src/MongoDBQueueServiceProvider.php

Lines changed: 0 additions & 68 deletions
This file was deleted.

src/Query/Builder.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -876,11 +876,11 @@ public function delete($id = null)
876876
$wheres = $this->aliasIdForQuery($wheres);
877877
$options = $this->inheritConnectionOptions();
878878

879-
if (is_int($this->limit)) {
880-
if ($this->limit !== 1) {
881-
throw new LogicException(sprintf('Delete limit can be 1 or null (unlimited). Got %d', $this->limit));
882-
}
883-
879+
/**
880+
* Ignore the limit if it is set to more than 1, as it is not supported by the deleteMany method.
881+
* Required for {@see DatabaseFailedJobProvider::prune()}
882+
*/
883+
if ($this->limit === 1) {
884884
$result = $this->collection->deleteOne($wheres, $options);
885885
} else {
886886
$result = $this->collection->deleteMany($wheres, $options);

src/Queue/Failed/MongoFailedJobProvider.php

Lines changed: 0 additions & 119 deletions
This file was deleted.

tests/Queue/Failed/MongoFailedJobProviderTest.php renamed to tests/Queue/Failed/DatabaseFailedJobProviderTest.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,22 @@
22

33
namespace MongoDB\Laravel\Tests\Queue\Failed;
44

5+
use Illuminate\Queue\Failed\DatabaseFailedJobProvider;
56
use Illuminate\Support\Facades\Date;
67
use Illuminate\Support\Facades\DB;
78
use MongoDB\BSON\ObjectId;
89
use MongoDB\BSON\UTCDateTime;
9-
use MongoDB\Laravel\Queue\Failed\MongoFailedJobProvider;
1010
use MongoDB\Laravel\Tests\TestCase;
1111
use OutOfBoundsException;
1212

1313
use function array_map;
1414
use function range;
1515
use function sprintf;
1616

17-
class MongoFailedJobProviderTest extends TestCase
17+
/**
18+
* Ensure the Laravel class {@see DatabaseFailedJobProvider} works with a MongoDB connection.
19+
*/
20+
class DatabaseFailedJobProviderTest extends TestCase
1821
{
1922
public function setUp(): void
2023
{
@@ -57,8 +60,7 @@ public function testLog(): void
5760
$this->assertSame('default', $inserted->queue);
5861
$this->assertSame('{"foo":"bar"}', $inserted->payload);
5962
$this->assertStringContainsString('OutOfBoundsException: This is the error', $inserted->exception);
60-
$this->assertInstanceOf(ObjectId::class, $inserted->_id);
61-
$this->assertSame((string) $inserted->_id, $inserted->id);
63+
$this->assertInstanceOf(ObjectId::class, $inserted->id);
6264
}
6365

6466
public function testCount(): void
@@ -143,8 +145,8 @@ public function testPrune(): void
143145
$this->assertEquals(3, $provider->count());
144146
}
145147

146-
private function getProvider(): MongoFailedJobProvider
148+
private function getProvider(): DatabaseFailedJobProvider
147149
{
148-
return new MongoFailedJobProvider(DB::getFacadeRoot(), '', 'failed_jobs');
150+
return new DatabaseFailedJobProvider(DB::getFacadeRoot(), '', 'failed_jobs');
149151
}
150152
}

0 commit comments

Comments
 (0)