Problem/Motivation

SimpleTest Example doesn't help anyone learn how to set up a mock module for functional testing.

The SimpleTest Tutorial doesn't either. It is located here: https://drupal.org/simpletest-tutorial-drupal7

Proposed resolution

Add a mock module to SimpleTest Example. (done)

Also, update the tutorial. (not yet done)

Remaining tasks

User interface changes

API changes

Original report by linclark

The SimpleTest example has all of the files directly under the simpletest directory. However, modules like node and rdf put the simpletest.info and simpletest.module files in a 'test' directory. It might be good to follow this convention in the example.

CommentFileSizeAuthor
#4 786156_4.patch4.21 KBmile23

Comments

Anonymous’s picture

Category: task » feature

Actually, I realize now that the .info and .module file in there isn't a module for testing (modules that you use during the test to check install functionality, etc.), but a module that is having tests run on it.

You may want to consider making a more complex example that includes a module for testing, like node and rdf have, so I've changed the category to feature request. That might be outside the scope of the Examples project, though.

rfay’s picture

Title: SimpleTest file structure » Add "mock module" to simpletest example and tutorial

Actually, I think the simpletest example (and tutorial) need a mock module (one that's not visible on the modules page). This is a standard part of writing tests, and we don't even mention it in the tutorial.

Thanks!

tr’s picture

Version: » 7.x-1.x-dev
Priority: Minor » Normal

Bumping and assigning a version. I think this is a good idea.

mile23’s picture

Issue summary: View changes
StatusFileSize
new4.21 KB

Here's a mock module example patch.

It does very little, just implements hook_node_view() to add some content, and then tests for that content.

mile23’s picture

Status: Active » Needs review
mile23’s picture

Title: Add "mock module" to simpletest example and tutorial » Update the SimpleTest tutorial to reflect the 'mock module' pattern.
Issue summary: View changes

Code committed: http://drupalcode.org/project/examples.git/commitdiff/492002e2491569625b...

If someone wants to re-work the tutorial, that'd be great. I'll leave this issue open in hopes someone will feel moved to do so.

If you're inspired to re-work the code, however, add a new issue about it and link it to this one.

mile23’s picture

Status: Needs review » Active
mile23’s picture

Issue summary: View changes
mile23’s picture

Status: Active » Fixed

So this is really fixed. If someone wants to add to it, just open a new issue. Thanks.

It's minimal maintenance time for the 7.x-1.x branch of Examples. See #2642596: D6, D7 Roadmap for Examples

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.