Commit c0d244ad authored by moshe weitzman's avatar moshe weitzman

from the README

Description
------------------
A framework for running unit tests in Drupal.

Status
------------------
No tests have been written. This framework should work though.

Requirements
----------------

- Install the simpletest framework to a new directory called 'simpletest' right under Drupal root.
You can find it at http://www.lastcraft.com/simple_test.php

Install
-----------------------

- Copy this module package to your /modules directory
- Activate the simpletest.module
- Visit the admin/simpletest page

Simpletest hook
-----------------------

This module offers a new 'simpletest' hook. Modules implementing this hook should an array of paths which
point to test files. These paths should be relative to the /simpletest directory.

Writing Tests
-----------------------
Please write some tests. I'm a bit new at this and haven't decided on a worthy approach.

Author
---------------------
<Moshe Weitzman < weitzman at tejasa dot com >
parents
Description
------------------
A framework for running unit tests in Drupal.
Status
------------------
No tests have been written. This framework should work though.
Requirements
----------------
- Install the simpletest framework to a new directory called 'simpletest' right under Drupal root.
You can find it at http://www.lastcraft.com/simple_test.php
Install
-----------------------
- Copy this module package to your /modules directory
- Activate the simpletest.module
- Visit the admin/simpletest page
Simpletest hook
-----------------------
This module offers a new 'simpletest' hook. Modules implementing this hook should an array of paths which
point to test files. These paths should be relative to the /simpletest directory.
Writing Tests
-----------------------
Please write some tests. I'm a bit new at this and haven't decided on a worthy approach.
Author
---------------------
<Moshe Weitzman < weitzman at tejasa dot com >
<?php
function simpletest_help($section) {
$output = "";
switch ($section) {
case 'admin/system/modules#description':
$output = t("Simple unit testing suite");
break;
case 'admin/system/modules/simpletest':
$output = '';
break;
}
return $output;
}
function simpletest_link($type) {
if ($type == 'system') {
menu('admin/simpletest', 'simpletest', 'simpletest_admin');
}
}
function simpletest_admin() {
if (!defined("SIMPLE_TEST")) {
define("SIMPLE_TEST", "simpletest/");
}
require_once(SIMPLE_TEST . 'unit_tester.php');
require_once(SIMPLE_TEST . 'web_tester.php');
require_once(SIMPLE_TEST . 'shell_tester.php');
require_once(SIMPLE_TEST . 'reporter.php');
require_once(SIMPLE_TEST . 'mock_objects.php');
require_once(SIMPLE_TEST . 'extensions/pear_test_case.php');
require_once(SIMPLE_TEST . 'extensions/phpunit_test_case.php');
class UnitTests extends GroupTest {
function UnitTests() {
$this->GroupTest("Drupal unit tests");
$files = module_invoke_all('simpletest');
foreach ($files as $file) {
$this->addTestFile($file);
}
}
}
if (! defined("TEST_RUNNING")) {
define("TEST_RUNNING", true);
$test = &new UnitTests();
if (SimpleReporter::inCli()) {
exit ($test->run(new TextReporter()) ? 0 : 1);
}
$test->run(new HtmlReporter());
}
}
?>
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment