PHPUnit is showing that it skipped three tests.
To keep our discussion short and focussed, we will now implement only one test from
these nine. We will test that the feedback form renderer is actually working fine.
Now here is our revised test routine testFormRenderer() in our test case.
public function testFormRenderer(){
$testResult = true;
$message = "";
$Fm= new FeedbackManager();
ob_start();
$Fm->renderFeedbackForm();
$output = ob_get_clean();
if (strpos($output, "name='email'")===false && $testResult==true)
list($testResult, $message) = array(false,
"Email field is not present");
Chapter 5
[ 127 ]
if (strpos($output, "name='username'")===false &&
$testResult==true)
list($testResult, $message) = array(false,
"Username is field not present");
if (strpos($output, "name='subject'")===false && $testResult==true)
list($testResult, $message) = array(false,
"Subject field is not present");
if (strpos($output, "name='message'")===false && $testResult==true)
list($testResult, $message) = array(false,
"Message field is not present");
$this->assertTrue($testResult, $message);
//$this->markTestIncomplete();
}
It clearly states that in our feedback manager there must be a method named
renderFeedbackForm() and in the generated output there must be four input
fields namely, email,subject,username and message.
Pages:
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142