drush

Running Simpletests from the command line in Drupal using Drush.

As I get more and more into test driven development, a couple tools have really helped speed up development and deployment of those tests.

Running your tests from the command line can make things really quick, especially if you are repeating a test multiple times, trying to track down a bug.

If you have installed XDEBUG, you can trigger breakpoints in your IDE from the cmd line by executing:

export XDEBUG_CONFIG="remote_port=9000 remote_enable=1"

After that is setup, you can run your tests like so:

drush test-run -l http://example.local //runs all your tests
drush test-run -l http://example.local ExampleFunctionalTest //runs only the ExampleFunctionalTest

The awesomeness of features and drush

Most serious drupal developers know how awesome Drush and Features are.

That fact was reinforced to me this week when I "discovered" a couple drush commands that were extremely helpful for deploying new features.

During a site buildout you often go through many iterations of a particular feature, for example the many views that can make up a custom Ubercart store. If you have those Views in Features, you can version them in source control and leverage "svn up" or "git pull" to deploy them to different servers.

When those views change, instead of updating your feature through the UI, just use "drush features-update (fu) mysite_store" (where mysite_store is the name of your feature) to update the code on disk for that feature. Use source control to deploy it, then on the target site, if you've made some tweaks that got stored in the database, use "drush features-revert (fr) mysite_store" to reset so that your using the code on disk.

It's always exciting to find ways to work smarter, and the awesomeness of Features and Drush never ceases to amaze me.

Troubleshooting "The command 'drush.php update' could not be executed."

I have several Drupal 5 Multisite installs. I was able to run "drush update -l www.example.com" on several of them successfully, but a few of the installs failed with "The command 'drush.php update' could not be executed."

Cryptic indeed.

There is a drush patch to provide more helpful error messages (http://drupal.org/node/449090).

but in my case it was just that the Drupal Core "Update Status" module wasn't enabled on the offending sites.

troubleshooting Drush bootstrap on localhost

Troubleshooting the "Drush was not able to start (bootstrap) the Drupal database." when trying to run in on a localhost configuration.

Many thanks to Chris Wells from Redfin Solutions for this troubleshooting tip on getting drush to work in a localhost configuration.

In the settings.php file, try changing

$db_url = 'mysqli://username@localhost/example';
$db_prefix = '';
to
$db_url = 'mysqli://username@127.0.0.1/example';
$db_prefix = '';

comment #12 http://drupal.org/node/502252

Syndicate content