diff --git a/tests/Unit/Donations/Endpoints/TestListDonations.php b/tests/Unit/Donations/Endpoints/TestListDonations.php index 064f46d2f2..161743d897 100644 --- a/tests/Unit/Donations/Endpoints/TestListDonations.php +++ b/tests/Unit/Donations/Endpoints/TestListDonations.php @@ -67,6 +67,44 @@ public function testShouldReturnListWithSameData() $this->assertSame($expectedItems, $response->data['items']); } + /** + * @unreleased + * + * @return void + * @throws Exception + */ + public function testShouldFilterInvalidDateArgument_missingMonthDay() + { + $listDonation = give(ListDonations::class); + $key = 'start'; + $value = '2020'; + + $mockRequest = $this->getMockRequest(); + $mockRequest->set_param($key, $value); + + $response = $listDonation->validateDate($value, $mockRequest, $key); + $this->assertFalse($response); + } + + /** + * @unreleased + * + * @return void + * @throws Exception + */ + public function testShouldFilterInvalidDateArgument_InvalidChar() + { + $listDonation = give(ListDonations::class); + $key = 'start'; + $value = '2020-mar-02'; + + $mockRequest = $this->getMockRequest(); + $mockRequest->set_param($key, $value); + + $response = $listDonation->validateDate($value, $mockRequest, $key); + $this->assertFalse($response); + } + /** * * @since 2.25.0