18.10.2016 Views

Drupal 7 Module Development

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Creating Your First <strong>Module</strong><br />

Setting up the test case<br />

Often, a test case will require some setup and configuration, where shared values are<br />

initialized and subsystems made available.<br />

Fortunately, <strong>Drupal</strong> handles most of the basics. The database layer, module system,<br />

and initial configuration are all done. However, test cases often have to handle some<br />

initialization themselves. In cases where you need to do this, there is an existing<br />

method that will be called before tests are executed. This is the setUp() method.<br />

While we don't need any set up for our module, I am going to show it anyway<br />

so that we can see a few important things.<br />

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!