2017-11-06 18 views
1

属性は、私は私の機能テストでこれを持っている

<div id="mobilformbundle_customer_questionnaires_questionnaires"> 
    <div class="checkbox"> 
     <label class=""><input checked="checked" id="mobilformbundle_customer_questionnaires_questionnaires_4" name="mobilformbundle_customer_questionnaires[questionnaires][]" 
     type="checkbox" value="4"> questionnaire1</label> 
    </div> 
    <div class="checkbox"> 
     <label class=""><input checked="checked" id="mobilformbundle_customer_questionnaires_questionnaires_5" name="mobilformbundle_customer_questionnaires[questionnaires][]" 
     type="checkbox" value="5"> questionnaire2</label> 
    </div> 
    <div class="checkbox"> 
     <label class=""><input checked="checked" id="mobilformbundle_customer_questionnaires_questionnaires_6" name="mobilformbundle_customer_questionnaires[questionnaires][]" 
     type="checkbox" value="6"> questionnaire3</label> 
    </div> 
    <div class="checkbox"> 
     <label class=""><input id="mobilformbundle_customer_questionnaires_questionnaires_10" name="mobilformbundle_customer_questionnaires[questionnaires][]" 
     type="checkbox" value="10"> generic questionnaire</label> 
    </div> 
</div> 

あなたが見ることができるように最初の3つのボックスがチェックされます(HTML属性checkedの値はcheckedです)。

;test 0: with value=4 checked=checked should be=1 mobilformbundle_customer_questionnaires_questionnaires_4 
;test 1: with value=5 checked= should be=1 mobilformbundle_customer_questionnaires_questionnaires_5 

Expected :'checked' 
Actual :'' 

$checked PHP変数が空である理由を私は理解していない:

は、ここに私のテストの出力です。それにはcheckedが含まれている必要があります。

ループに何らかのエラーがありますか?

+0

ループは私によく見えます。やや奇妙なええ? – jaswrks

答えて

0

$this->crawlerオブジェクトは前回のリクエストからのものです。

$this->client->submit($form, $formData); 

私はこの(私が貼り付けただけのコードブロックの上に声明を)置き換える

$this->crawler = $this->client->submit($form, $formData); 

、それが働いた:

;test 0: with value=4 checked=checked should be=1 mobilformbundle_customer_questionnaires_questionnaires_4 
;test 1: with value=5 checked=checked should be=1 mobilformbundle_customer_questionnaires_questionnaires_5 
;test 2: with value=6 checked=checked should be= mobilformbundle_customer_questionnaires_questionnaires_6 
;test 3: with value=10 checked= should be= mobilformbundle_customer_questionnaires_questionnaires_10 

テストに合格します!

申し訳ありません。気をつけて投票してください。

関連する問題