function SimpleTestExampleMockModuleTestCase::testSimpleTestExampleMockModule
Test modifications made by our mock module.
We create a simpletest_example node and then see if our submodule operated on it.
File
-
simpletest_example/
simpletest_example.test, line 246
Class
- SimpleTestExampleMockModuleTestCase
- SimpleTestExampleMockModuleTestCase allows us to demonstrate how you can use a mock module to aid in functional testing in Drupal.
Code
public function testSimpleTestExampleMockModule() {
// Create a user.
$test_user = $this->drupalCreateUser(array(
'access content',
));
// Log them in.
$this->drupalLogin($test_user);
// Set up some content.
$settings = array(
'type' => 'simpletest_example',
'title' => $this->randomName(32),
'body' => array(
LANGUAGE_NONE => array(
array(
$this->randomName(64),
),
),
),
);
// Create the content node.
$node = $this->drupalCreateNode($settings);
// View the node.
$this->drupalGet("node/{$node->nid}");
// Check that our module did it's thing.
$this->assertText(t('The test module did its thing.'), "Found evidence of test module.");
}