ContactPage.php 625 Bytes
Newer Older
Mark committed
1 2
<?php

3
namespace tests\codeception\_pages;
Mark committed
4

5
use yii\codeception\BasePage;
Mark committed
6

7 8 9 10
/**
 * Represents contact page
 * @property \AcceptanceTester|\FunctionalTester $actor
 */
11 12
class ContactPage extends BasePage
{
13
    public $route = 'site/contact';
Mark committed
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
}