diff options
Diffstat (limited to 'modules/poll/poll.test')
-rw-r--r-- | modules/poll/poll.test | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/modules/poll/poll.test b/modules/poll/poll.test index f5b018095..a5f668efa 100644 --- a/modules/poll/poll.test +++ b/modules/poll/poll.test @@ -340,17 +340,24 @@ class PollJSAddChoice extends DrupalWebTestCase { // @TODO: the framework should make it possible to submit a form to a // different URL than its action or the current. For now, we can just force // it. - $this->additionalCurlOptions[CURLOPT_URL] = url('system/ahah', array('absolute' => TRUE)); + $this->additionalCurlOptions[CURLOPT_URL] = url('system/ajax', array('absolute' => TRUE)); $this->drupalPost(NULL, $edit, t('More choices')); unset($this->additionalCurlOptions[CURLOPT_URL]); // The response is drupal_json, so we need to undo some escaping. - $response = json_decode(str_replace(array('\x3c', '\x3e', '\x26'), array("<", ">", "&"), $this->drupalGetContent())); - $this->assertTrue(is_object($response), t('The response is an object')); - $this->assertIdentical($response->status, TRUE, t('Response status is true')); - // This response data is valid HTML so we will can reuse everything we have + $commands = json_decode(str_replace(array('\x3c', '\x3e', '\x26'), array("<", ">", "&"), $this->drupalGetContent())); + + // The JSON response will be two AJAX commands. The first is a settings + // command and the second is the replace command. + $settings = reset($commands); + $replace = next($commands); + + $this->assertTrue(is_object($settings), t('The response settings command is an object')); + $this->assertTrue(is_object($replace), t('The response replace command is an object')); + + // This replace data is valid HTML so we will can reuse everything we have // for HTML pages. - $this->content = $response->data; + $this->content = $replace->data; // Needs to be emptied out so the new content will be parsed. $this->elements = ''; |