1 simpletest_example.test public 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

modules/examples/simpletest_example/tests/simpletest_example.test, line 198
An example of simpletest tests.

Class

SimpleTestExampleMockModuleTestCase
SimpleTestExampleMockModuleTestCase allows us to demonstrate how you can use a mock module to aid in functional testing in Backdrop.

Code

public function testSimpleTestExampleMockModule() {
  // Create a user.
  $test_user = $this->backdropCreateUser(array('access content'));
  // Log them in.
  $this->backdropLogin($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->backdropCreateNode($settings);
  // View the node.
  $this->backdropGet("node/{$node->nid}");
  // Check that our module did its thing.
  $this->assertText(t('The test module did its thing.'), "Found evidence of test module.");
}