/** * @param ReflectionClass $theClass * @param Stagehand_TestRunner_Config $config * @return boolean */ protected function shouldExclude(ReflectionClass $class, ReflectionMethod $method) { if (is_null($this->config->phpunitConfigFile)) { return false; } $groups = PHPUnit_Util_Test::getGroups($class->getName(), $method->getName()); $shouldExclude = false; $groupConfiguration = PHPUnit_Util_Configuration::getInstance($this->config->phpunitConfigFile)->getGroupConfiguration(); if (array_key_exists('include', $groupConfiguration) && count($groupConfiguration['include'])) { $shouldExclude = true; foreach ($groups as $group) { if (in_array($group, $groupConfiguration['include'])) { $shouldExclude = false; break; } } } if (array_key_exists('exclude', $groupConfiguration) && count($groupConfiguration['exclude'])) { foreach ($groups as $group) { if (in_array($group, $groupConfiguration['exclude'])) { $shouldExclude = true; break; } } } return $shouldExclude; }
public function tearDown() { $doc = \PHPUnit_Util_Test::parseTestMethodAnnotations(get_class($this), $this->getName(false)); if (isset($doc['method']['memcheck'])) { $memory = 0; // allocate variable $zero = 0; // allocate zero value $r = array(0, 0, 0); // allocate result for ($i = 0; $i < 3; $i++) { $memory = memory_get_usage(0); $this->data = []; $this->runTest(); unset($this->data); ION::dispatch(ION::LOOP_NONBLOCK | ION::LOOP_ONCE); // ammm, i think libevent free unpinned data-chunks in the loop (todo: analyze it) $r[$i] = memory_get_usage(0) - $memory; if ($r[$i] < 0) { // free memory possible $r[$i] = $zero; // this hack remove 8-bytes-memory-leak } } if (array_sum($r)) { $this->fail("Memory leak detected: +" . implode(" B, +", $r) . " B"); } } }
/** * Constructor adds test groups defined on global level * and adds additional logic for test names retrieval * * @see PHPUnit_Framework_TestSuite::__construct() */ public function __construct($theClass = '', $groups = array()) { if (!$theClass instanceof ReflectionClass) { $theClass = EcomDev_Utils_Reflection::getReflection($theClass); } // Check annotations for test case name $annotations = PHPUnit_Util_Test::parseTestMethodAnnotations($theClass->getName()); if (isset($annotations['name'])) { $this->suiteName = $annotations['name']; } // Creates all test instances parent::__construct($theClass); // Just sort-out them by our internal groups foreach ($groups as $group) { $this->groups[$group] = $this->tests(); } foreach ($this->tests() as $test) { if ($test instanceof PHPUnit_Framework_TestSuite) { /* @todo * Post an issue into PHPUnit bugtracker for * impossibility for specifying group by parent test case * Because it is a very dirty hack :( **/ $testGroups = array(); foreach ($groups as $group) { $testGroups[$group] = $test->tests(); } EcomDev_Utils_Reflection::setRestrictedPropertyValue($test, 'groups', $testGroups); } } // Remove un grouped tests group, if it exists if (isset($this->groups[self::NO_GROUP_KEYWORD])) { unset($this->groups[self::NO_GROUP_KEYWORD]); } }
/** * Start and clear caching proxy server if test is annotated with @clearCache */ protected function setUp() { $annotations = \PHPUnit_Util_Test::parseTestMethodAnnotations(get_class($this), $this->getName()); if (isset($annotations['class']['clearCache']) || isset($annotations['method']['clearCache'])) { $this->getProxy()->clear(); } }
public function beforeClass(SuiteEvent $e) { foreach ($e->getSuite()->tests() as $test) { /** @var $test \PHPUnit_Framework_Test * */ $testClass = get_class($test); $this->hooks[$testClass] = \PHPUnit_Util_Test::getHookMethods($testClass); } $this->runHooks('beforeClass'); }
protected function executeAfterMethods($testMethod, $I) { $annotations = \PHPUnit_Util_Test::parseTestMethodAnnotations(get_class($this->testClassInstance), $testMethod); if (!empty($annotations['method']['after'])) { foreach ($annotations['method']['after'] as $m) { $this->executeContextMethod(trim($m), $I); } } }
/** * Check if the method has valid @covers and @uses tags * * @param string $class * @param string $method * * @return bool */ public static function isValidMethod($class, $method) { try { Test::getLinesToBeCovered($class, $method); } catch (CodeCoverageException $e) { return false; } return true; }
public function endTest(\PHPUnit_Framework_Test $test, $time) { if ($test instanceof \PHPUnit_Framework_TestCase) { $groups = \PHPUnit_Util_Test::getGroups(get_class($test), $test->getName()); if (in_array('time-sensitive', $groups, true)) { ClockMock::withClockMock(false); } } }
protected static function makeSuite($className, $group = null) { $suite = new PHPUnit_Framework_TestSuite(); $suite->setName($className); $class = new ReflectionClass($className); $parser = new Parser(); $parser->startExternalParse(Title::newMainPage(), new ParserOptions(), Parser::OT_HTML, true); foreach (self::$engineConfigurations as $engineName => $opts) { if ($group !== null && $group !== $engineName) { continue; } try { $engineClass = "Scribunto_{$engineName}Engine"; $engine = new $engineClass(self::$engineConfigurations[$engineName] + array('parser' => $parser)); $engine->setTitle($parser->getTitle()); $engine->getInterpreter(); } catch (Scribunto_LuaInterpreterNotFoundError $e) { $suite->addTest(new $className('skipUnavailable', array(), '', $engineName), array('Lua', $engineName)); continue; } // Work around PHPUnit breakage: the only straightforward way to // get the data provider is to call // PHPUnit_Util_Test::getProvidedData, but that instantiates the // class without passing any parameters to the constructor. But we // *need* that engine name. self::$staticEngineName = $engineName; $engineSuite = new PHPUnit_Framework_TestSuite(); $engineSuite->setName("{$engineName}: {$className}"); foreach ($class->getMethods() as $method) { if (PHPUnit_Framework_TestSuite::isPublicTestMethod($method)) { $name = $method->getName(); $groups = PHPUnit_Util_Test::getGroups($className, $name); $groups[] = 'Lua'; $groups[] = $engineName; $groups = array_unique($groups); $data = PHPUnit_Util_Test::getProvidedData($className, $name); if (is_array($data) || $data instanceof Iterator) { // with @dataProvider $dataSuite = new PHPUnit_Framework_TestSuite_DataProvider($className . '::' . $name); foreach ($data as $k => $v) { $dataSuite->addTest(new $className($name, $v, $k, $engineName), $groups); } $engineSuite->addTest($dataSuite); } elseif ($data === false) { // invalid @dataProvider $engineSuite->addTest(new PHPUnit_Framework_Warning("The data provider specified for {$className}::{$name} is invalid.")); } else { // no @dataProvider $engineSuite->addTest(new $className($name, array(), '', $engineName), $groups); } } } $suite->addTest($engineSuite); } return $suite; }
protected function enhancePhpunitTest(\PHPUnit_Framework_TestCase $test) { $className = get_class($test); $methodName = $test->getName(false); $dependencies = \PHPUnit_Util_Test::getDependencies($className, $methodName); $test->setDependencies($dependencies); if ($test instanceof TestCaseFormat) { $test->getMetadata()->setDependencies($dependencies); $test->getMetadata()->setEnv(Annotation::forMethod($test, $methodName)->fetchAll('env')); } }
public function beforeClass(SuiteEvent $e) { foreach ($e->getSuite()->tests() as $test) { /** @var $test \PHPUnit_Framework_Test * */ if ($test instanceof \PHPUnit_Framework_TestSuite_DataProvider) { $potentialTestClass = strstr($test->getName(), '::', true); $this->hooks[$potentialTestClass] = \PHPUnit_Util_Test::getHookMethods($potentialTestClass); } $testClass = get_class($test); $this->hooks[$testClass] = \PHPUnit_Util_Test::getHookMethods($testClass); } $this->runHooks('beforeClass'); }
/** * @return boolean */ public function accept() { $test = $this->getInnerIterator()->current(); if ($test instanceof PHPUnit_Framework_TestSuite) { return TRUE; } $tmp = PHPUnit_Util_Test::describe($test, FALSE); if ($tmp[0] != '') { $name = join('::', $tmp); } else { $name = $tmp[1]; } return preg_match($this->filter, $name); }
protected function enhancePhpunitTest(\PHPUnit_Framework_TestCase $test) { $className = get_class($test); $methodName = $test->getName(false); $dependencies = \PHPUnit_Util_Test::getDependencies($className, $methodName); $test->setDependencies($dependencies); if ($test instanceof UnitFormat) { $feature = $test->getName(); $feature = preg_replace('/([A-Z]+)([A-Z][a-z])/', '\\1 \\2', $feature); $feature = preg_replace('/([a-z\\d])([A-Z])/', '\\1 \\2', $feature); $test->getMetadata()->setFeature(strtolower($feature)); $test->getMetadata()->setDependencies($dependencies); $test->getMetadata()->setEnv(Annotation::forMethod($test, $methodName)->fetchAll('env')); } }
public function endTest(\PHPUnit_Framework_Test $test, $time) { parent::endTest($test, $time); if ($this->debug) { foreach ($this->timeColors as $threshold => $color) { if ($time >= $threshold) { $timeColor = $color; break; } } $this->write(' '); $this->writeWithColor($timeColor, '[' . number_format($time, 3) . 's]', false); $this->write(' '); $this->writeWithColor('fg-cyan', \PHPUnit_Util_Test::describe($test), true); } }
public function codeCoverageEnd($status, $time) { $codeCoverage = $this->getTestResultObject()->getCodeCoverage(); if (!$codeCoverage) { return; } $linesToBeCovered = \PHPUnit_Util_Test::getLinesToBeCovered(get_class($this->testClassInstance), 'test'); $linesToBeUsed = \PHPUnit_Util_Test::getLinesToBeUsed(get_class($this->testClassInstance), 'test'); try { $codeCoverage->stop(true, $linesToBeCovered, $linesToBeUsed); } catch (\PHP_CodeCoverage_Exception $cce) { if ($status === \Codeception\Test\Test::STATUS_OK) { $this->getTestResultObject()->addError($this, $cce, $time); } } }
/** * @constructor * @param string $theClass * @param string $name */ public function __construct($theClass = '', $name = '') { $this->initObjectManager(); $this->appStateFactory = $this->objectManager->get('Mtf\\App\\State\\StateFactory'); /** @var $applicationStateIterator \Mtf\Util\Iterator\ApplicationState */ $applicationStateIterator = $this->objectManager->create('Mtf\\Util\\Iterator\\ApplicationState'); while ($applicationStateIterator->valid()) { $appState = $applicationStateIterator->current(); $callback = [$this, 'appStateCallback']; /** @var $suite \Mtf\TestSuite\TestCase */ $suite = $this->objectManager->create('Mtf\\TestSuite\\TestCase', ['name' => $appState['name']]); $suite->setCallback($callback, $appState); $this->addTest($suite, \PHPUnit_Util_Test::getGroups(get_class($suite), $suite->getName())); $applicationStateIterator->next(); } parent::__construct('Application State Runner'); }
/** * @return bool */ public function accept() { $test = $this->getInnerIterator()->current(); if ($test instanceof PHPUnit_Framework_TestSuite) { return TRUE; } $tmp = PHPUnit_Util_Test::describe($test, FALSE); if ($tmp[0] != '') { $name = implode('::', $tmp); } else { $name = $tmp[1]; } $accepted = preg_match($this->filter, $name, $matches); if ($accepted && isset($this->filterMax)) { $set = end($matches); $accepted = $set >= $this->filterMin && $set <= $this->filterMax; } return $accepted; }
/** * A test suite started. * * @param PHPUnit_Framework_TestSuite $suite */ public function startTestSuite(PHPUnit_Framework_TestSuite $suite) { if ($this->firstLevelTestSuite === null) { Mage::dispatchEvent('phpunit_suite_start_before', array('suite' => $suite, 'listener' => $this)); // Apply app substitution for tests if ($this->getAppReflection()->hasMethod('applyTestScope')) { $this->getAppReflection()->getMethod('applyTestScope')->invoke(null); } $this->firstLevelTestSuite = $suite; Mage::dispatchEvent('phpunit_suite_start_after', array('suite' => $suite, 'listener' => $this)); } if (EcomDev_Utils_Reflection::getRestrictedPropertyValue($suite, 'testCase')) { Mage::dispatchEvent('phpunit_test_case_start_before', array('suite' => $suite, 'listener' => $this)); EcomDev_PHPUnit_Test_Case_Util::getFixture($suite->getName())->setScope(EcomDev_PHPUnit_Model_FixtureInterface::SCOPE_SHARED)->loadForClass($suite->getName()); $annotations = PHPUnit_Util_Test::parseTestMethodAnnotations($suite->getName()); EcomDev_PHPUnit_Test_Case_Util::getFixture($suite->getName())->setOptions($annotations['class'])->apply(); Mage::dispatchEvent('phpunit_test_case_start_after', array('suite' => $suite, 'listener' => $this)); } }
/** * Composes a TestSuite from a TestCaseClass or uses $staticProperties['phantomPath'] * for creation of a TestSuite from a folder. * * @param string $className extending PHPUnit_Extensions_PhantomTestCase * @return PHPUnit_Extensions_PhantomTestSuite */ public static function addTestsFromTestCaseClass($className) { $suite = new self(); $suite->setName($className); // use Ref to allow access to class properties $class = new ReflectionClass($className); $classGroups = PHPUnit_Util_Test::getGroups($className); $staticProperties = $class->getStaticProperties(); // Tests come from Folder. // create tests from a folder with phantom .js or .coffee files if (isset($staticProperties['phantomPath']) === true) { $files = array(); if (is_dir($staticProperties['phantomPath']) === true) { $files = array_merge(self::getTestFilesFromFolder($staticProperties['phantomPath'], '.js'), self::getTestFilesFromFolder($staticProperties['phantomPath'], '.coffee')); } else { $files[] = realpath($staticProperties['phantomPath']); } // create tests from PhantomJS javascript or coffee script files foreach ($files as $file) { $basename = basename($file); $filename = str_replace(array('.js', '.coffee'), array('', ''), $basename); // exclude some javascript tests from execution, because: $excludedFiles = array('modernizr', 'jquery', 'movies', 'seasonfood', 'outputEncoding', 'sleepsort', 'stdin-stdout-stderr', 'universe', 'colorwheel', 'technews'); if (in_array($filename, $excludedFiles) === true) { continue; } // filename to testname $testname = 'test_' . str_replace('.', '_', $basename); // every Phantom test file gets its own test case (one executePhantomJS call each) $test = new PHPUnit_Extensions_Phantom_FileExecute($testname, array($file)); $suite->addTest($test, $classGroups); } } else { // Test come from a TestCaseClass. // create tests for all methods of the test case class foreach ($class->getMethods() as $method) { $suite->addTestMethod($class, $method); } } return $suite; }
/** * @constructor * @param string $theClass * @param string $name */ public function __construct($theClass = '', $name = '') { $this->initObjectManager(); $this->testSuiteFactory = $this->objectManager->get('Mtf\\TestSuite\\TestSuiteFactory'); /** @var $testIterator \Mtf\Util\Iterator\TestCase */ $testIterator = $this->objectManager->create('Mtf\\Util\\Iterator\\TestCase'); while ($testIterator->valid()) { $arguments = $testIterator->current(); $class = $arguments['class']; $factory = $this->testSuiteFactory; $testCallback = $this->objectManager->create('Mtf\\TestSuite\\Callback', ['factory' => $factory, 'arguments' => $arguments, 'theClass' => $class]); $rule = $this->objectManager->get('Mtf\\TestRunner\\Rule\\SuiteComposite'); $testCaseSuite = $this->testSuiteFactory->get($class); $allow = $rule->filterSuite($testCaseSuite); if ($allow) { $this->addTest($testCallback, \PHPUnit_Util_Test::getGroups($class)); } $testIterator->next(); } parent::__construct($name); }
/** * {@inheritdoc} */ public function endTest(\PHPUnit_Framework_Test $test, $time) { $test_name = \PHPUnit_Util_Test::describe($test); if (!empty($test_name)) { $this->test_name_status = sprintf("%s (%s)\n", $test_name, sprintf("%s ms", round($time * 1000))); } if (!$this->lastTestFailed) { $this->writeProgress('.'); } if ($test instanceof \PHPUnit_Framework_TestCase) { $this->numAssertions += $test->getNumAssertions(); } elseif ($test instanceof \PHPUnit_Extensions_PhptTestCase) { $this->numAssertions++; } $this->lastTestFailed = false; if ($test instanceof \PHPUnit_Framework_TestCase) { if (method_exists($this, 'hasExpectationOnOutput') && !$test->hasExpectationOnOutput()) { $this->write($test->getActualOutput()); } } }
/** * @constructor * @param string $class * @param string $name * @param string $path */ public function __construct($class = '', $name = '', $path = '') { // we don't need parent class to collect tests, so don't call parent constructor $this->initObjectManager(); $name = $name ? $name : $class; $this->setName($name); if (is_string($class) && class_exists($class, false)) { $arguments = ['class' => $class, 'path' => $path]; $theClass = new \ReflectionClass($class); foreach ($theClass->getMethods() as $method) { if (!$this->isPublicTestMethod($method)) { continue; } $_arguments = $arguments; $methodName = $method->getName(); $_arguments['name'] = $methodName; $test = $this->objectManager->create('Mtf\\TestSuite\\InjectableMethod', $_arguments); $this->addTest($test, \PHPUnit_Util_Test::getGroups($class, $methodName)); } } $this->testCase = true; }
public function __construct(PHPUnit_Framework_TestSuite $suite, array $groups) { $groupSuites = array(); $name = $suite->getName(); foreach ($groups as $group) { $groupSuites[$group] = new PHPUnit_Framework_TestSuite($name . ' - ' . $group); $this->addTest($groupSuites[$group]); } $tests = new RecursiveIteratorIterator(new PHPUnit_Util_TestSuiteIterator($suite), RecursiveIteratorIterator::LEAVES_ONLY); foreach ($tests as $test) { if ($test instanceof PHPUnit_Framework_TestCase) { $testGroups = PHPUnit_Util_Test::getGroups(get_class($test), $test->getName(false)); foreach ($groups as $group) { foreach ($testGroups as $testGroup) { if ($group == $testGroup) { $groupSuites[$group]->addTest($test); } } } } } }
public function __construct(PHPUnit_Framework_TestSuite $suite, array $groups) { $groupSuites = array(); $name = $suite->getName(); foreach ($groups as $group) { $groupSuites[$group] = new PHPUnit_Framework_TestSuite($name . ' - ' . $group); $this->addTest($groupSuites[$group]); } $tests = new RecursiveIteratorIterator(new PHPUnit_Util_TestSuiteIterator($suite), RecursiveIteratorIterator::LEAVES_ONLY); foreach ($tests as $test) { if ($test instanceof PHPUnit_Framework_TestCase) { $class = new ReflectionClass($test); $method = $class->getMethod($test->getName(FALSE)); $testGroups = PHPUnit_Util_Test::getGroups($method->getDocComment(), PHPUnit_Util_Test::getGroups($class)); foreach ($groups as $group) { foreach ($testGroups as $testGroup) { if ($group == $testGroup) { $groupSuites[$group]->addTest($test); } } } } } }
/** * Runs the bare test sequence. */ public function runBare() { $this->numAssertions = 0; $this->snapshotGlobalState(); $this->startOutputBuffering(); clearstatcache(); $currentWorkingDirectory = getcwd(); $hookMethods = PHPUnit_Util_Test::getHookMethods(get_class($this)); try { $hasMetRequirements = false; $this->checkRequirements(); $hasMetRequirements = true; if ($this->inIsolation) { foreach ($hookMethods['beforeClass'] as $method) { $this->{$method}(); } } $this->setExpectedExceptionFromAnnotation(); foreach ($hookMethods['before'] as $method) { $this->{$method}(); } $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 (PredictionException $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(); } // Clean up the mock objects. $this->mockObjects = array(); $this->prophet = null; // Tear down the fixture. An exception raised in tearDown() will be // caught and passed on when no exception was raised before. try { if ($hasMetRequirements) { foreach ($hookMethods['after'] as $method) { $this->{$method}(); } if ($this->inIsolation) { foreach ($hookMethods['afterClass'] as $method) { $this->{$method}(); } } } } catch (Exception $_e) { if (!isset($e)) { $e = $_e; } } try { $this->stopOutputBuffering(); } catch (PHPUnit_Framework_RiskyTestError $_e) { if (!isset($e)) { $e = $_e; } } clearstatcache(); if ($currentWorkingDirectory != getcwd()) { chdir($currentWorkingDirectory); } $this->restoreGlobalState(); // Clean up INI settings. foreach ($this->iniSettings as $varName => $oldValue) { ini_set($varName, $oldValue); } $this->iniSettings = array(); // Clean up locale settings. foreach ($this->locale as $category => $locale) { setlocale($category, $locale); } // Perform assertion on output. if (!isset($e)) { try { if ($this->outputExpectedRegex !== null) { $this->assertRegExp($this->outputExpectedRegex, $this->output); } elseif ($this->outputExpectedString !== null) { $this->assertEquals($this->outputExpectedString, $this->output); } } catch (Exception $_e) { $e = $_e; } } // Workaround for missing "finally". if (isset($e)) { if ($e instanceof PredictionException) { $e = new PHPUnit_Framework_AssertionFailedError($e->getMessage()); } $this->onNotSuccessfulTest($e); } }
public function groupsForTest(\PHPUnit_Framework_Test $test) { $groups = []; if ($test instanceof ScenarioDriven) { $groups = $test->getScenario()->getGroups(); } if ($test instanceof Reported) { $info = $test->getReportFields(); if (isset($info['class'])) { $groups = array_merge($groups, \PHPUnit_Util_Test::getGroups($info['class'], $info['name'])); } $filename = $info['file']; } else { $groups = array_merge($groups, \PHPUnit_Util_Test::getGroups(get_class($test), $test->getName(false))); $filename = (new \ReflectionClass($test))->getFileName(); } foreach ($this->testsInGroups as $group => $tests) { foreach ($tests as $testPattern) { if ($filename == $testPattern) { $groups[] = $group; } if (strpos($filename . ':' . $test->getName(false), $testPattern) === 0) { $groups[] = $group; } } } return array_unique($groups); }
/** * A test ended. * * @param PHPUnit_Framework_Test $test * @param float $time */ public function endTest(PHPUnit_Framework_Test $test, $time) { if (!$test instanceof PHPUnit_Framework_Warning) { if ($test->getStatus() == PHPUnit_Runner_BaseTestRunner::STATUS_PASSED) { $ifStatus = array('assigned', 'new', 'reopened'); $newStatus = 'closed'; $message = 'Automatically closed by PHPUnit (test passed).'; $resolution = 'fixed'; $cumulative = TRUE; } else { if ($test->getStatus() == PHPUnit_Runner_BaseTestRunner::STATUS_FAILURE) { $ifStatus = array('closed'); $newStatus = 'reopened'; $message = 'Automatically reopened by PHPUnit (test failed).'; $resolution = ''; $cumulative = FALSE; } else { return; } } $name = $test->getName(); $tickets = PHPUnit_Util_Test::getTickets(get_class($test), $name); foreach ($tickets as $ticket) { // Remove this test from the totals (if it passed). if ($test->getStatus() == PHPUnit_Runner_BaseTestRunner::STATUS_PASSED) { unset($this->ticketCounts[$ticket][$name]); } // Only close tickets if ALL referenced cases pass // but reopen tickets if a single test fails. if ($cumulative) { // Determine number of to-pass tests: if (count($this->ticketCounts[$ticket]) > 0) { // There exist remaining test cases with this reference. $adjustTicket = FALSE; } else { // No remaining tickets, go ahead and adjust. $adjustTicket = TRUE; } } else { $adjustTicket = TRUE; } if ($adjustTicket && in_array($ticketInfo[3]['status'], $ifStatus)) { $this->updateTicket($ticket, $newStatus, $message, $resolution); } } } }
/** * @param ReflectionClass $class * @param ReflectionMethod $method */ protected function addTestMethod(ReflectionClass $class, ReflectionMethod $method) { if (!$this->isTestMethod($method)) { return; } $name = $method->getName(); if (!$method->isPublic()) { $this->addTest(self::warning(sprintf('Test method "%s" in test class "%s" is not public.', $name, $class->getName()))); return; } $test = self::createTest($class, $name); if ($test instanceof PHPUnit_Framework_TestCase || $test instanceof PHPUnit_Framework_TestSuite_DataProvider) { $test->setDependencies(PHPUnit_Util_Test::getDependencies($class->getName(), $name)); } $this->addTest($test, PHPUnit_Util_Test::getGroups($class->getName(), $name)); }
/** * @since Method available since Release 3.4.0 */ protected function setUseOutputBufferingFromAnnotation() { try { $useOutputBuffering = PHPUnit_Util_Test::getOutputBufferingSettings(get_class($this), $this->name); if ($useOutputBuffering !== NULL) { $this->setUseOutputBuffering($useOutputBuffering); } } catch (ReflectionException $e) { } }
/** * A test started. * * @param PHPUnit_Framework_Test $test */ public function startTest(PHPUnit_Framework_Test $test) { $this->currentTestName = PHPUnit_Util_Test::describe($test); $this->currentTestPass = TRUE; $this->write("\n"); $this->write(sprintf('test started: %s', $this->currentTestName)); }