? simpletest ? simpletest.moduleOLD Index: drupal_test_case.php =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/simpletest/drupal_test_case.php,v retrieving revision 1.28.2.8 diff -u -p -r1.28.2.8 drupal_test_case.php --- drupal_test_case.php 28 Jan 2008 08:12:40 -0000 1.28.2.8 +++ drupal_test_case.php 28 Jan 2008 08:13:48 -0000 @@ -50,10 +50,13 @@ class DrupalTestCase extends WebTestCase * adds the authentication headers if necessary * @author Earnest Berry III * - * @param url string Url to retch + * @param $path String Drupal path or url to load into internal browser. + * @param $query A query string to append to the link or URL. + * @param $fragment A fragment identifier (named anchor) to append to the link. Note, do not include the '#'. * @return void */ - function drupalGet($url) { + function drupalGet($path, $query = NULL, $fragment = NULL) { + $url = url($path, $query, $fragment, TRUE); $html = $this->_browser->get($url); if( $this->drupalCheckAuth(true) ) { @@ -96,9 +99,8 @@ class DrupalTestCase extends WebTestCase * @param string $submit name of the submit button, untranslated */ function drupalPostRequest($path, $edit = array(), $submit) { - $url = url($path, NULL, NULL, TRUE); - $ret = $this->drupalGet($url); - + $ret = $this->drupalGet($path); + $this->assertTrue($ret, t(' [browser] GET path "@path"', array('@path' => $path))); foreach ($edit as $field_name => $field_value) { $ret = $this->_browser->setFieldByName($field_name, $field_value) @@ -315,7 +317,7 @@ class DrupalTestCase extends WebTestCase */ function drupalLoginUser($user = NULL, $submit = 'Log in') { - $this->drupalGet( url("user", NULL, NULL, TRUE) ); + $this->drupalGet("user"); // Going to the page retrieves the cookie, as the browser should save it if ($user === NULL) { Index: run_all_tests.php =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/simpletest/run_all_tests.php,v retrieving revision 1.3 diff -u -p -r1.3 run_all_tests.php --- run_all_tests.php 5 Apr 2006 00:44:32 -0000 1.3 +++ run_all_tests.php 28 Jan 2008 08:13:48 -0000 @@ -5,29 +5,46 @@ /** - * @file - - * Run all unit tests for all enabled modules. - + * This script can be run with browser or from command line. + * You can provide class names of the tests you wish to run. + * For command line: php run_all_tests.php SearchMatchTest,ProfileModuleTestSingle + * For browser: http://yoursite.com/sites/all/modules/simpletest/run_all_tests.php?include=SearchMatchTest,ProfileModuleTestSingle + * If none of these two options are provided all tests will be run. */ chdir(realpath(dirname(__FILE__) . '/../../')); - -require_once './includes/bootstrap.inc'; +if (file_exists('./includes/bootstrap.inc')) { + include_once './includes/bootstrap.inc'; +} +else { + chdir(realpath(dirname(__FILE__) . '/../../../../')); + if (file_exists('./includes/bootstrap.inc')) { + include_once './includes/bootstrap.inc'; + } + else { + exit("bootstrap.inc could not be loaded\n"); + } +} drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); - - // If not in 'safe mode', increase the maximum execution time: - if (!ini_get('safe_mode')) { - set_time_limit(360); - } +$tests = array(); +$html_reporter = FALSE; +if ($_GET['include']) { + $tests = explode(',', $_GET['include']); + $html_reporter = TRUE; +} +else if ($argc == 2) { + $tests = explode(',', $argv[1]); +} +$result = simpletest_run_tests($tests, $html_reporter); - -simpletest_run_tests(); +if (!$html_reporter) { + exit($result); +} Index: tests/image_module.test =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/simpletest/tests/image_module.test,v retrieving revision 1.10.2.2 diff -u -p -r1.10.2.2 image_module.test --- tests/image_module.test 28 Jan 2008 07:57:53 -0000 1.10.2.2 +++ tests/image_module.test 28 Jan 2008 08:13:48 -0000 @@ -96,7 +96,7 @@ class ImageModuleTest extends DrupalTest // get node nid $node = node_load(array('title' => $title)); - $this->drupalGet(url("node/$node->nid", NULL, NULL, TRUE)); + $this->drupalGet("node/$node->nid"); $content = $this->_browser->getContent(); $this->assertWantedText($title, "Checking title : $title"); $this->assertWantedText($description, "Checking body: $description"); Index: tests/page_view.test =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/simpletest/tests/page_view.test,v retrieving revision 1.8.2.1 diff -u -p -r1.8.2.1 page_view.test --- tests/page_view.test 28 Jan 2008 07:57:53 -0000 1.8.2.1 +++ tests/page_view.test 28 Jan 2008 08:13:48 -0000 @@ -40,14 +40,14 @@ class PageViewTest extends DrupalTestCas $this->assertNotNull(node_load($node->nid), 'Node created'); /* Tries to edit with anonymous user */ - $html = $this->drupalGet(url("node/$node->nid/edit", NULL, NULL, TRUE)); + $html = $this->drupalGet("node/$node->nid/edit"); $this->assertResponse(403); /* Prepare a user to request the node view */ $test_user = $this->drupalCreateUserRolePerm(array('access content')); $this->drupalLoginUser($test_user); - $html = $this->drupalGet(url("node/$node->nid/edit", NULL, NULL, TRUE)); + $html = $this->drupalGet("node/$node->nid/edit"); $this->assertResponse(403); $test_user = $this->drupalCreateUserRolePerm(array('administer nodes')); Index: tests/taxonomy.module.test =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/simpletest/tests/taxonomy.module.test,v retrieving revision 1.7.2.3 diff -u -p -r1.7.2.3 taxonomy.module.test --- tests/taxonomy.module.test 28 Jan 2008 08:12:41 -0000 1.7.2.3 +++ tests/taxonomy.module.test 28 Jan 2008 08:13:48 -0000 @@ -297,7 +297,7 @@ class TaxonomyTestNodeApi extends Drupal // why is this printing out the user profile page? // go to node/add/story - $this->drupalGet(url('node/add/story', NULL, NULL, TRUE)); + $this->drupalGet('node/add/story'); $req = $this->_browser->getRequest(); $headers = $this->_browser->getHeaders();