Skip to content
Snippets Groups Projects
Commit 32ba32df authored by Dries Buytaert's avatar Dries Buytaert
Browse files

- Patch #296442 by Damien Tournoud: made upload and blog API tests pass without clean URLs enabled.

parent 12393a4d
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
...@@ -24,6 +24,7 @@ class BlogAPITestCase extends DrupalWebTestCase { ...@@ -24,6 +24,7 @@ class BlogAPITestCase extends DrupalWebTestCase {
* Create, edit, and delete post; upload file; set/get categories. * Create, edit, and delete post; upload file; set/get categories.
*/ */
function testBlogAPI() { function testBlogAPI() {
global $base_url;
// Create admin user and taxononmy for later use. // Create admin user and taxononmy for later use.
$admin_user = $this->drupalCreateUser(array('administer taxonomy')); $admin_user = $this->drupalCreateUser(array('administer taxonomy'));
$this->drupalLogin($admin_user); $this->drupalLogin($admin_user);
...@@ -36,7 +37,7 @@ class BlogAPITestCase extends DrupalWebTestCase { ...@@ -36,7 +37,7 @@ class BlogAPITestCase extends DrupalWebTestCase {
$this->drupalLogin($web_user); $this->drupalLogin($web_user);
// Init common variables. // Init common variables.
$local = url('xmlrpc.php', array('absolute' => TRUE)); $local = url($base_url . '/xmlrpc.php', array('external' => TRUE));
$appid = 'simpletest'; $appid = 'simpletest';
// Get user's blog. // Get user's blog.
......
...@@ -21,6 +21,7 @@ class UploadTestCase extends DrupalWebTestCase { ...@@ -21,6 +21,7 @@ class UploadTestCase extends DrupalWebTestCase {
* Create node; upload files to node; and edit, and delete uploads. * Create node; upload files to node; and edit, and delete uploads.
*/ */
function testNodeUpload() { function testNodeUpload() {
global $base_url;
$admin_user = $this->drupalCreateUser(array('administer site configuration')); $admin_user = $this->drupalCreateUser(array('administer site configuration'));
$web_user = $this->drupalCreateUser(array('access content', 'edit any page content', 'upload files', 'view uploaded files')); $web_user = $this->drupalCreateUser(array('access content', 'edit any page content', 'upload files', 'view uploaded files'));
...@@ -72,7 +73,7 @@ class UploadTestCase extends DrupalWebTestCase { ...@@ -72,7 +73,7 @@ class UploadTestCase extends DrupalWebTestCase {
$this->assertRaw(t('Page %title has been updated.', array('%title' => $node->title)), 'File deleted successfully.'); $this->assertRaw(t('Page %title has been updated.', array('%title' => $node->title)), 'File deleted successfully.');
$this->assertNoText($new_name, $new_name . ' not found on node.'); $this->assertNoText($new_name, $new_name . ' not found on node.');
$this->drupalGet(file_directory_path() . '/' . $upload->description); $this->drupalGet($base_url . '/' . file_directory_path() . '/' . $upload->description, array('external' => TRUE));
$this->assertResponse(array(404), 'Uploaded ' . $upload->description . ' is not accessible.'); $this->assertResponse(array(404), 'Uploaded ' . $upload->description . ' is not accessible.');
} }
else { else {
...@@ -191,8 +192,9 @@ class UploadTestCase extends DrupalWebTestCase { ...@@ -191,8 +192,9 @@ class UploadTestCase extends DrupalWebTestCase {
* @param string $filename Name of file to verifiy. * @param string $filename Name of file to verifiy.
*/ */
function checkUploadedFile($filename) { function checkUploadedFile($filename) {
global $base_url;
$file = realpath(file_directory_path() . '/' . $filename); $file = realpath(file_directory_path() . '/' . $filename);
$this->drupalGet(file_directory_path() . '/' . $filename); $this->drupalGet($base_url . '/' . file_directory_path() . '/' . $filename, array('external' => TRUE));
$this->assertResponse(array(200), 'Uploaded ' . $filename . ' is accessible.'); $this->assertResponse(array(200), 'Uploaded ' . $filename . ' is accessible.');
$this->assertEqual(file_get_contents($file), $this->drupalGetContent(), 'Uploaded contents of ' . $filename . ' verified.'); $this->assertEqual(file_get_contents($file), $this->drupalGetContent(), 'Uploaded contents of ' . $filename . ' verified.');
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment