In this lesson we'll write a hello world test that navigates to the front page of a standard Drupal installation and verifies the existence of the text, "No front page content has been created yet.". This will allow us to walk through creating a .test file, adding it to our modules .info file, as well as cover the basics of extending DrupalWebTestCase to write our own test case. For this lesson we'll use the helloworld sample module as a starting point and expand it to add a very basic test. The goal being to gain a better understanding of how the SimpleTest module discovers, and runs our tests. Then in future lessons we can expand on our test case to add more robust features.
All SimpleTest tests are an extension of either the DrupalWebTestCase (we'll focus on this one), or the DrupalUnitTestCase base classes. There are two pieces to the discover process. Writing a new class that extends one of the base classes, and then declaring the file that contains this new class in your module's .info file so that the file and it's code are indexed and inserted into the registry.
Create a new file inside the helloworld module's directory: tests/helloworld.test. The convention is to name files that contain test classes with a .test extension. Similar to how module file, despite being purely PHP, are named with a .module extension.
All SimpleTest tests are an extension of either the DrupalWebTestCase (we'll focus on this one), or the DrupalUnitTestCase base classes. There are two pieces to the discover process. Writing a new class that extends one of the base classes, and then declaring the file that contains this new class in your module's .info file so that the file and it's code are indexed and inserted into the registry.
Create a new file inside the helloworld module's directory: tests/helloworld.test. The convention is to name files that contain test classes with a .test extension. Similar to how module file, despite being purely PHP, are named with a .module extension.
drupal modules Learning Test Case Basics by Writing a Hello World Test | |
5 Likes | 5 Dislikes |
899 views views | 8.87K followers |
Film & Animation | Upload TimePublished on 21 Jan 2015 |
Related keywords
training force,training center garmin,drupal console,training peaks,training deporte,training day,training center,drupal download,drupal 7,training shed,drupal 8,training significado,drupal themes,training mask,drupal bootstrap,drupal themes free,training with hinako,drupal tutorial,drupal 7 download,training camp,drupal theme,training que es,training wheels lyrics,drupal core,training wheels,http://drupal.org,training me,training gym,drupal شرح,training wheels letra,drupal developer,drupal exploit,training traduccion,drupal php,drupal 8 download,drupal commerce,training shoes,training point,drupal 7 exploit,
Không có nhận xét nào:
Đăng nhận xét