Beispiel #1
0
 /**
  * Test the functionality.
  *
  * @param array  $data       The data for the attribute.
  *
  * @param array  $ruleValues The url values.
  *
  * @param array  $expected   The expected ids.
  *
  * @param string $message    The assert message.
  *
  * @return void
  *
  * @dataProvider provider
  */
 public function testFunctionality($data, $ruleValues, $expected, $message)
 {
     $rule = new FromTo($this->mockAttribute($this->mockMetaModel(), $data));
     if (isset($ruleValues['lowerBound'])) {
         $rule->setLowerBound($ruleValues['lowerBound'], isset($ruleValues['lowerInclusive']) ?: false);
     }
     if (isset($ruleValues['upperBound'])) {
         $rule->setUpperBound($ruleValues['upperBound'], isset($ruleValues['upperInclusive']) ?: false);
     }
     $this->assertEquals($expected, $rule->getMatchingIds(), $message);
 }
 /**
  * {@inheritDoc}
  */
 protected function evaluateUpperBound()
 {
     // If we are using time filtering, we have to handle it differently.
     if ($this->dateType == 'time') {
         if ($this->getUpperBound()) {
             return $this->runSimpleQuery($this->isUpperInclusive() ? '<=' : '<', date('H:i:s', $this->getUpperBound()));
         }
         return null;
     }
     return parent::evaluateUpperBound();
 }