From 355de32c47c2ad2a693e5d43b5ec2cb63ff30631 Mon Sep 17 00:00:00 2001 From: "a.shamavov" <a.shamavov@iqdev.digital> Date: Tue, 4 Mar 2025 16:06:33 +0500 Subject: [PATCH] =?UTF-8?q?tests:=20=D0=9D=D0=B5=D0=B1=D0=BE=D0=BB=D1=8C?= =?UTF-8?q?=D1=88=D0=B8=D0=B5=20=D0=BF=D1=80=D0=B0=D0=B2=D0=BA=D0=B8=20?= =?UTF-8?q?=D1=82=D0=B5=D1=81=D1=82=D0=BE=D0=B2=20=D1=81=20=D0=B4=D0=B0?= =?UTF-8?q?=D1=82=D0=B0=D0=BC=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.json | 3 +-- tests/FilterByDateRangeTest.php | 6 +++--- tests/FilterByDateTest.php | 8 ++++---- tests/TestCase.php | 2 -- 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/composer.json b/composer.json index 5c38462..9a44ded 100644 --- a/composer.json +++ b/composer.json @@ -5,8 +5,7 @@ "require": { "php": "^8.3", "symfony/http-foundation": "^7.2.3", - "doctrine/orm": "^3.3.2", - "beberlei/doctrineextensions": "^1.5" + "doctrine/orm": "^3.3.2" }, "require-dev": { "phpunit/phpunit": "^12.0", diff --git a/tests/FilterByDateRangeTest.php b/tests/FilterByDateRangeTest.php index 114933c..acb4a4b 100644 --- a/tests/FilterByDateRangeTest.php +++ b/tests/FilterByDateRangeTest.php @@ -225,7 +225,9 @@ class FilterByDateRangeTest extends TestCase /** @var PostRepository $postRepository */ $postRepository = $this->em->getRepository(Post::class); - $result = $postRepository->createQueryByFilter([ + $this->expectException(FilterParameterValueIsNullException::class); + + $postRepository->createQueryByFilter([ 'createdAt' => DateRange::class, ], new Request([ HttpFilter::REQUEST_FILTER_KEY => [ @@ -237,8 +239,6 @@ class FilterByDateRangeTest extends TestCase ])) ->getQuery() ->getResult(); - - $this->assertEmpty($result); } public function testFilterDateRangeWithDifferentKey(): void diff --git a/tests/FilterByDateTest.php b/tests/FilterByDateTest.php index 887fcf9..deba304 100644 --- a/tests/FilterByDateTest.php +++ b/tests/FilterByDateTest.php @@ -95,7 +95,7 @@ class FilterByDateTest extends TestCase $this->assertEquals($date, current($result)->createdAt); } - public function testSuccessFilterDateRangeWithSeveralResults(): void + public function testSuccessFilterDateWithSeveralResults(): void { /** @var PostRepository $postRepository */ $postRepository = $this->em->getRepository(Post::class); @@ -194,7 +194,9 @@ class FilterByDateTest extends TestCase /** @var PostRepository $postRepository */ $postRepository = $this->em->getRepository(Post::class); - $result = $postRepository->createQueryByFilter([ + $this->expectException(FilterParameterValueIsNullException::class); + + $postRepository->createQueryByFilter([ 'createdAt' => Date::class, ], new Request([ HttpFilter::REQUEST_FILTER_KEY => [ @@ -203,8 +205,6 @@ class FilterByDateTest extends TestCase ])) ->getQuery() ->getResult(); - - $this->assertEmpty($result); } public function testFilterDateWithDifferentKey(): void diff --git a/tests/TestCase.php b/tests/TestCase.php index bdb1212..0e63318 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -12,7 +12,6 @@ use Doctrine\ORM\EntityManager; use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\ORMSetup; use Doctrine\ORM\Tools\SchemaTool; -use DoctrineExtensions\Query\Sqlite\StrfTime; use Faker\Factory; use Faker\Generator; use IQDEV\Packages\DoctrineHttpFilter\HttpFilterEntityRepository; @@ -60,7 +59,6 @@ abstract class TestCase extends BaseTestCase [__DIR__ . '/Entity'], true, ); - $config->addCustomStringFunction('strftime', StrfTime::class); $connection = DriverManager::getConnection([ 'driver' => 'pdo_sqlite', -- GitLab