ContactPage.php 676 Bytes
Newer Older
1 2
<?php

3
namespace tests\codeception\frontend\_pages;
4 5 6

use yii\codeception\BasePage;

7 8 9 10
/**
 * Represents contact page
 * @property \codeception_frontend\AcceptanceTester|\codeception_frontend\FunctionalTester $actor
 */
11 12
class ContactPage extends BasePage
{
13
    public $route = 'site/contact';
14

15 16 17 18 19 20 21
    /**
     * @param array $contactData
     */
    public function submit(array $contactData)
    {
        foreach ($contactData as $field => $value) {
            $inputType = $field === 'body' ? 'textarea' : 'input';
22
            $this->actor->fillField($inputType . '[name="ContactForm[' . $field . ']"]', $value);
23
        }
24
        $this->actor->click('contact-button');
25
    }
Mark committed
26
}