mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-14 06:14:23 +00:00
Add new Abstract Aggregator Test to check qb aliases (for join clauses)
This commit is contained in:
parent
ab5ca48968
commit
eb6efcefd8
@ -62,6 +62,18 @@ abstract class AbstractAggregatorTest extends KernelTestCase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* provide data for `testAliasDidNotDisappears`.
|
||||||
|
*/
|
||||||
|
public function dataProviderAliasDidNotDisappears()
|
||||||
|
{
|
||||||
|
foreach ($this->getQueryBuilders() as $qb) {
|
||||||
|
foreach ($this->getFormData() as $data) {
|
||||||
|
yield [clone $qb, $data];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an aggregator instance which will be used in tests.
|
* Create an aggregator instance which will be used in tests.
|
||||||
*
|
*
|
||||||
@ -256,4 +268,29 @@ abstract class AbstractAggregatorTest extends KernelTestCase
|
|||||||
'test that the title is not empty'
|
'test that the title is not empty'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compare aliases array before and after that aggregator alter query
|
||||||
|
*
|
||||||
|
* @dataProvider dataProviderAliasDidNotDisappears
|
||||||
|
*
|
||||||
|
* @param QueryBuilder $qb
|
||||||
|
* @param array $data
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testAliasDidNotDisappears(QueryBuilder $qb, array $data)
|
||||||
|
{
|
||||||
|
$aliases = $qb->getAllAliases();
|
||||||
|
|
||||||
|
$this->getAggregator()->alterQuery($qb, $data);
|
||||||
|
|
||||||
|
$alteredQuery = $qb->getAllAliases();
|
||||||
|
|
||||||
|
$this->assertGreaterThanOrEqual(count($aliases), count($alteredQuery));
|
||||||
|
|
||||||
|
foreach ($aliases as $alias) {
|
||||||
|
$this->assertContains($alias, $alteredQuery);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user