|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace frontend\tests\functional; |
|
4
|
|
|
|
|
5
|
|
|
use frontend\tests\FunctionalTester; |
|
6
|
|
|
|
|
7
|
|
|
/* @var $scenario \Codeception\Scenario */ |
|
8
|
|
|
|
|
9
|
|
|
/** |
|
10
|
|
|
* Class ContactCest |
|
11
|
|
|
* @package frontend\tests\functional |
|
12
|
|
|
*/ |
|
13
|
|
|
class ContactCest |
|
14
|
|
|
{ |
|
15
|
|
|
/** |
|
16
|
|
|
* @param FunctionalTester $I |
|
17
|
|
|
*/ |
|
18
|
|
|
public function _before(FunctionalTester $I) |
|
19
|
|
|
{ |
|
20
|
|
|
$I->amOnPage(['main/default/contact']); |
|
21
|
|
|
} |
|
22
|
|
|
|
|
23
|
|
|
/** |
|
24
|
|
|
* @param FunctionalTester $I |
|
25
|
|
|
*/ |
|
26
|
|
|
public function checkContact(FunctionalTester $I) |
|
27
|
|
|
{ |
|
28
|
|
|
$I->see('Contact', 'h1'); |
|
29
|
|
|
} |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* @param FunctionalTester $I |
|
33
|
|
|
*/ |
|
34
|
|
|
public function checkContactSubmitNoData(FunctionalTester $I) |
|
35
|
|
|
{ |
|
36
|
|
|
$I->submitForm('#contact-form', []); |
|
37
|
|
|
$I->see('Contact', 'h1'); |
|
38
|
|
|
$I->seeValidationError('Name cannot be blank'); |
|
39
|
|
|
$I->seeValidationError('E-mail cannot be blank'); |
|
40
|
|
|
$I->seeValidationError('Subject cannot be blank'); |
|
41
|
|
|
$I->seeValidationError('Body cannot be blank'); |
|
42
|
|
|
$I->seeValidationError('Verification Code cannot be blank'); |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
/** |
|
46
|
|
|
* @param FunctionalTester $I |
|
47
|
|
|
*/ |
|
48
|
|
|
public function checkContactSubmitNotCorrectEmail(FunctionalTester $I) |
|
49
|
|
|
{ |
|
50
|
|
|
$I->submitForm('#contact-form', [ |
|
51
|
|
|
'ContactForm[name]' => 'tester', |
|
52
|
|
|
'ContactForm[email]' => 'tester.email', |
|
53
|
|
|
'ContactForm[subject]' => 'test subject', |
|
54
|
|
|
'ContactForm[body]' => 'test content', |
|
55
|
|
|
'ContactForm[verifyCode]' => 'testme', |
|
56
|
|
|
]); |
|
57
|
|
|
$I->seeValidationError('E-mail is not a valid email address'); |
|
58
|
|
|
$I->dontSeeValidationError('Name cannot be blank'); |
|
59
|
|
|
$I->dontSeeValidationError('Subject cannot be blank'); |
|
60
|
|
|
$I->dontSeeValidationError('Body cannot be blank'); |
|
61
|
|
|
$I->dontSeeValidationError('Verification Code cannot be blank'); |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
/** |
|
65
|
|
|
* @param FunctionalTester $I |
|
66
|
|
|
*/ |
|
67
|
|
|
public function checkContactSubmitCorrectData(FunctionalTester $I) |
|
68
|
|
|
{ |
|
69
|
|
|
$I->submitForm('#contact-form', [ |
|
70
|
|
|
'ContactForm[name]' => 'tester', |
|
71
|
|
|
'ContactForm[email]' => '[email protected]', |
|
72
|
|
|
'ContactForm[subject]' => 'test subject', |
|
73
|
|
|
'ContactForm[body]' => 'test content', |
|
74
|
|
|
'ContactForm[verifyCode]' => 'testme', |
|
75
|
|
|
]); |
|
76
|
|
|
$I->seeEmailIsSent(); |
|
77
|
|
|
$I->see('Thank you for contacting us. We will respond to you as soon as possible.'); |
|
78
|
|
|
} |
|
79
|
|
|
} |
|
80
|
|
|
|