forked from efrankbased/php-testing
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontact_test2.php
More file actions
40 lines (27 loc) · 1 KB
/
contact_test2.php
File metadata and controls
40 lines (27 loc) · 1 KB
1
2
3
4
5
6
7
8
9
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
<?php
//contact_test2.php
include_once 'includes/settings.php';;
require_once 'simpletest/autorun.php';
require_once 'simpletest/web_tester.php';
class ContactTests2 extends WebTestCase {
function testContactSubmit() {
$this->get(VIRTUAL_PATH . '/pages/contact.php');
$this->assertResponse(200);
$this->setField("name", "Jason");
$this->setField("email", "wj@example.com");
$this->setField("message", "I look forward to hearing from you!");
$this->clickSubmit("Contact us!");
$this->assertResponse(200);
$this->assertText("We will be in touch within 24 hours.");
}
function testInvalidName() {
$this->get(VIRTUAL_PATH . '/pages/contact2.php');
$this->assertResponse(200);
$this->setField("name", "");
$this->setField("email", "wj@example.com");
$this->setField("message", "I look forward to hearing from you!");
$this->clickSubmit("Contact us!");
$this->assertResponse(200);
$this->assertText("Please provide your name.");
}
}