ContactPage.php 534 B

12345678910111213141516171819202122232425
  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. if ($field == 'body') {
  14. $this->guy->fillField('textarea[name="ContactForm[' . $field . ']"]', $value);
  15. } else {
  16. $this->guy->fillField('input[name="ContactForm[' . $field .']"]', $value);
  17. }
  18. }
  19. $this->guy->click('Submit','#contact-form');
  20. }
  21. }