ContactPage.php 1.32 KB
Newer Older
Mark committed
1 2 3 4
<?php

namespace tests\_pages;

5
use yii\codeception\BasePage;
Mark committed
6

7 8
class ContactPage extends BasePage
{
9
	public $route = 'site/contact';
Mark committed
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49

	/**
	 * contact form name text field locator
	 * @var string 
	 */
	public $name = 'input[name="ContactForm[name]"]';
	/**
	 * contact form email text field locator
	 * @var string
	 */
	public $email = 'input[name="ContactForm[email]"]';
	/**
	 * contact form subject text field locator
	 * @var string
	 */
	public $subject = 'input[name="ContactForm[subject]"]';
	/**
	 * contact form body textarea locator
	 * @var string
	 */
	public $body = 'textarea[name="ContactForm[body]"]';
	/**
	 * contact form verification code text field locator
	 * @var string
	 */
	public $verifyCode = 'input[name="ContactForm[verifyCode]"]';
	/**
	 * contact form submit button
	 * @var string
	 */
	public $button = 'button[type=submit]';

	/**
	 * 
	 * @param array $contactData
	 */
	public function submit(array $contactData)
	{
		if (!empty($contactData))
		{
50 51 52 53 54
			$this->guy->fillField($this->name, $contactData['name']);
			$this->guy->fillField($this->email, $contactData['email']);
			$this->guy->fillField($this->subject, $contactData['subject']);
			$this->guy->fillField($this->body, $contactData['body']);
			$this->guy->fillField($this->verifyCode, $contactData['verifyCode']);
Mark committed
55 56 57 58
		}
		$this->guy->click($this->button);
	}
}