Updated: Comment #0
Problem/Motivation
This took a while to track down, and I'm actually extremely surprised that it hasn't been caught by testbot by now. However, it appears that drupalGet()/drupalPost() do not work at all without clean URLs working. Regardless of whether the page is being triggered from a clean url-using page or not, simpletest will always generate clean URLs for making requests back to itself. If clean URLs don't resolve, the result is always an Apache 404 (not even a Drupal 404).
I think it's best demonstrated by looking at the code. In WebTestBase's setup process is this:
<?php
protected function prepareRequestForGenerator($clean_urls = TRUE, $override_server_vars = array()) {
// ...
if ($clean_urls) {
$request_path = $base_path ? $base_path . '/user': 'user';
}
else {
$request_path = $base_path ? $base_path . '/index.php/user': '/index.php/user';
}
$server = array_merge($server, $override_server_vars);
$request = Request::create($request_path, 'GET', array(), array(), array(), $server);
$generator->setRequest($request);
return $request;
}
?>
That method is called from a few places, but most notably for our purposes is WebTestBase::rebuildContainer():
<?php
protected function rebuildContainer() {
parent::rebuildContainer();
// Make sure the url generator has a request object, otherwise calls to
// $this->drupalGet() will fail.
$this->prepareRequestForGenerator();
}
?>
That is, prepareRequestForGenerator() is called without a clean URL parameter, so it defaults to true even if it shouldn't. As a result, drupalGet() always then uses a clean URL.
There's another no-parameter call to prepareRequestForGenerator() in LanguageUrlRewritingTest::testUrlRewritingEdgeCases(). I don't know if that's appropriate or not. It looks like the other calls to that method always pass in a value.
Proposed resolution
I don't know; Kat said to assign it to her and she'll figure it out. :-)
Remaining tasks
Fix the bug.
User interface changes
None.
API changes
Should be none?