Example #1
0
 /**
  * @param string $field
  * @param string $value
  * @param bool $isNegation
  * @param string $expectedResult
  * @dataProvider buildQueryDataProvider
  */
 public function testBuildQuery($field, $value, $isNegation, $expectedResult)
 {
     $this->requestFilter->expects($this->once())->method('getField')->will($this->returnValue($field));
     $this->requestFilter->expects($this->atLeastOnce())->method('getValue')->will($this->returnValue($value));
     $actualResult = $this->filter->buildFilter($this->requestFilter, $isNegation);
     $this->assertEquals($expectedResult, $actualResult);
 }
Example #2
0
 /**
  * @param string $field
  * @param string $value
  * @param string $expectedResult
  * @dataProvider buildQueryDataProvider
  */
 public function testBuildQuery($field, $value, $expectedResult)
 {
     $this->requestFilter->expects($this->once())->method('getField')->will($this->returnValue($field));
     $this->requestFilter->expects($this->once())->method('getValue')->will($this->returnValue($value));
     $this->adapter->expects($this->once())->method('quote')->will($this->returnArgument(0));
     $actualResult = $this->filter->buildFilter($this->requestFilter);
     $this->assertEquals($expectedResult, $actualResult);
 }
 /**
  * @param string $field
  * @param string $from
  * @param string $to
  * @param string $expectedResult
  * @dataProvider buildQueryDataProvider
  */
 public function testBuildQuery($field, $from, $to, $expectedResult)
 {
     $this->requestFilter->expects($this->once())->method('getField')->will($this->returnValue($field));
     $this->requestFilter->expects($this->once())->method('getFrom')->will($this->returnValue($from));
     $this->requestFilter->expects($this->once())->method('getTo')->will($this->returnValue($to));
     $this->adapter->expects($this->any())->method('quote')->will($this->returnCallback(function ($value) {
         return '\'' . $value . '\'';
     }));
     $actualResult = $this->filter->buildFilter($this->requestFilter);
     $this->assertEquals($expectedResult, $actualResult);
 }