function testTestCaseRegistry()
 {
     $test =& new MockSimpleTestCase($this);
     $class = SimpleMock::registerTest($test);
     $this->assertReference($test, SimpleMock::injectTest($class));
 }
Exemple #2
0
 /**
  *    Sets up the mock, creating a generator depending on whether
  *    the function is already declared
  *    @param string $function    Name of function being mocked
  */
 function SimpleMockFunction($function)
 {
     SimpleMock::SimpleMock();
     if (function_exists($function)) {
         $this->_generator = new SimpleDeclaredFunctionGenerator($function);
     } else {
         $this->_generator = new SimpleUndeclaredFunctionGenerator($function);
     }
 }
 function __construct()
 {
     parent::__construct();
 }
 /**
  *    Resolves the dependency on the test case.
  *    @param string $class      Key to look up test case in.
  *    @return SimpleTestCase    Test case to send results to.
  *    @access public
  *    @static
  */
 function &injectTest($key)
 {
     $registry =& SimpleMock::_getRegistry();
     return $registry[$key];
 }