コード例 #1
0
 /**
  * @param string $filterName
  * @param string $value
  *
  * @Then /^I filter by "([^"]*(?<!category))" with value "([^">=<]*)"$/
  */
 public function iFilterBy($filterName, $value)
 {
     if ($filterName === 'Channel') {
         $this->wait();
     }
     $operatorPattern = '/^(contains|does not contain|is equal to|(?:starts|ends) with|in list) ([^">=<]*)|^empty$/';
     $datePattern = '/^(more than|less than|between|not between) (\\d{4}-\\d{2}-\\d{2})( and )?(\\d{4}-\\d{2}-\\d{2})?$/';
     $operator = false;
     $matches = [];
     if (preg_match($datePattern, $value, $matches)) {
         $operator = $matches[1];
         $date = $matches[2];
         if (5 === count($matches)) {
             $date = [$date];
             $date[] = $matches[4];
         }
         $this->filterByDate($filterName, $date, $operator);
         $this->wait();
         return;
     }
     if (preg_match($operatorPattern, $value, $matches)) {
         if (count($matches) === 1) {
             $operator = $matches[0];
             $value = false;
         } else {
             $operator = $matches[1];
             $value = $matches[2];
         }
         $operators = ['contains' => Grid::FILTER_CONTAINS, 'does not contain' => Grid::FILTER_DOES_NOT_CONTAIN, 'is equal to' => Grid::FILTER_IS_EQUAL_TO, 'starts with' => Grid::FILTER_STARTS_WITH, 'ends with' => Grid::FILTER_ENDS_WITH, 'empty' => Grid::FILTER_IS_EMPTY, 'in list' => Grid::FILTER_IN_LIST];
         $operator = $operators[$operator];
     }
     $this->datagrid->filterBy($filterName, $value, $operator, $this->getSession()->getDriver());
     $this->wait();
 }
コード例 #2
0
 /**
  * @param string $filterName
  * @param string $operator
  * @param string $value
  *
  * @Then /^I filter by "(.*)" with operator "(.*)" and value "(.*)"$/
  */
 public function iFilterBy($filterName, $operator, $value)
 {
     $this->datagrid->filterBy($filterName, $operator, $value);
     $this->wait();
 }