.../editor/Tests/EditIntegrationLoadingTest.php | 47 +------------------- 1 file changed, 2 insertions(+), 45 deletions(-) diff --git a/core/modules/editor/lib/Drupal/editor/Tests/EditIntegrationLoadingTest.php b/core/modules/editor/lib/Drupal/editor/Tests/EditIntegrationLoadingTest.php index 247678e..6b85a70 100644 --- a/core/modules/editor/lib/Drupal/editor/Tests/EditIntegrationLoadingTest.php +++ b/core/modules/editor/lib/Drupal/editor/Tests/EditIntegrationLoadingTest.php @@ -93,7 +93,7 @@ function testUsersWithoutPermission() { $this->assertRaw('

Do you also love Drupal?

Druplicon
'); // Retrieving the untransformed text should result in an empty 403 response. - $response = $this->retrieveUntransformedText('node/1/body/und/full'); + $response = $this->drupalPostCustom('editor/' . 'node/1/body/und/full', 'application/vnd.drupal-ajax', array()); $this->assertResponse(403); // @todo Uncomment the below once https://drupal.org/node/2063303 is fixed. // $this->assertIdentical('[]', $response); @@ -111,7 +111,7 @@ function testUserWithPermission() { // Ensure the text is transformed. $this->assertRaw('

Do you also love Drupal?

Druplicon
'); - $response = $this->retrieveUntransformedText('node/1/body/und/full'); + $response = $this->drupalPostCustom('editor/' . 'node/1/body/und/full', 'application/vnd.drupal-ajax', array()); $this->assertResponse(200); $ajax_commands = drupal_json_decode($response); $this->assertIdentical(1, count($ajax_commands), 'The untransformed text POST request results in one AJAX command.'); @@ -119,47 +119,4 @@ function testUserWithPermission() { $this->assertIdentical('

Do you also love Drupal?

', $ajax_commands[0]['data'], 'The editorGetUntransformedText command contains the expected data.'); } - /** - * Retrieve untransformed text from the server. - * - * @param string $field_id - * An Edit field ID. - * - * @return string - * The response body. - */ - protected function retrieveUntransformedText($field_id) { - return $this->curlExec(array( - CURLOPT_URL => url('editor/' . $field_id, array('absolute' => TRUE)), - CURLOPT_POST => TRUE, - CURLOPT_POSTFIELDS => $this->getAjaxPageStatePostData(), - CURLOPT_HTTPHEADER => array( - 'Accept: application/vnd.drupal-ajax', - 'Content-Type: application/x-www-form-urlencoded', - ), - )); - } - - /** - * Get extra information to the POST data as ajax.js does. - * - * @return string - * Additional post data. - */ - protected function getAjaxPageStatePostData() { - $extra_post = ''; - $drupal_settings = $this->drupalSettings; - if (isset($drupal_settings['ajaxPageState'])) { - $extra_post .= '&' . urlencode('ajax_page_state[theme]') . '=' . urlencode($drupal_settings['ajaxPageState']['theme']); - $extra_post .= '&' . urlencode('ajax_page_state[theme_token]') . '=' . urlencode($drupal_settings['ajaxPageState']['theme_token']); - foreach ($drupal_settings['ajaxPageState']['css'] as $key => $value) { - $extra_post .= '&' . urlencode("ajax_page_state[css][$key]") . '=1'; - } - foreach ($drupal_settings['ajaxPageState']['js'] as $key => $value) { - $extra_post .= '&' . urlencode("ajax_page_state[js][$key]") . '=1'; - } - } - return $extra_post; - } - }