public function testResolve() { $documentIds = ['document_1', 'document_2']; $resolvedAggregations = ['aggregation_1']; $this->request->expects($this->atLeastOnce())->method('getIndex')->willReturn('specific_resolver'); $this->specificAggregationResolver->expects($this->once())->method('resolve')->with($this->request, $documentIds)->willReturn($resolvedAggregations); $this->assertEquals($resolvedAggregations, $this->aggregationResolver->resolve($this->request, $documentIds)); }
public function testBuildWithoutPassedDocuments() { $documentIds = [1, 2]; $tableName = 'table_name'; $select = $this->getMockBuilder(Select::class)->disableOriginalConstructor()->getMock(); $select->expects($this->once())->method('from')->with($tableName, TemporaryStorage::FIELD_ENTITY_ID)->willReturnSelf(); $this->table->expects($this->once())->method('getName')->willReturn($tableName); $this->connectionMock->expects($this->once())->method('select')->willReturn($select); $this->connectionMock->expects($this->once())->method('fetchCol')->willReturn($documentIds); $this->aggregationResolver->expects($this->once())->method('resolve')->with($this->request, $documentIds)->willReturn([]); $this->builder->build($this->request, $this->table); }