public function testOperationTemplateWithStructuralParametersAllCompiledQueriesIsCached()
{
foreach (['abcdef', 'qwerty123', 'bbvvcc'] as $varName) {
$expression = $this->parseQueryExpression(function (IRepository $repository) use($varName) {
$repository->take(5)->join([])->apply(function (&$i, $o) use($varName) {
$i /= ${$varName};
});
}, $evaluationContext);
$this->loadCompiledOperationQuery($expression, $evaluationContext);
}
//Should contain operation template + 3 compiled queries
$this->assertCount(4, $this->compiledQueryCache->getCachedArray());
$this->assertInCache(new CompiledQuery(<<<'ENG'
Starting from and up to the specified element
Join with: [array or iterator] and update the outer values according to: { $i /= $abcdef; } with parameters: [$this, $varName]
ENG
));
$this->assertInCache(new CompiledQuery(<<<'ENG'
Starting from and up to the specified element
Join with: [array or iterator] and update the outer values according to: { $i /= $qwerty123; } with parameters: [$this, $varName]
ENG
));
$this->assertInCache(new CompiledQuery(<<<'ENG'
Starting from and up to the specified element
Join with: [array or iterator] and update the outer values according to: { $i /= $bbvvcc; } with parameters: [$this, $varName]
ENG
));
$this->assertContainsInstanceofInCache('Pinq\\Providers\\DSL\\Compilation\\IOperationTemplate');
}