mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-07-01 22:46:13 +00:00
fix error on exports test
Since php 7.2, the count function does not accept NULL values. This led to error if the WHERE clause of query where empty.
This commit is contained in:
parent
f881b3e52a
commit
c593c153a1
@ -210,19 +210,28 @@ abstract class AbstractAggregatorTest 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 ?
|
||||
count($query->getDQLPart('where')) : 0;
|
||||
$nbOfSelect = $query->getDQLPart('select') !== null ?
|
||||
count($query->getDQLPart('select')) : 0;
|
||||
|
||||
$this->getAggregator()->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')),
|
||||
$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->assertGreaterThanOrEqual($nbOfSelect, count($query->getDQLPart('select')),
|
||||
$this->assertGreaterThanOrEqual(
|
||||
$nbOfSelect,
|
||||
$query->getDQLPart('select') !== null ? count($query->getDQLPart('select')) : 0,
|
||||
"Test that the filter has no altered the 'select' part of the query");
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user