-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #423 from meilisearch/bump-meilisearch-v0.30.0-add…
…-delete-tasks Add `deleteTasks` method
- Loading branch information
Showing
5 changed files
with
86 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace MeiliSearch\Contracts; | ||
|
||
use MeiliSearch\Delegates\TasksQueryTrait; | ||
|
||
class DeleteTasksQuery | ||
{ | ||
use TasksQueryTrait; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Tests\Contracts; | ||
|
||
use MeiliSearch\Contracts\TasksQuery; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
class DeleteTasksQueryTest extends TestCase | ||
{ | ||
public function testSetTypes(): void | ||
{ | ||
$data = (new TasksQuery())->setTypes(['abc', 'xyz']); | ||
|
||
$this->assertEquals($data->toArray(), ['types' => 'abc,xyz']); | ||
} | ||
|
||
public function testSetNext(): void | ||
{ | ||
$data = (new TasksQuery())->setNext(99); | ||
|
||
$this->assertEquals($data->toArray(), ['next' => 99]); | ||
} | ||
|
||
public function testSetAnyDateFilter(): void | ||
{ | ||
$date = new \DateTime(); | ||
$data = (new TasksQuery())->setBeforeEnqueuedAt($date); | ||
|
||
$this->assertEquals($data->toArray(), ['beforeEnqueuedAt' => $date->format(\DateTime::RFC3339)]); | ||
} | ||
|
||
public function testToArrayWithSetNextWithZero(): void | ||
{ | ||
$data = (new TasksQuery())->setNext(0); | ||
|
||
$this->assertEquals($data->toArray(), ['next' => 0]); | ||
} | ||
|
||
public function testToArrayWithDifferentSets(): void | ||
{ | ||
$data = (new TasksQuery())->setFrom(10)->setLimit(9)->setNext(99)->setStatuses(['enqueued']); | ||
|
||
$this->assertEquals($data->toArray(), [ | ||
'limit' => 9, 'next' => 99, 'from' => 10, 'statuses' => 'enqueued', | ||
]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters