<?php
abstract class PHPUnit_Framework_TestCase extends PHPUnit_Framework_Assert implements PHPUnit_Framework_Test, PHPUnit_Framework_SelfDescribing {
protected $backupGlobals = NULL;
protected $backupGlobalsBlacklist = array();
protected $backupStaticAttributes = NULL;
protected $backupStaticAttributesBlacklist = array();
protected $runTestInSeparateProcess = NULL;
protected $preserveGlobalState = TRUE;
private $inIsolation = FALSE;
private $data = array();
private $dataName = '';
private $useErrorHandler = NULL;
private $useOutputBuffering = NULL;
private $expectedException = NULL;
private $expectedExceptionMessage = '';
private $expectedExceptionCode;
private $required = array(
'PHP' => NULL,
'PHPUnit' => NULL,
'functions' => array(),
'extensions' => array(),
);
private $name = NULL;
private $dependencies = array();
private $dependencyInput = array();
private $iniSettings = array();
private $locale = array();
private $mockObjects = array();
private $status;
private $statusMessage = '';
private $numAssertions = 0;
private $result;
private $testResult;
private $output = '';
private $outputExpectedRegex = NULL;
private $outputExpectedString = NULL;
private $hasPerformedExpectationsOnOutput = FALSE;
private $outputCallback = FALSE;
private $outputBufferingActive = FALSE;
public function __construct($name = NULL, array $data = array(), $dataName = '') {
if ($name !== NULL) {
$this
->setName($name);
}
$this->data = $data;
$this->dataName = $dataName;
}
public function toString() {
$class = new ReflectionClass($this);
$buffer = sprintf('%s::%s', $class->name, $this
->getName(FALSE));
return $buffer . $this
->getDataSetAsString();
}
public function count() {
return 1;
}
public function getAnnotations() {
return PHPUnit_Util_Test::parseTestMethodAnnotations(get_class($this), $this->name);
}
public function getName($withDataSet = TRUE) {
if ($withDataSet) {
return $this->name . $this
->getDataSetAsString(FALSE);
}
else {
return $this->name;
}
}
public function getSize() {
return PHPUnit_Util_Test::getSize(get_class($this), $this
->getName(FALSE));
}
public function getActualOutput() {
if (!$this->outputBufferingActive) {
return $this->output;
}
else {
return ob_get_contents();
}
}
public function hasOutput() {
if (strlen($this->output) === 0) {
return FALSE;
}
if ($this->outputExpectedString !== NULL || $this->outputExpectedRegex !== NULL || $this->hasPerformedExpectationsOnOutput) {
return FALSE;
}
return TRUE;
}
public function expectOutputRegex($expectedRegex) {
if ($this->outputExpectedString !== NULL) {
throw new PHPUnit_Framework_Exception();
}
if (is_string($expectedRegex) || is_null($expectedRegex)) {
$this->outputExpectedRegex = $expectedRegex;
}
}
public function expectOutputString($expectedString) {
if ($this->outputExpectedRegex !== NULL) {
throw new PHPUnit_Framework_Exception();
}
if (is_string($expectedString) || is_null($expectedString)) {
$this->outputExpectedString = $expectedString;
}
}
public function hasPerformedExpectationsOnOutput() {
return $this->hasPerformedExpectationsOnOutput;
}
public function getExpectedException() {
return $this->expectedException;
}
public function setExpectedException($exceptionName, $exceptionMessage = '', $exceptionCode = NULL) {
$this->expectedException = $exceptionName;
$this->expectedExceptionMessage = $exceptionMessage;
$this->expectedExceptionCode = $exceptionCode;
}
protected function setExpectedExceptionFromAnnotation() {
try {
$expectedException = PHPUnit_Util_Test::getExpectedException(get_class($this), $this->name);
if ($expectedException !== FALSE) {
$this
->setExpectedException($expectedException['class'], $expectedException['message'], $expectedException['code']);
}
} catch (ReflectionException $e) {
}
}
public function setUseErrorHandler($useErrorHandler) {
$this->useErrorHandler = $useErrorHandler;
}
protected function setUseErrorHandlerFromAnnotation() {
try {
$useErrorHandler = PHPUnit_Util_Test::getErrorHandlerSettings(get_class($this), $this->name);
if ($useErrorHandler !== NULL) {
$this
->setUseErrorHandler($useErrorHandler);
}
} catch (ReflectionException $e) {
}
}
public function setUseOutputBuffering($useOutputBuffering) {
$this->useOutputBuffering = $useOutputBuffering;
}
protected function setUseOutputBufferingFromAnnotation() {
try {
$useOutputBuffering = PHPUnit_Util_Test::getOutputBufferingSettings(get_class($this), $this->name);
if ($useOutputBuffering !== NULL) {
$this
->setUseOutputBuffering($useOutputBuffering);
}
} catch (ReflectionException $e) {
}
}
protected function setRequirementsFromAnnotation() {
try {
$requirements = PHPUnit_Util_Test::getRequirements(get_class($this), $this->name);
if (isset($requirements['PHP'])) {
$this->required['PHP'] = $requirements['PHP'];
}
if (isset($requirements['PHPUnit'])) {
$this->required['PHPUnit'] = $requirements['PHPUnit'];
}
if (isset($requirements['extensions'])) {
$this->required['extensions'] = $requirements['extensions'];
}
if (isset($requirements['functions'])) {
$this->required['functions'] = $requirements['functions'];
}
} catch (ReflectionException $e) {
}
}
protected function checkRequirements() {
$this
->setRequirementsFromAnnotation();
$missingRequirements = array();
if ($this->required['PHP'] && version_compare(PHP_VERSION, $this->required['PHP'], '<')) {
$missingRequirements[] = sprintf('PHP %s (or later) is required.', $this->required['PHP']);
}
$phpunitVersion = PHPUnit_Runner_Version::id();
if ($this->required['PHPUnit'] && version_compare($phpunitVersion, $this->required['PHPUnit'], '<')) {
$missingRequirements[] = sprintf('PHPUnit %s (or later) is required.', $this->required['PHPUnit']);
}
foreach ($this->required['functions'] as $requiredFunction) {
if (!function_exists($requiredFunction)) {
$missingRequirements[] = sprintf('Function %s is required.', $requiredFunction);
}
}
foreach ($this->required['extensions'] as $requiredExtension) {
if (!extension_loaded($requiredExtension)) {
$missingRequirements[] = sprintf('Extension %s is required.', $requiredExtension);
}
}
if ($missingRequirements) {
$this
->markTestSkipped(implode(PHP_EOL, $missingRequirements));
}
}
public function getStatus() {
return $this->status;
}
public function getStatusMessage() {
return $this->statusMessage;
}
public function hasFailed() {
$status = $this
->getStatus();
return $status == PHPUnit_Runner_BaseTestRunner::STATUS_FAILURE || $status == PHPUnit_Runner_BaseTestRunner::STATUS_ERROR;
}
public function run(PHPUnit_Framework_TestResult $result = NULL) {
if ($result === NULL) {
$result = $this
->createResult();
}
if (!$this instanceof PHPUnit_Framework_Warning) {
$this
->setTestResultObject($result);
$this
->setUseErrorHandlerFromAnnotation();
$this
->setUseOutputBufferingFromAnnotation();
}
if ($this->useErrorHandler !== NULL) {
$oldErrorHandlerSetting = $result
->getConvertErrorsToExceptions();
$result
->convertErrorsToExceptions($this->useErrorHandler);
}
if (!$this instanceof PHPUnit_Framework_Warning && !$this
->handleDependencies()) {
return;
}
if ($this->runTestInSeparateProcess === TRUE && $this->inIsolation !== TRUE && !$this instanceof PHPUnit_Extensions_SeleniumTestCase && !$this instanceof PHPUnit_Extensions_PhptTestCase) {
$class = new ReflectionClass($this);
$template = new Text_Template(sprintf('%s%sProcess%sTestCaseMethod.tpl', __DIR__, DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR));
if ($this->preserveGlobalState) {
$constants = PHPUnit_Util_GlobalState::getConstantsAsString();
$globals = PHPUnit_Util_GlobalState::getGlobalsAsString();
$includedFiles = PHPUnit_Util_GlobalState::getIncludedFilesAsString();
}
else {
$constants = '';
$globals = '';
$includedFiles = '';
}
if ($result
->getCollectCodeCoverageInformation()) {
$coverage = 'TRUE';
}
else {
$coverage = 'FALSE';
}
if ($result
->isStrict()) {
$strict = 'TRUE';
}
else {
$strict = 'FALSE';
}
if (defined('PHPUNIT_COMPOSER_INSTALL')) {
$composerAutoload = var_export(PHPUNIT_COMPOSER_INSTALL, TRUE);
}
else {
$composerAutoload = '\'\'';
}
$data = var_export(serialize($this->data), TRUE);
$dependencyInput = var_export(serialize($this->dependencyInput), TRUE);
$includePath = var_export(get_include_path(), TRUE);
$data = "'." . $data . ".'";
$dependencyInput = "'." . $dependencyInput . ".'";
$includePath = "'." . $includePath . ".'";
$template
->setVar(array(
'composerAutoload' => $composerAutoload,
'filename' => $class
->getFileName(),
'className' => $class
->getName(),
'methodName' => $this->name,
'collectCodeCoverageInformation' => $coverage,
'data' => $data,
'dataName' => $this->dataName,
'dependencyInput' => $dependencyInput,
'constants' => $constants,
'globals' => $globals,
'include_path' => $includePath,
'included_files' => $includedFiles,
'strict' => $strict,
));
$this
->prepareTemplate($template);
$php = PHPUnit_Util_PHP::factory();
$php
->runJob($template
->render(), $this, $result);
}
else {
$result
->run($this);
}
if ($this->useErrorHandler !== NULL) {
$result
->convertErrorsToExceptions($oldErrorHandlerSetting);
}
$this->result = NULL;
return $result;
}
public function runBare() {
$this->numAssertions = 0;
if ($this->runTestInSeparateProcess !== TRUE && $this->inIsolation !== TRUE) {
if ($this->backupGlobals === NULL || $this->backupGlobals === TRUE) {
PHPUnit_Util_GlobalState::backupGlobals($this->backupGlobalsBlacklist);
}
if ($this->backupStaticAttributes === TRUE) {
PHPUnit_Util_GlobalState::backupStaticAttributes($this->backupStaticAttributesBlacklist);
}
}
ob_start();
$this->outputBufferingActive = TRUE;
clearstatcache();
$currentWorkingDirectory = getcwd();
try {
if ($this->inIsolation) {
$this
->setUpBeforeClass();
}
$this
->setExpectedExceptionFromAnnotation();
$this
->setUp();
$this
->checkRequirements();
$this
->assertPreConditions();
$this->testResult = $this
->runTest();
$this
->verifyMockObjects();
$this
->assertPostConditions();
$this->status = PHPUnit_Runner_BaseTestRunner::STATUS_PASSED;
} catch (PHPUnit_Framework_IncompleteTest $e) {
$this->status = PHPUnit_Runner_BaseTestRunner::STATUS_INCOMPLETE;
$this->statusMessage = $e
->getMessage();
} catch (PHPUnit_Framework_SkippedTest $e) {
$this->status = PHPUnit_Runner_BaseTestRunner::STATUS_SKIPPED;
$this->statusMessage = $e
->getMessage();
} catch (PHPUnit_Framework_AssertionFailedError $e) {
$this->status = PHPUnit_Runner_BaseTestRunner::STATUS_FAILURE;
$this->statusMessage = $e
->getMessage();
} catch (Exception $e) {
$this->status = PHPUnit_Runner_BaseTestRunner::STATUS_ERROR;
$this->statusMessage = $e
->getMessage();
}
$this->mockObjects = array();
try {
$this
->tearDown();
if ($this->inIsolation) {
$this
->tearDownAfterClass();
}
} catch (Exception $_e) {
if (!isset($e)) {
$e = $_e;
}
}
if ($this->outputCallback === FALSE) {
$this->output = ob_get_contents();
}
else {
$this->output = call_user_func_array($this->outputCallback, array(
ob_get_contents(),
));
}
ob_end_clean();
$this->outputBufferingActive = FALSE;
clearstatcache();
if ($currentWorkingDirectory != getcwd()) {
chdir($currentWorkingDirectory);
}
if ($this->runTestInSeparateProcess !== TRUE && $this->inIsolation !== TRUE) {
if ($this->backupGlobals === NULL || $this->backupGlobals === TRUE) {
PHPUnit_Util_GlobalState::restoreGlobals($this->backupGlobalsBlacklist);
}
if ($this->backupStaticAttributes === TRUE) {
PHPUnit_Util_GlobalState::restoreStaticAttributes();
}
}
foreach ($this->iniSettings as $varName => $oldValue) {
ini_set($varName, $oldValue);
}
$this->iniSettings = array();
foreach ($this->locale as $category => $locale) {
setlocale($category, $locale);
}
if (!isset($e)) {
try {
if ($this->outputExpectedRegex !== NULL) {
$this->hasPerformedExpectationsOnOutput = TRUE;
$this
->assertRegExp($this->outputExpectedRegex, $this->output);
$this->outputExpectedRegex = NULL;
}
else {
if ($this->outputExpectedString !== NULL) {
$this->hasPerformedExpectationsOnOutput = TRUE;
$this
->assertEquals($this->outputExpectedString, $this->output);
$this->outputExpectedString = NULL;
}
}
} catch (Exception $_e) {
$e = $_e;
}
}
if (isset($e)) {
$this
->onNotSuccessfulTest($e);
}
}
protected function runTest() {
if ($this->name === NULL) {
throw new PHPUnit_Framework_Exception('PHPUnit_Framework_TestCase::$name must not be NULL.');
}
try {
$class = new ReflectionClass($this);
$method = $class
->getMethod($this->name);
} catch (ReflectionException $e) {
$this
->fail($e
->getMessage());
}
try {
$testResult = $method
->invokeArgs($this, array_merge($this->data, $this->dependencyInput));
} catch (Exception $e) {
$checkException = FALSE;
if (is_string($this->expectedException)) {
$checkException = TRUE;
if ($e instanceof PHPUnit_Framework_Exception) {
$checkException = FALSE;
}
$reflector = new ReflectionClass($this->expectedException);
if ($this->expectedException == 'PHPUnit_Framework_Exception' || $reflector
->isSubclassOf('PHPUnit_Framework_Exception')) {
$checkException = TRUE;
}
}
if ($checkException) {
$this
->assertThat($e, new PHPUnit_Framework_Constraint_Exception($this->expectedException));
if (is_string($this->expectedExceptionMessage) && !empty($this->expectedExceptionMessage)) {
$this
->assertThat($e, new PHPUnit_Framework_Constraint_ExceptionMessage($this->expectedExceptionMessage));
}
if ($this->expectedExceptionCode !== NULL) {
$this
->assertThat($e, new PHPUnit_Framework_Constraint_ExceptionCode($this->expectedExceptionCode));
}
return;
}
else {
throw $e;
}
}
if ($this->expectedException !== NULL) {
$this
->assertThat(NULL, new PHPUnit_Framework_Constraint_Exception($this->expectedException));
}
return $testResult;
}
protected function verifyMockObjects() {
foreach ($this->mockObjects as $mockObject) {
if ($mockObject
->__phpunit_hasMatchers()) {
$this->numAssertions++;
}
$mockObject
->__phpunit_verify();
$mockObject
->__phpunit_cleanup();
}
}
public function setName($name) {
$this->name = $name;
}
public function setDependencies(array $dependencies) {
$this->dependencies = $dependencies;
}
public function setDependencyInput(array $dependencyInput) {
$this->dependencyInput = $dependencyInput;
}
public function setBackupGlobals($backupGlobals) {
if (is_null($this->backupGlobals) && is_bool($backupGlobals)) {
$this->backupGlobals = $backupGlobals;
}
}
public function setBackupStaticAttributes($backupStaticAttributes) {
if (is_null($this->backupStaticAttributes) && is_bool($backupStaticAttributes)) {
$this->backupStaticAttributes = $backupStaticAttributes;
}
}
public function setRunTestInSeparateProcess($runTestInSeparateProcess) {
if (is_bool($runTestInSeparateProcess)) {
if ($this->runTestInSeparateProcess === NULL) {
$this->runTestInSeparateProcess = $runTestInSeparateProcess;
}
}
else {
throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'boolean');
}
}
public function setPreserveGlobalState($preserveGlobalState) {
if (is_bool($preserveGlobalState)) {
$this->preserveGlobalState = $preserveGlobalState;
}
else {
throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'boolean');
}
}
public function setInIsolation($inIsolation) {
if (is_bool($inIsolation)) {
$this->inIsolation = $inIsolation;
}
else {
throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'boolean');
}
}
public function getResult() {
return $this->testResult;
}
public function setResult($result) {
$this->testResult = $result;
}
public function setOutputCallback($callback) {
if (!is_callable($callback)) {
throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'callback');
}
$this->outputCallback = $callback;
}
public function getTestResultObject() {
return $this->result;
}
public function setTestResultObject(PHPUnit_Framework_TestResult $result) {
$this->result = $result;
}
protected function iniSet($varName, $newValue) {
if (!is_string($varName)) {
throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'string');
}
$currentValue = ini_set($varName, $newValue);
if ($currentValue !== FALSE) {
$this->iniSettings[$varName] = $currentValue;
}
else {
throw new PHPUnit_Framework_Exception(sprintf('INI setting "%s" could not be set to "%s".', $varName, $newValue));
}
}
protected function setLocale() {
$args = func_get_args();
if (count($args) < 2) {
throw new PHPUnit_Framework_Exception();
}
$category = $args[0];
$locale = $args[1];
$categories = array(
LC_ALL,
LC_COLLATE,
LC_CTYPE,
LC_MONETARY,
LC_NUMERIC,
LC_TIME,
);
if (defined('LC_MESSAGES')) {
$categories[] = LC_MESSAGES;
}
if (!in_array($category, $categories)) {
throw new PHPUnit_Framework_Exception();
}
if (!is_array($locale) && !is_string($locale)) {
throw new PHPUnit_Framework_Exception();
}
$this->locale[$category] = setlocale($category, NULL);
$result = call_user_func_array('setlocale', $args);
if ($result === FALSE) {
throw new PHPUnit_Framework_Exception('The locale functionality is not implemented on your platform, ' . 'the specified locale does not exist or the category name is ' . 'invalid.');
}
}
public function getMock($originalClassName, $methods = array(), array $arguments = array(), $mockClassName = '', $callOriginalConstructor = TRUE, $callOriginalClone = TRUE, $callAutoload = TRUE, $cloneArguments = FALSE) {
$mockObject = PHPUnit_Framework_MockObject_Generator::getMock($originalClassName, $methods, $arguments, $mockClassName, $callOriginalConstructor, $callOriginalClone, $callAutoload, $cloneArguments);
$this->mockObjects[] = $mockObject;
return $mockObject;
}
public function getMockBuilder($className) {
return new PHPUnit_Framework_MockObject_MockBuilder($this, $className);
}
protected function getMockClass($originalClassName, $methods = array(), array $arguments = array(), $mockClassName = '', $callOriginalConstructor = FALSE, $callOriginalClone = TRUE, $callAutoload = TRUE, $cloneArguments = FALSE) {
$mock = $this
->getMock($originalClassName, $methods, $arguments, $mockClassName, $callOriginalConstructor, $callOriginalClone, $callAutoload, $cloneArguments);
return get_class($mock);
}
public function getMockForAbstractClass($originalClassName, array $arguments = array(), $mockClassName = '', $callOriginalConstructor = TRUE, $callOriginalClone = TRUE, $callAutoload = TRUE, $mockedMethods = array(), $cloneArguments = FALSE) {
$mockObject = PHPUnit_Framework_MockObject_Generator::getMockForAbstractClass($originalClassName, $arguments, $mockClassName, $callOriginalConstructor, $callOriginalClone, $callAutoload, $mockedMethods, $cloneArguments);
$this->mockObjects[] = $mockObject;
return $mockObject;
}
protected function getMockFromWsdl($wsdlFile, $originalClassName = '', $mockClassName = '', array $methods = array(), $callOriginalConstructor = TRUE) {
if ($originalClassName === '') {
$originalClassName = str_replace('.wsdl', '', basename($wsdlFile));
}
if (!class_exists($originalClassName)) {
eval(PHPUnit_Framework_MockObject_Generator::generateClassFromWsdl($wsdlFile, $originalClassName, $methods));
}
return $this
->getMock($originalClassName, $methods, array(
'',
array(),
), $mockClassName, $callOriginalConstructor, FALSE, FALSE);
}
protected function getObjectForTrait($traitName, array $arguments = array(), $traitClassName = '', $callOriginalConstructor = TRUE, $callOriginalClone = TRUE, $callAutoload = TRUE, $cloneArguments = FALSE) {
return PHPUnit_Framework_MockObject_Generator::getObjectForTrait($traitName, $arguments, $traitClassName, $callOriginalConstructor, $callOriginalClone, $callAutoload, $cloneArguments);
}
public function addToAssertionCount($count) {
$this->numAssertions += $count;
}
public function getNumAssertions() {
return $this->numAssertions;
}
public static function any() {
return new PHPUnit_Framework_MockObject_Matcher_AnyInvokedCount();
}
public static function never() {
return new PHPUnit_Framework_MockObject_Matcher_InvokedCount(0);
}
public static function atLeastOnce() {
return new PHPUnit_Framework_MockObject_Matcher_InvokedAtLeastOnce();
}
public static function once() {
return new PHPUnit_Framework_MockObject_Matcher_InvokedCount(1);
}
public static function exactly($count) {
return new PHPUnit_Framework_MockObject_Matcher_InvokedCount($count);
}
public static function at($index) {
return new PHPUnit_Framework_MockObject_Matcher_InvokedAtIndex($index);
}
public static function returnValue($value) {
return new PHPUnit_Framework_MockObject_Stub_Return($value);
}
public static function returnValueMap(array $valueMap) {
return new PHPUnit_Framework_MockObject_Stub_ReturnValueMap($valueMap);
}
public static function returnArgument($argumentIndex) {
return new PHPUnit_Framework_MockObject_Stub_ReturnArgument($argumentIndex);
}
public static function returnCallback($callback) {
return new PHPUnit_Framework_MockObject_Stub_ReturnCallback($callback);
}
public static function returnSelf() {
return new PHPUnit_Framework_MockObject_Stub_ReturnSelf();
}
public static function throwException(Exception $exception) {
return new PHPUnit_Framework_MockObject_Stub_Exception($exception);
}
public static function onConsecutiveCalls() {
$args = func_get_args();
return new PHPUnit_Framework_MockObject_Stub_ConsecutiveCalls($args);
}
protected function dataToString($data) {
$result = array();
preg_match_all('/\\n \\[(\\w+)\\] => Array\\s+\\*RECURSION\\*/', print_r($data, TRUE), $matches);
$recursiveKeys = array_unique($matches[1]);
foreach ($recursiveKeys as $key => $recursiveKey) {
if ((string) (int) $recursiveKey === $recursiveKey) {
$recursiveKeys[$key] = (int) $recursiveKey;
}
}
foreach ($data as $key => $_data) {
if (in_array($key, $recursiveKeys, TRUE)) {
$result[] = '*RECURSION*';
}
else {
if (is_array($_data)) {
$result[] = 'array(' . $this
->dataToString($_data) . ')';
}
else {
if (is_object($_data)) {
$object = new ReflectionObject($_data);
if ($object
->hasMethod('__toString')) {
$result[] = (string) $_data;
}
else {
$result[] = get_class($_data);
}
}
else {
if (is_resource($_data)) {
$result[] = '<resource>';
}
else {
$result[] = var_export($_data, TRUE);
}
}
}
}
}
return join(', ', $result);
}
protected function getDataSetAsString($includeData = TRUE) {
$buffer = '';
if (!empty($this->data)) {
if (is_int($this->dataName)) {
$buffer .= sprintf(' with data set #%d', $this->dataName);
}
else {
$buffer .= sprintf(' with data set "%s"', $this->dataName);
}
if ($includeData) {
$buffer .= sprintf(' (%s)', $this
->dataToString($this->data));
}
}
return $buffer;
}
protected function createResult() {
return new PHPUnit_Framework_TestResult();
}
protected function handleDependencies() {
if (!empty($this->dependencies) && !$this->inIsolation) {
$className = get_class($this);
$passed = $this->result
->passed();
$passedKeys = array_keys($passed);
$numKeys = count($passedKeys);
for ($i = 0; $i < $numKeys; $i++) {
$pos = strpos($passedKeys[$i], ' with data set');
if ($pos !== FALSE) {
$passedKeys[$i] = substr($passedKeys[$i], 0, $pos);
}
}
$passedKeys = array_flip(array_unique($passedKeys));
foreach ($this->dependencies as $dependency) {
if (strpos($dependency, '::') === FALSE) {
$dependency = $className . '::' . $dependency;
}
if (!isset($passedKeys[$dependency])) {
$this->result
->addError($this, new PHPUnit_Framework_SkippedTestError(sprintf('This test depends on "%s" to pass.', $dependency)), 0);
return FALSE;
}
if (isset($passed[$dependency])) {
if ($passed[$dependency]['size'] > $this
->getSize()) {
$this->result
->addError($this, new PHPUnit_Framework_SkippedTestError('This test depends on a test that is larger than itself.'), 0);
return FALSE;
}
$this->dependencyInput[] = $passed[$dependency]['result'];
}
else {
$this->dependencyInput[] = NULL;
}
}
}
return TRUE;
}
public static function setUpBeforeClass() {
}
protected function setUp() {
}
protected function assertPreConditions() {
}
protected function assertPostConditions() {
}
protected function tearDown() {
}
public static function tearDownAfterClass() {
}
protected function onNotSuccessfulTest(Exception $e) {
throw $e;
}
protected function prepareTemplate(Text_Template $template) {
}
}