/**
  *
  * @Given /^I select from "([^"]*)" a date "([^"]*)"$/
  */
 public function iSelectFromADateDaysFromNow($cssQuery, $diff)
 {
     $items = $this->getPage()->findAll('css', $cssQuery);
     $fields = array();
     foreach ($items as $item) {
         $id = $item->getAttribute('id');
         if (substr($id, strlen($id) - strlen('year'), strlen($id)) == 'year') {
             $fields['year'] = $item;
             continue;
         }
         if (substr($id, strlen($id) - strlen('month'), strlen($id)) == 'month') {
             $fields['month'] = $item;
             continue;
         }
         if (substr($id, strlen($id) - strlen('day'), strlen($id)) == 'day') {
             $fields['day'] = $item;
             continue;
         }
     }
     WebTestCase::assertCount(3, $fields, 'Date fields could not be found!');
     WebTestCase::assertArrayHasKey('year', $fields, 'The year field could not be found!');
     WebTestCase::assertArrayHasKey('month', $fields, 'The month field could not be found!');
     WebTestCase::assertArrayHasKey('day', $fields, 'The day field could not be found!');
     $date = new \Datetime($diff);
     $filterFunc = function ($options, $has) {
         foreach ($options as $option) {
             if ($option->getText() == $has) {
                 return true;
             }
         }
         return false;
     };
     WebTestCase::assertTrue(call_user_func_array($filterFunc, array($fields['year']->findAll('css', 'option'), $date->format('Y'))));
     WebTestCase::assertTrue(call_user_func_array($filterFunc, array($fields['month']->findAll('css', 'option'), $date->format('M'))));
     WebTestCase::assertTrue(call_user_func_array($filterFunc, array($fields['day']->findAll('css', 'option'), $date->format('j'))));
     $fields['year']->selectOption($date->format('Y'));
     $fields['month']->selectOption($date->format('M'));
     $fields['day']->selectOption($date->format('j'));
 }