mediatribe.net -- Drupal and Web Development

Notice: this post was last updated 3 years 34 weeks ago so it might be outdated. Please be cautious before implementing any of suggestions herein.

Snippet of code to test image uploading in simpletests

I can't get this in my head, so here it is: how to test that a module can upload images. Add this in your Drupal Simpletest:

<?php
$image
= current($this->drupalGetTestFiles('image'));
return
drupal_realpath($image->uri);
?>

Post new comment

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <h3>
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.