aGlobals =& $_aGlobals; } public static function markPending($sMessage = "Not Implemented") { self::markTestIncomplete($sMessage); } public static function getSubclasses() { $aClasses = array(); foreach (get_declared_classes() as $sClassName) { if (is_subclass_of($sClassName, 'CucumberSteps') && (stripos($sClassName,"Mock") === false)) $aClasses[] = $sClassName; } return $aClasses; } /** * @param $sMethod * @return mixed */ function invoke($sMethod) { return $this->$sMethod(); } /** * @static * @param $sClass * @param $oMock * @return void * * Allows tests to set mock hooks to be used */ static function setMock($sClass, $oMock) { self::$aMocks[$sClass] = $oMock; } static function clearMocks() { self::$aMocks = array(); } /** * @static * @param $sClass * @param $aGlobals * @return * * Get an instance of a hook which is either a pre-set mock, * or an instance of the appropriate step class with the globals initialized */ static function getInstance($sClass, &$aGlobals) { if (array_key_exists($sClass, self::$aMocks) && self::$aMocks[$sClass]) { return self::$aMocks[$sClass]; } else { return new $sClass($aGlobals); } } public function __set($sName, $sValue) { $this->aGlobals[$sName] = $sValue; } public function __get($sName) { if (array_key_exists($sName, $this->aGlobals)) { return $this->aGlobals[$sName]; } else { trigger_error("Property ($sName) not defined... can be one of [" . implode(",",array_keys($this->aGlobals)) . "]", E_USER_ERROR); } } public function __unset($sName) { unset($this->aGlobals[$sName]); } public function __isset($sName) { return isset($this->aGlobals[$sName]); } } ?>