function checkPostRedirect($client) { global $passed; line_out("Checking to see if there was a POST redirect to a GET"); $method = $client->getRequest()->getMethod(); if ($method == "get") { $passed++; markTestPassed("POST Redirect Check"); } else { error_out('Expecting POST to Redirect to GET - found ' . $method); } }
$html = $crawler->html(); markTestPassed("Retrieved delete.php"); $OUTPUT->togglePre("Show retrieved page", $html); // Do the Delete line_out('Looking for the form with a value="Delete" submit button'); $form = $crawler->selectButton('Delete')->form(); $crawler = $client->submit($form); markTestPassed("Submitted form on delete.php"); $html = $crawler->html(); checkPostRedirect($client); $OUTPUT->togglePre("Show retrieved page", $html); line_out("Making sure '{$firststring}' has been deleted"); if (strpos($html, $firststring) > 0) { error_out("Entry '{$firststring}' not deleted"); } else { markTestPassed("Entry '{$firststring}' deleted"); } line_out("Cleaning up old records..."); $i = 5; while ($i-- > 0) { $pos2 = strpos($html, "delete.php"); if ($pos2 < 1) { break; } $pos3 = strpos($html, '"', $pos2); if ($pos3 < 1) { break; } $editlink = substr($html, $pos2, $pos3 - $pos2); $editlink = str_replace("&", "&", $editlink); line_out("Retrieving " . $editlink . "...");