I've been working on adding acceptance tests to the CPD plugin (mostly as a learning exercise for myself).
One vital part of these tests is creating test data ("fixtures"). It seems as though Moodle's provision for this is in the form of data generators, which Behat should instantiate and call methods on as appropriate. It doesn't appear as though data generators have been implemented outside of blocks and activity modules, though?
/local/cpd/tests/behat/manage_own_cpd.feature
@javascript Scenario: Delete own CPD record Given the following "users" exist: | username | firstname | lastname | email | | user1 | User | 1 | user1@asd.com | And the following "cpd_activity_types" exist: | Activity Type | | Behatting | And the following "cpd activities" exist: | Development Need | Objective | Activity Type | Activity Description | | Behat | Behat | Behatting | Behatting |
/local/cpd/tests/generator/lib.php
<?php class local_cpd_generator extends component_generator_base { public function create_cpd_activity_type() {If anyone familiar with the testing infrastructure in Moodle could comment on this I'd really appreciate it.
// forgive me
xdebug_print_function_stack("You'll have a job!"); var_dump(func_get_args()); die(); } }
Regards,
Luke.