From e69fa275f01c762ee611590fa2dd2e6e1c04cb93 Mon Sep 17 00:00:00 2001 From: Daniel Bosen Date: Wed, 21 Aug 2024 10:40:42 +0200 Subject: [PATCH] add condition test --- .../DataProducer/ThunderSearchApiTest.php | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/modules/thunder_gqls/tests/src/Functional/DataProducer/ThunderSearchApiTest.php b/modules/thunder_gqls/tests/src/Functional/DataProducer/ThunderSearchApiTest.php index 52fce2598..b29faaa49 100644 --- a/modules/thunder_gqls/tests/src/Functional/DataProducer/ThunderSearchApiTest.php +++ b/modules/thunder_gqls/tests/src/Functional/DataProducer/ThunderSearchApiTest.php @@ -43,10 +43,8 @@ public function testThunderSearchApi(): void { ]; $result = $this->executeDataProducer('thunder_search_api', $options); - $this->assertEquals(3, $result->total()); - /** @var \GraphQL\Deferred $items */ $items = $result->items(); $items->runQueue(); $this->assertEquals('Burda Launches Open-Source CMS Thunder', $items->result[0]->getTitle()); @@ -61,10 +59,27 @@ public function testThunderSearchApi(): void { $this->container->get('kernel')->rebuildContainer(); $result = $this->executeDataProducer('thunder_search_api', $options); - /** @var \GraphQL\Deferred $items */ + $items = $result->items(); $items->runQueue(); $this->assertEquals('Legal notice', $items->result[0]->getTitle()); + + // Get articles only + $options['conditions'] = [ + [ + 'field' => 'type', + 'value' => 'article', + 'operator' => '=', + ], + ]; + + $this->container->get('kernel')->rebuildContainer(); + $result = $this->executeDataProducer('thunder_search_api', $options); + + $items = $result->items(); + $items->runQueue(); + $this->assertEquals('Come to DrupalCon New Orleans', $items->result[0]->getTitle()); + } }