ContactCept.php 1.23 KB
Newer Older
1 2 3 4 5 6
<?php
$I = new TestGuy($scenario);
$I->wantTo('ensure that contact works');
$I->amOnPage('?r=site/contact');
$I->see('Contact', 'h1');

7
$I->submitForm('#contact-form', []);
8 9 10 11 12 13 14
$I->see('Contact', 'h1');
$I->see('Name cannot be blank');
$I->see('Email cannot be blank');
$I->see('Subject cannot be blank');
$I->see('Body cannot be blank');
$I->see('The verification code is incorrect');

15
$I->submitForm('#contact-form', [
16 17 18 19 20
	'ContactForm[name]' => 'tester',
	'ContactForm[email]' => 'tester.email',
	'ContactForm[subject]' => 'test subject',
	'ContactForm[body]' => 'test content',
	'ContactForm[verifyCode]' => 'testme',
21
]);
22 23 24 25 26 27
$I->dontSee('Name cannot be blank', '.help-inline');
$I->see('Email is not a valid email address.');
$I->dontSee('Subject cannot be blank', '.help-inline');
$I->dontSee('Body cannot be blank', '.help-inline');
$I->dontSee('The verification code is incorrect', '.help-inline');

28
$I->submitForm('#contact-form', [
29 30 31 32 33
	'ContactForm[name]' => 'tester',
	'ContactForm[email]' => 'tester@example.com',
	'ContactForm[subject]' => 'test subject',
	'ContactForm[body]' => 'test content',
	'ContactForm[verifyCode]' => 'testme',
34
]);
35 36
$I->dontSeeElement('#contact-form');
$I->see('Thank you for contacting us. We will respond to you as soon as possible.');