{"id":18304133,"url":"https://github.com/tripal/tripal_simpletest","last_synced_at":"2025-04-09T10:27:05.527Z","repository":{"id":99410747,"uuid":"80601430","full_name":"tripal/tripal_simpletest","owner":"tripal","description":"This module can be used to develop functional tests on Tripal extensions that can be run on an existing site without disturbing its content. It's compatible with Drupal native test system.","archived":false,"fork":false,"pushed_at":"2017-04-10T08:02:23.000Z","size":10,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-12-23T03:08:48.444Z","etag":null,"topics":["testing","tripal"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tripal.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-02-01T08:25:51.000Z","updated_at":"2023-09-27T18:21:45.000Z","dependencies_parsed_at":null,"dependency_job_id":"52c133ad-168a-438d-afd5-fa13aabe3de3","html_url":"https://github.com/tripal/tripal_simpletest","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tripal%2Ftripal_simpletest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tripal%2Ftripal_simpletest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tripal%2Ftripal_simpletest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tripal%2Ftripal_simpletest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tripal","download_url":"https://codeload.github.com/tripal/tripal_simpletest/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238945668,"owners_count":19556700,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["testing","tripal"],"created_at":"2024-11-05T15:27:54.105Z","updated_at":"2025-02-15T04:33:44.223Z","avatar_url":"https://github.com/tripal.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"Tripal SimpleTest module\n========================\n\nCONTENTS OF THIS FILE\n---------------------\n\n * Introduction\n * Requirements\n * Installation\n * Usage\n * Maintainers\n\n\nINTRODUCTION\n------------\n\nThis module enables functional testing on Tripal extension modules through\nDrupal Simpletest module (Drupal core).\nExamples of .test file can be found here:\n * https://github.com/tripal/tripal_dt/blob/master/tripal_dt.test\n * http://cgit.drupalcode.org/sandbox-guignonv-2789913/tree/brapi.test\n\n\nREQUIREMENTS\n------------\n\nThis module requires the following modules:\n\n * Tripal \u003e=7.x-2.1 (not tested under 3.x)\n   (http://www.drupal.org/project/tripal)\n   The version of Tripal must provide the function tripal_get_schema_name() that\n   triggers hook_tripal_get_schema_name_alter() which is not available in older\n   releases of Tripal 2.x (before December 2016).\n * At the time this README is being written, there appear to be an issue in\n   Drupal Core: the simpletest module can't drop PostgreSQL tables in the\n   correct order and it will fail to drop a table if this table is still\n   referenced elsewhere.\n   A workaround is to patch Drupal core file\n   `includes/database/pgsql/schema.inc` so it can drop tables regardless their\n   dependencies, line 348:\n   replace (or comment)\n   ```\n    $this-\u003econnection-\u003equery('DROP TABLE {' . $table . '}');\n   ```\n   by this\n   ```\n    $this-\u003econnection-\u003equery('DROP TABLE {' . $table . '} CASCADE');\n   ```\n\n\nINSTALLATION\n------------\n\n * Install as you would normally install a contributed Drupal module. See:\n   https://drupal.org/documentation/install/modules-themes/modules-7\n   for further information.\n\n * IMPORTANT: you don't need to enable this module in order to run tests! It\n   should be automatically enabled by tests during testing only. Therefore it is\n   recommended not to enable this module to avoid side effects.\n\n\nUSAGE\n-----\n\nWhen you write tests for your regular Drupal modules, you usually extend the\nclass \"DrupalWebTestCase\". If you need to test Tripal extensions, you will need\nto extend \"TripalTestCase\" instead as this class will manage Chado instantiation\nand Tripal module activation for you while it will provide the same features as\nthe \"DrupalWebTestCase\" class.\n\nTo use this class, you will need to import it into your test using:\n```\n  module_load_include('php', 'tripal_simpletest', 'tripal_test_case');\n```\nNote: It should work even if the module tripal_simpletest is not enabled.\n\nIt is recommended that you implement only one \"public function testXXX()\" to\navoid multiple Chado instantiation as each \"testXXX\" function is run with a new\nclean Chado instance and each instantiation take a lot of time and may cause\ntimeouts.\n\nSo your test class definition should look something similar to:\n```\n  module_load_include('php', 'tripal_simpletest', 'tripal_test_case');\n  class MyTripalModuleTestCase extends TripalTestCase {\n    ...\n    public static function getInfo() {\n      return array(\n        'name' =\u003e 'Your Functional Tests',\n        'description' =\u003e 'Ensure that the extension works properly.',\n        'group' =\u003e 'YourTestGroupName',\n      );\n    }\n    ...\n    public function setUp() {\n      // List of module to enable by default (machine names) *excluding* Tripal\n      // extension modules but including Tripal package modules. You don't need\n      // to take care of dependencies as they are automatically enabled as well.\n      $modules_to_enable = array('module1', 'module2', ...);\n      parent::setUp($modules_to_enable);\n      // Enable your Tripal module(s).\n      module_enable(array('tripal_your_extension'), TRUE);\n      // Apply thoses changes to the test environment.\n      $this-\u003eresetAll();\n\n      // Add initialization stuff like module settings and Chado data insertion.\n      ...\n    }\n    ...\n    public function testMyFunctionality() {\n      // Do testing stuff and assertions.\n      ...\n    }\n  }\n```\nIf you implement the member function tearDown(), don't forget to call parent\nimplementation:\n```\n  public function tearDown() {\n    // Do your stuff\n    ...\n    parent::tearDown();\n  }\n```\n\nReferences:\n * https://www.drupal.org/docs/7/testing/simpletest-testing-tutorial-drupal-7\n * https://www.drupal.org/docs/7/testing/assertions\n\nTo run the tests from the Drupal interface, make sure you enabled simpletest\n(core) module and go to:\nhttp://www.yourdevsite.com/admin/config/development/testing\nThen select your test and just click \"Run tests\". It will take time and you may\nhave a timeout error but you can proceed to the \"error\" page and your tests may\nhave passed successfully anyway.\n\nTo run the tests from the command line, go to your Drupal installation root and\ntype:\nphp -f scripts/run-tests.sh -- --url http://www.yourdevsite.com/ YourTestGrpName\n \n\nMAINTAINERS\n-----------\n\nCurrent maintainer(s):\n\n * Valentin Guignon (vguignon) - https://www.drupal.org/user/423148\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftripal%2Ftripal_simpletest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftripal%2Ftripal_simpletest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftripal%2Ftripal_simpletest/lists"}