ContactPage.php 468 B

12345678910111213141516171819202122
  1. <?php
  2. namespace tests\_pages;
  3. use yii\codeception\BasePage;
  4. class ContactPage extends BasePage
  5. {
  6. public $route = 'site/contact';
  7. /**
  8. * @param array $contactData
  9. */
  10. public function submit(array $contactData)
  11. {
  12. foreach ($contactData as $field => $value) {
  13. $inputType = ($field == 'body') ? 'textarea' : 'input';
  14. $this->guy->fillField($inputType.'[name="ContactForm[' . $field . ']"]', $value);
  15. }
  16. $this->guy->click('Submit','#contact-form');
  17. }
  18. }