2013-12-02 19:25:21 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace tests\_pages;
|
|
|
|
|
2013-12-17 07:27:33 +08:00
|
|
|
use yii\codeception\BasePage;
|
2013-12-02 19:25:21 +08:00
|
|
|
|
2013-12-17 07:27:33 +08:00
|
|
|
class ContactPage extends BasePage
|
|
|
|
{
|
2013-12-18 12:43:43 +08:00
|
|
|
public $route = 'site/contact';
|
2013-12-02 19:25:21 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param array $contactData
|
|
|
|
*/
|
|
|
|
public function submit(array $contactData)
|
|
|
|
{
|
2014-02-07 09:22:11 +08:00
|
|
|
foreach ($contactData as $field => $value) {
|
2014-02-07 09:39:55 +08:00
|
|
|
$inputType = $field === 'body' ? 'textarea' : 'input';
|
|
|
|
$this->guy->fillField($inputType . '[name="ContactForm[' . $field . ']"]', $value);
|
2013-12-02 19:25:21 +08:00
|
|
|
}
|
2014-02-14 08:37:49 +08:00
|
|
|
$this->guy->click('#contact-form input[type=submit]');
|
2013-12-02 19:25:21 +08:00
|
|
|
}
|
|
|
|
}
|