diff --git a/Test/Export/AbstractAggregatorTest.php b/Test/Export/AbstractAggregatorTest.php index a1f0cf60a..d33a6f88d 100644 --- a/Test/Export/AbstractAggregatorTest.php +++ b/Test/Export/AbstractAggregatorTest.php @@ -213,7 +213,7 @@ abstract class AbstractAggregatorTest extends KernelTestCase $nbOfFrom = $query->getDQLPart('from') !== null ? count($query->getDQLPart('from')) : 0; $nbOfWhere = $query->getDQLPart('where') !== null ? - count($query->getDQLPart('where')) : 0; + $query->getDQLPart('where')->count() : 0; $nbOfSelect = $query->getDQLPart('select') !== null ? count($query->getDQLPart('select')) : 0; @@ -226,7 +226,7 @@ abstract class AbstractAggregatorTest extends KernelTestCase altered the query"); $this->assertGreaterThanOrEqual( $nbOfWhere, - $query->getDQLPart('where') !== null ? count($query->getDQLPart('where')) : 0, + $query->getDQLPart('where') !== null ? $query->getDQLPart('where')->count() : 0, "Test that there are equal or more 'where' clause after that the filter has" . "altered the query"); $this->assertGreaterThanOrEqual( diff --git a/Test/Export/AbstractFilterTest.php b/Test/Export/AbstractFilterTest.php index c16bfb8c0..dd8f5df04 100644 --- a/Test/Export/AbstractFilterTest.php +++ b/Test/Export/AbstractFilterTest.php @@ -104,20 +104,32 @@ abstract class AbstractFilterTest extends KernelTestCase public function testAlterQuery(QueryBuilder $query, $data) { // retains informations about query - $nbOfFrom = count($query->getDQLPart('from')); - $nbOfWhere = count($query->getDQLPart('where')); - $nbOfSelect = count($query->getDQLPart('select')); + $nbOfFrom = $query->getDQLPart('from') !== null ? + count($query->getDQLPart('from')) : 0; + $nbOfWhere = $query->getDQLPart('where') !== null ? + $query->getDQLPart('where')->count() : 0; + $nbOfSelect = $query->getDQLPart('select') !== null ? + count($query->getDQLPart('select')) : 0; $this->getFilter()->alterQuery($query, $data); - $this->assertGreaterThanOrEqual($nbOfFrom, count($query->getDQLPart('from')), + $this->assertGreaterThanOrEqual( + $nbOfFrom, + $query->getDQLPart('from') !== null ? count($query->getDQLPart('from')) : 0, "Test that there are equal or more 'from' clause after that the filter has - altered the query"); - $this->assertGreaterThanOrEqual($nbOfWhere, count($query->getDQLPart('where')), + altered the query" + ); + $this->assertGreaterThanOrEqual( + $nbOfWhere, + $query->getDQLPart('where') !== null ? count($query->getDQLPart('where')) : 0, "Test that there are equal or more 'where' clause after that the filter has" - . "altered the query"); - $this->assertEquals($nbOfSelect, count($query->getDQLPart('select')), - "Test that the filter has no altered the 'select' part of the query"); + . "altered the query" + ); + $this->assertEquals( + $nbOfSelect, + $query->getDQLPart('select') !== null ? count($query->getDQLPart('select')) : 0, + "Test that the filter has no altered the 'select' part of the query" + ); }