2013-12-02 15:25:21 +04:00
|
|
|
<?php
|
|
|
|
|
2014-08-24 14:14:35 +04:00
|
|
|
namespace tests\codeception\_pages;
|
2013-12-02 15:25:21 +04:00
|
|
|
|
2013-12-17 00:27:33 +01:00
|
|
|
use yii\codeception\BasePage;
|
2013-12-02 15:25:21 +04:00
|
|
|
|
2014-08-16 18:15:41 +04:00
|
|
|
/**
|
|
|
|
* Represents contact page
|
|
|
|
* @property \AcceptanceTester|\FunctionalTester $actor
|
|
|
|
*/
|
2013-12-17 00:27:33 +01:00
|
|
|
class ContactPage extends BasePage
|
|
|
|
{
|
2014-03-16 10:46:16 +06:00
|
|
|
public $route = 'site/contact';
|
2013-12-02 15:25:21 +04:00
|
|
|
|
2014-03-16 10:46:16 +06:00
|
|
|
/**
|
|
|
|
* @param array $contactData
|
|
|
|
*/
|
|
|
|
public function submit(array $contactData)
|
|
|
|
{
|
|
|
|
foreach ($contactData as $field => $value) {
|
|
|
|
$inputType = $field === 'body' ? 'textarea' : 'input';
|
2014-08-16 18:15:41 +04:00
|
|
|
$this->actor->fillField($inputType . '[name="ContactForm[' . $field . ']"]', $value);
|
2014-03-16 10:46:16 +06:00
|
|
|
}
|
2014-08-16 18:15:41 +04:00
|
|
|
$this->actor->click('contact-button');
|
2014-03-16 10:46:16 +06:00
|
|
|
}
|
2013-12-02 15:25:21 +04:00
|
|
|
}
|