Code Search for Developers
 
 
  

detached.php from Brim at Krugle


Show detached.php syntax highlighted

<?php
    /**
     *	base include file for SimpleTest
     *	@package	SimpleTest
     *	@subpackage	UnitTester
     *	@version	$Id: detached.php 1175 2006-03-16 09:53:09Z barrel $
     */

    /**#@+
     *	include other SimpleTest class files
     */
    require_once(dirname(__FILE__) . '/xml.php');
    require_once(dirname(__FILE__) . '/shell_tester.php');
    /**#@-*/

    /**
     *    Runs an XML formated test in a separate process.
	 *	  @package SimpleTest
	 *	  @subpackage UnitTester
     */
    class DetachedTestCase {
        var $_command;
        var $_dry_command;
        var $_size;

        /**
         *    Sets the location of the remote test.
         *    @param string $command       Test script.
         *    @param string $dry_command   Script for dry run.
         *    @access public
         */
        function DetachedTestCase($command, $dry_command = false) {
            $this->_command = $command;
            $this->_dry_command = $dry_command ? $dry_command : $command;
            $this->_size = false;
        }

        /**
         *    Accessor for the test name for subclasses.
         *    @return string       Name of the test.
         *    @access public
         */
        function getLabel() {
            return $this->_command;
        }

        /**
         *    Runs the top level test for this class. Currently
         *    reads the data as a single chunk. I'll fix this
         *    once I have added iteration to the browser.
         *    @param SimpleReporter $reporter    Target of test results.
         *    @returns boolean                   True if no failures.
         *    @access public
         */
        function run(&$reporter) {
			$shell = &new SimpleShell();
			$shell->execute($this->_command);
            $parser = &$this->_createParser($reporter);
            if (! $parser->parse($shell->getOutput())) {
                trigger_error('Cannot parse incoming XML from [' . $this->_command . ']');
                return false;
            }
            return true;
        }

        /**
         *    Accessor for the number of subtests.
         *    @return integer       Number of test cases.
         *    @access public
         */
        function getSize() {
            if ($this->_size === false) {
				$shell = &new SimpleShell();
				$shell->execute($this->_dry_command);
                $reporter = &new SimpleReporter();
                $parser = &$this->_createParser($reporter);
                if (! $parser->parse($shell->getOutput())) {
                    trigger_error('Cannot parse incoming XML from [' . $this->_dry_command . ']');
                    return false;
                }
                $this->_size = $reporter->getTestCaseCount();
            }
            return $this->_size;
        }

        /**
         *    Creates the XML parser.
         *    @param SimpleReporter $reporter    Target of test results.
         *    @return SimpleTestXmlListener      XML reader.
         *    @access protected
         */
        function &_createParser(&$reporter) {
            return new SimpleTestXmlParser($reporter);
        }
    }
?>



See more files for this project here

Brim

BRIM is a MVC framework, written in PHP and based on items with a hierarchical relationship. The list of plugins make BRIM a Information Manager with plugins like bookmarks, a calendar, contacts tasks, notes, RSS etc. The application is multilingual.

Project homepage: http://sourceforge.net/projects/brim
Programming language(s): JavaScript,PHP,SQL
License: other

  extensions/
    index.php
    pear_test_case.php
    phpunit_test_case.php
  test/
    acceptance_test.php
    adapter_test.php
    all_tests.php
    authentication_test.php
    browser_test.php
    collector_test.php
    compatibility_test.php
    cookies_test.php
    detached_test.php
    dumper_test.php
    encoding_test.php
    errors_test.php
    expectation_test.php
    form_test.php
    frames_test.php
    http_test.php
    index.php
    interfaces_test.php
    live_test.php
    mock_objects_test.php
    options_test.php
    page_test.php
    parse_error_test.php
    parser_test.php
    real_sites_test.php
    reflection_php4_test.php
    remote_test.php
    shell_test.php
    shell_tester_test.php
    simple_mock_test.php
    simpletest_test.php
    socket_test.php
    tag_test.php
    test_groups.php
    test_with_parse_error.php
    unit_tester_test.php
    unit_tests.php
    url_test.php
    user_agent_test.php
    visual_test.php
    web_tester_test.php
    xml_test.php
  HELP_MY_TESTS_DONT_WORK_ANYMORE
  LICENSE
  README
  VERSION
  authentication.php
  browser.php
  collector.php
  compatibility.php
  cookies.php
  detached.php
  dumper.php
  encoding.php
  errors.php
  exceptions.php
  expectation.php
  form.php
  frames.php
  http.php
  index.php
  invoker.php
  mock_objects.php
  options.php
  page.php
  parser.php
  reflection_php4.php
  remote.php
  reporter.php
  runner.php
  scorer.php
  selector.php
  shell_tester.php
  simple_test.php
  simpletest.php
  socket.php
  tag.php
  test_case.php
  unit_tester.php
  url.php
  user_agent.php
  web_tester.php
  xml.php