2016-06-23 2 views
0

입력란에 필드를 채울 때 날짜를 입력하는 방법은 있습니까?Behat "다음 필드를 채울 때"오늘 날짜를 입력 하시겠습니까?

예를 들어

나는 다음과 같은 필드 을 채우 감안할 | field_date | 오늘 |

내가 일/월/YYYY로 출력을 원하는

나는 그것을 찾거나 찾을 수 없습니다 이유를 이해하지 못할 전에 이런 짓을 한 다른 사람?

/** 
* Fills in specified field with date 
* Example: When I fill in "field_ID" with date "now" 
* Example: When I fill in "field_ID" with date "-7 days" 
* Example: When I fill in "field_ID" with date "+7 days" 
* Example: When I fill in "field_ID" with date "-/+0 weeks" 
* Example: When I fill in "field_ID" with date "-/+0 years" 
* 
* @When /^(?:|I)fill in "(?P<field>(?:[^"]|\\")*)" with date "(?P<value>(?:[^"]|\\")*)"$/ 
*/ 
public function fillDateField($field, $value) 
{ 
    $newDate = strtotime("$value"); 

    $dateToSet = date("d/m/Y", $newDate); 
    $this->getSession()->getPage()->fillField($field, $dateToSet); 
} 
+0

당신이 할 수있는 - 나는 당신의 FormContext 파일이 추가 ...이 작업을 얻을 수 있었다 ..

감사 – lauda

답변

0

을 작은 오이, 오이,하지만 PHP와 behat에 대한 아무것도에 대한 답을 발견했다 또한 날짜 선택 도구가있는 경우 jQuery를 사용하십시오.