public function testComputesResultsFromUsingMostApplicableParentRequest()
{
$sourceExpression = $this->queryable->getExpression();
$this->queryResultsCollection->saveResults($sourceExpression, \Pinq\Traversable::from([1])->select(function () {
$this->assertTrue(false, 'Source expression results should not be called');
})->getIterator());
$subscopeQueryable = $this->queryable->skip(5);
$this->queryResultsCollection->saveResults($subscopeQueryable->getExpression(), [5, 6, 7, 8, 0]);
$subSubscopeQueryable = $subscopeQueryable->select(function ($i) {
return $i * 10;
})->indexBy(function ($i) {
return $i / 5;
});
$this->assertTrue($this->queryResultsCollection->tryComputeResults($subSubscopeQueryable->getExpression(), $results));
$this->assertInstanceOf(ITraversable::ITRAVERSABLE_TYPE, $results);
/** @var $results ITraversable */
$this->assertSame([10 => 50, 12 => 60, 14 => 70, 16 => 80, 0 => 0], $results->asArray());
}