/**
  * Negative test
  */
 public function testGetFilterNegativeApply()
 {
     $this->applierMock->expects($this->never())->method('apply')->willReturn(true);
     $this->appliersPoolMock->expects($this->once())->method('getApplier')->willReturn($this->applierMock);
     $mapper = new FilterMapper($this->appliersPoolMock, $this->braintreeSearchAdapterMock);
     $result = $mapper->getFilter('orderId', []);
     $this->assertEquals(null, $result);
 }
Beispiel #2
0
 /**
  * Apply conditions to filter
  *
  * @param object $fieldFilter
  * @param array $conditionMap
  * @return bool
  */
 private function applyConditions($fieldFilter, array $conditionMap)
 {
     $applier = $this->appliersPool->getApplier($fieldFilter);
     $conditionsAppliedCounter = 0;
     foreach ($conditionMap as $conditionKey => $value) {
         if ($applier->apply($fieldFilter, $conditionKey, $value)) {
             $conditionsAppliedCounter++;
         }
     }
     return $conditionsAppliedCounter > 0;
 }