2013-12-02 15:25:21 +04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace tests\_pages;
|
|
|
|
|
2013-12-17 00:27:33 +01:00
|
|
|
use yii\codeception\BasePage;
|
2013-12-02 15:25:21 +04:00
|
|
|
|
2013-12-17 00:27:33 +01:00
|
|
|
class ContactPage extends BasePage
|
|
|
|
{
|
2013-12-17 23:43:43 -05:00
|
|
|
public $route = 'site/contact';
|
2013-12-02 15:25:21 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param array $contactData
|
|
|
|
*/
|
|
|
|
public function submit(array $contactData)
|
|
|
|
{
|
2014-02-07 05:22:11 +04:00
|
|
|
foreach ($contactData as $field => $value) {
|
|
|
|
if (in_array($field, ['name','email','subject','verifyCode'])) {
|
|
|
|
$this->guy->fillField('input[name="ContactForm[' . $field .']"]', $value);
|
|
|
|
}
|
2013-12-02 15:25:21 +04:00
|
|
|
}
|
2014-02-07 05:22:11 +04:00
|
|
|
|
|
|
|
if (isset($contactData['body'])) {
|
|
|
|
$this->guy->fillField('textarea[name="ContactForm[body]"]',$contactData['body']);
|
|
|
|
}
|
|
|
|
$this->guy->click('Submit','#contact-form');
|
2013-12-02 15:25:21 +04:00
|
|
|
}
|
|
|
|
}
|