From 2cedd9c8312b1c7d4df34b92e1d313ec3785918d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20B=C3=BCttner?= Date: Sat, 14 Jul 2018 10:55:10 +0200 Subject: [PATCH 01/13] making data provider suites createcases lazily --- src/Framework/DataProviderTestSuite.php | 48 + src/Framework/TestSuite.php | 1788 +++++++++++------------ src/TextUI/ResultPrinter.php | 12 +- 3 files changed, 892 insertions(+), 956 deletions(-) diff --git a/src/Framework/DataProviderTestSuite.php b/src/Framework/DataProviderTestSuite.php index af119d27fc1..f34582ea606 100644 --- a/src/Framework/DataProviderTestSuite.php +++ b/src/Framework/DataProviderTestSuite.php @@ -9,8 +9,21 @@ */ namespace PHPUnit\Framework; +use Generator; +use ReflectionClass; + class DataProviderTestSuite extends TestSuite { + private $provider; + private $theClass; + private $method; + public function __construct($provider, ReflectionClass $theClass, string $method) + { + parent::__construct($theClass, $theClass->getName().'::'.$method, true); + $this->provider = $provider; + $this->theClass = $theClass; + $this->method = $method; + } /** * @var string[] */ @@ -37,4 +50,39 @@ public function hasDependencies(): bool { return \count($this->dependencies) > 0; } + + /** + * @return Generator|Test[] + */ + protected function yieldTests(): Generator + { + yield from parent::yieldTests(); + try { + $provider = $this->theClass->newInstanceArgs(); + foreach ($provider->{$this->provider}() as $name => $set) { + if(!is_array($set)) { + yield self::warning("set $name is invalid."); + continue; + } + try { + $test = $this->theClass->newInstanceArgs([ + $this->method, + $set, + $name + ]); + $test->setDependencies($this->dependencies); + yield $test; + } catch (\Throwable $e) { + yield self::warning("Test creation failed. $e"); + } + } + } catch (\Throwable $e) { + yield self::warning("data provider failed. $e"); + } + } + + public function count($preferCache = false): int + { + return 1; + } } diff --git a/src/Framework/TestSuite.php b/src/Framework/TestSuite.php index 59d129c8d13..23d2c49c30e 100644 --- a/src/Framework/TestSuite.php +++ b/src/Framework/TestSuite.php @@ -1,947 +1,841 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Framework; - -use Iterator; -use IteratorAggregate; -use PHPUnit\Runner\BaseTestRunner; -use PHPUnit\Runner\Filter\Factory; -use PHPUnit\Runner\PhptTestCase; -use PHPUnit\Util\FileLoader; -use PHPUnit\Util\InvalidArgumentHelper; -use ReflectionClass; -use ReflectionMethod; -use Throwable; - -/** - * A TestSuite is a composite of Tests. It runs a collection of test cases. - */ -class TestSuite implements Test, SelfDescribing, IteratorAggregate -{ - /** - * Enable or disable the backup and restoration of the $GLOBALS array. - * - * @var bool - */ - protected $backupGlobals; - - /** - * Enable or disable the backup and restoration of static attributes. - * - * @var bool - */ - protected $backupStaticAttributes; - - /** - * @var bool - */ - protected $runTestInSeparateProcess = false; - - /** - * The name of the test suite. - * - * @var string - */ - protected $name = ''; - - /** - * The test groups of the test suite. - * - * @var array - */ - protected $groups = []; - - /** - * The tests in the test suite. - * - * @var TestCase[] - */ - protected $tests = []; - - /** - * The number of tests in the test suite. - * - * @var int - */ - protected $numTests = -1; - - /** - * @var bool - */ - protected $testCase = false; - - /** - * @var array - */ - protected $foundClasses = []; - - /** - * Last count of tests in this suite. - * - * @var null|int - */ - private $cachedNumTests; - - /** - * @var bool - */ - private $beStrictAboutChangesToGlobalState; - - /** - * @var Factory - */ - private $iteratorFilter; - - /** - * @var string[] - */ - private $declaredClasses; - - /** - * @param string $name - * - * @throws Exception - */ - public static function createTest(ReflectionClass $theClass, $name): Test - { - $className = $theClass->getName(); - - if (!$theClass->isInstantiable()) { - return self::warning( - \sprintf('Cannot instantiate class "%s".', $className) - ); - } - - $backupSettings = \PHPUnit\Util\Test::getBackupSettings( - $className, - $name - ); - - $preserveGlobalState = \PHPUnit\Util\Test::getPreserveGlobalStateSettings( - $className, - $name - ); - - $runTestInSeparateProcess = \PHPUnit\Util\Test::getProcessIsolationSettings( - $className, - $name - ); - - $runClassInSeparateProcess = \PHPUnit\Util\Test::getClassProcessIsolationSettings( - $className, - $name - ); - - $constructor = $theClass->getConstructor(); - - if ($constructor === null) { - throw new Exception('No valid test provided.'); - } - $parameters = $constructor->getParameters(); - - // TestCase() or TestCase($name) - if (\count($parameters) < 2) { - $test = new $className; - } // TestCase($name, $data) - else { - try { - $data = \PHPUnit\Util\Test::getProvidedData( - $className, - $name - ); - } catch (IncompleteTestError $e) { - $message = \sprintf( - 'Test for %s::%s marked incomplete by data provider', - $className, - $name - ); - - $_message = $e->getMessage(); - - if (!empty($_message)) { - $message .= "\n" . $_message; - } - - $data = self::incompleteTest($className, $name, $message); - } catch (SkippedTestError $e) { - $message = \sprintf( - 'Test for %s::%s skipped by data provider', - $className, - $name - ); - - $_message = $e->getMessage(); - - if (!empty($_message)) { - $message .= "\n" . $_message; - } - - $data = self::skipTest($className, $name, $message); - } catch (Throwable $t) { - $message = \sprintf( - 'The data provider specified for %s::%s is invalid.', - $className, - $name - ); - - $_message = $t->getMessage(); - - if (!empty($_message)) { - $message .= "\n" . $_message; - } - - $data = self::warning($message); - } - - // Test method with @dataProvider. - if (isset($data)) { - $test = new DataProviderTestSuite( - $className . '::' . $name - ); - - if (empty($data)) { - $data = self::warning( - \sprintf( - 'No tests found in suite "%s".', - $test->getName() - ) - ); - } - - $groups = \PHPUnit\Util\Test::getGroups($className, $name); - - if ($data instanceof WarningTestCase || - $data instanceof SkippedTestCase || - $data instanceof IncompleteTestCase) { - $test->addTest($data, $groups); - } else { - foreach ($data as $_dataName => $_data) { - $_test = new $className($name, $_data, $_dataName); - - /* @var TestCase $_test */ - - if ($runTestInSeparateProcess) { - $_test->setRunTestInSeparateProcess(true); - - if ($preserveGlobalState !== null) { - $_test->setPreserveGlobalState($preserveGlobalState); - } - } - - if ($runClassInSeparateProcess) { - $_test->setRunClassInSeparateProcess(true); - - if ($preserveGlobalState !== null) { - $_test->setPreserveGlobalState($preserveGlobalState); - } - } - - if ($backupSettings['backupGlobals'] !== null) { - $_test->setBackupGlobals( - $backupSettings['backupGlobals'] - ); - } - - if ($backupSettings['backupStaticAttributes'] !== null) { - $_test->setBackupStaticAttributes( - $backupSettings['backupStaticAttributes'] - ); - } - - $test->addTest($_test, $groups); - } - } - } else { - $test = new $className; - } - } - - if ($test instanceof TestCase) { - $test->setName($name); - - if ($runTestInSeparateProcess) { - $test->setRunTestInSeparateProcess(true); - - if ($preserveGlobalState !== null) { - $test->setPreserveGlobalState($preserveGlobalState); - } - } - - if ($runClassInSeparateProcess) { - $test->setRunClassInSeparateProcess(true); - - if ($preserveGlobalState !== null) { - $test->setPreserveGlobalState($preserveGlobalState); - } - } - - if ($backupSettings['backupGlobals'] !== null) { - $test->setBackupGlobals($backupSettings['backupGlobals']); - } - - if ($backupSettings['backupStaticAttributes'] !== null) { - $test->setBackupStaticAttributes( - $backupSettings['backupStaticAttributes'] - ); - } - } - - return $test; - } - - public static function isTestMethod(ReflectionMethod $method): bool - { - if (\strpos($method->name, 'test') === 0) { - return true; - } - - $annotations = \PHPUnit\Util\Test::parseAnnotations($method->getDocComment()); - - return isset($annotations['test']); - } - - /** - * Constructs a new TestSuite: - * - * - PHPUnit\Framework\TestSuite() constructs an empty TestSuite. - * - * - PHPUnit\Framework\TestSuite(ReflectionClass) constructs a - * TestSuite from the given class. - * - * - PHPUnit\Framework\TestSuite(ReflectionClass, String) - * constructs a TestSuite from the given class with the given - * name. - * - * - PHPUnit\Framework\TestSuite(String) either constructs a - * TestSuite from the given class (if the passed string is the - * name of an existing class) or constructs an empty TestSuite - * with the given name. - * - * @param string $name - * - * @throws Exception - */ - public function __construct($theClass = '', $name = '') - { - $this->declaredClasses = \get_declared_classes(); - - $argumentsValid = false; - - if (\is_object($theClass) && - $theClass instanceof ReflectionClass) { - $argumentsValid = true; - } elseif (\is_string($theClass) && - $theClass !== '' && - \class_exists($theClass, false)) { - $argumentsValid = true; - - if ($name == '') { - $name = $theClass; - } - - $theClass = new ReflectionClass($theClass); - } elseif (\is_string($theClass)) { - $this->setName($theClass); - - return; - } - - if (!$argumentsValid) { - throw new Exception; - } - - if (!$theClass->isSubclassOf(TestCase::class)) { - throw new Exception( - 'Class "' . $theClass->name . '" does not extend PHPUnit\Framework\TestCase.' - ); - } - - if ($name != '') { - $this->setName($name); - } else { - $this->setName($theClass->getName()); - } - - $constructor = $theClass->getConstructor(); - - if ($constructor !== null && - !$constructor->isPublic()) { - $this->addTest( - self::warning( - \sprintf( - 'Class "%s" has no public constructor.', - $theClass->getName() - ) - ) - ); - - return; - } - - foreach ($theClass->getMethods() as $method) { - if ($method->getDeclaringClass()->getName() === Assert::class) { - continue; - } - - if ($method->getDeclaringClass()->getName() === TestCase::class) { - continue; - } - - $this->addTestMethod($theClass, $method); - } - - if (empty($this->tests)) { - $this->addTest( - self::warning( - \sprintf( - 'No tests found in class "%s".', - $theClass->getName() - ) - ) - ); - } - - $this->testCase = true; - } - - /** - * Template Method that is called before the tests - * of this test suite are run. - */ - protected function setUp(): void - { - } - - /** - * Template Method that is called after the tests - * of this test suite have finished running. - */ - protected function tearDown(): void - { - } - - /** - * Returns a string representation of the test suite. - */ - public function toString(): string - { - return $this->getName(); - } - - /** - * Adds a test to the suite. - * - * @param array $groups - */ - public function addTest(Test $test, $groups = []): void - { - $class = new ReflectionClass($test); - - if (!$class->isAbstract()) { - $this->tests[] = $test; - $this->numTests = -1; - - if ($test instanceof self && empty($groups)) { - $groups = $test->getGroups(); - } - - if (empty($groups)) { - $groups = ['default']; - } - - foreach ($groups as $group) { - if (!isset($this->groups[$group])) { - $this->groups[$group] = [$test]; - } else { - $this->groups[$group][] = $test; - } - } - - if ($test instanceof TestCase) { - $test->setGroups($groups); - } - } - } - - /** - * Adds the tests from the given class to the suite. - * - * @throws Exception - */ - public function addTestSuite($testClass): void - { - if (\is_string($testClass) && \class_exists($testClass)) { - $testClass = new ReflectionClass($testClass); - } - - if (!\is_object($testClass)) { - throw InvalidArgumentHelper::factory( - 1, - 'class name or object' - ); - } - - if ($testClass instanceof self) { - $this->addTest($testClass); - } elseif ($testClass instanceof ReflectionClass) { - $suiteMethod = false; - - if (!$testClass->isAbstract() && $testClass->hasMethod(BaseTestRunner::SUITE_METHODNAME)) { - $method = $testClass->getMethod( - BaseTestRunner::SUITE_METHODNAME - ); - - if ($method->isStatic()) { - $this->addTest( - $method->invoke(null, $testClass->getName()) - ); - - $suiteMethod = true; - } - } - - if (!$suiteMethod && !$testClass->isAbstract() && $testClass->isSubclassOf(TestCase::class)) { - $this->addTest(new self($testClass)); - } - } else { - throw new Exception; - } - } - - /** - * Wraps both addTest() and addTestSuite - * as well as the separate import statements for the user's convenience. - * - * If the named file cannot be read or there are no new tests that can be - * added, a PHPUnit\Framework\WarningTestCase will be created instead, - * leaving the current test run untouched. - * - * @throws Exception - */ - public function addTestFile(string $filename): void - { - if (\file_exists($filename) && \substr($filename, -5) == '.phpt') { - $this->addTest( - new PhptTestCase($filename) - ); - - return; - } - - // The given file may contain further stub classes in addition to the - // test class itself. Figure out the actual test class. - $filename = FileLoader::checkAndLoad($filename); - $newClasses = \array_diff(\get_declared_classes(), $this->declaredClasses); - - // The diff is empty in case a parent class (with test methods) is added - // AFTER a child class that inherited from it. To account for that case, - // accumulate all discovered classes, so the parent class may be found in - // a later invocation. - if (!empty($newClasses)) { - // On the assumption that test classes are defined first in files, - // process discovered classes in approximate LIFO order, so as to - // avoid unnecessary reflection. - $this->foundClasses = \array_merge($newClasses, $this->foundClasses); - $this->declaredClasses = \get_declared_classes(); - } - - // The test class's name must match the filename, either in full, or as - // a PEAR/PSR-0 prefixed short name ('NameSpace_ShortName'), or as a - // PSR-1 local short name ('NameSpace\ShortName'). The comparison must be - // anchored to prevent false-positive matches (e.g., 'OtherShortName'). - $shortName = \basename($filename, '.php'); - $shortNameRegEx = '/(?:^|_|\\\\)' . \preg_quote($shortName, '/') . '$/'; - - foreach ($this->foundClasses as $i => $className) { - if (\preg_match($shortNameRegEx, $className)) { - $class = new ReflectionClass($className); - - if ($class->getFileName() == $filename) { - $newClasses = [$className]; - unset($this->foundClasses[$i]); - - break; - } - } - } - - foreach ($newClasses as $className) { - $class = new ReflectionClass($className); - - if (\dirname($class->getFileName()) === __DIR__) { - continue; - } - - if (!$class->isAbstract()) { - if ($class->hasMethod(BaseTestRunner::SUITE_METHODNAME)) { - $method = $class->getMethod( - BaseTestRunner::SUITE_METHODNAME - ); - - if ($method->isStatic()) { - $this->addTest($method->invoke(null, $className)); - } - } elseif ($class->implementsInterface(Test::class)) { - $this->addTestSuite($class); - } - } - } - - $this->numTests = -1; - } - - /** - * Wrapper for addTestFile() that adds multiple test files. - * - * @param array|Iterator $fileNames - * - * @throws Exception - */ - public function addTestFiles($fileNames): void - { - if (!(\is_array($fileNames) || - (\is_object($fileNames) && $fileNames instanceof Iterator))) { - throw InvalidArgumentHelper::factory( - 1, - 'array or iterator' - ); - } - - foreach ($fileNames as $filename) { - $this->addTestFile((string) $filename); - } - } - - /** - * Counts the number of test cases that will be run by this test. - * - * @param bool $preferCache indicates if cache is preferred - */ - public function count($preferCache = false): int - { - if ($preferCache && $this->cachedNumTests !== null) { - return $this->cachedNumTests; - } - - $numTests = 0; - - foreach ($this as $test) { - $numTests += \count($test); - } - - $this->cachedNumTests = $numTests; - - return $numTests; - } - - /** - * Returns the name of the suite. - */ - public function getName(): string - { - return $this->name; - } - - /** - * Returns the test groups of the suite. - */ - public function getGroups(): array - { - return \array_keys($this->groups); - } - - public function getGroupDetails() - { - return $this->groups; - } - - /** - * Set tests groups of the test case - */ - public function setGroupDetails(array $groups): void - { - $this->groups = $groups; - } - - /** - * Runs the tests and collects their result in a TestResult. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - */ - public function run(TestResult $result = null): TestResult - { - if ($result === null) { - $result = $this->createResult(); - } - - if (\count($this) == 0) { - return $result; - } - - $hookMethods = \PHPUnit\Util\Test::getHookMethods($this->name); - - $result->startTestSuite($this); - - try { - $this->setUp(); - - foreach ($hookMethods['beforeClass'] as $beforeClassMethod) { - if ($this->testCase === true && - \class_exists($this->name, false) && - \method_exists($this->name, $beforeClassMethod)) { - if ($missingRequirements = \PHPUnit\Util\Test::getMissingRequirements($this->name, $beforeClassMethod)) { - $this->markTestSuiteSkipped(\implode(\PHP_EOL, $missingRequirements)); - } - - \call_user_func([$this->name, $beforeClassMethod]); - } - } - } catch (SkippedTestSuiteError $e) { - $numTests = \count($this); - - for ($i = 0; $i < $numTests; $i++) { - $result->startTest($this); - $result->addFailure($this, $e, 0); - $result->endTest($this, 0); - } - - $this->tearDown(); - $result->endTestSuite($this); - - return $result; - } catch (Throwable $t) { - $numTests = \count($this); - - for ($i = 0; $i < $numTests; $i++) { - if ($result->shouldStop()) { - break; - } - - $result->startTest($this); - $result->addError($this, $t, 0); - $result->endTest($this, 0); - } - - $this->tearDown(); - $result->endTestSuite($this); - - return $result; - } - - foreach ($this as $test) { - if ($result->shouldStop()) { - break; - } - - if ($test instanceof TestCase || $test instanceof self) { - $test->setBeStrictAboutChangesToGlobalState($this->beStrictAboutChangesToGlobalState); - $test->setBackupGlobals($this->backupGlobals); - $test->setBackupStaticAttributes($this->backupStaticAttributes); - $test->setRunTestInSeparateProcess($this->runTestInSeparateProcess); - } - - $test->run($result); - } - - foreach ($hookMethods['afterClass'] as $afterClassMethod) { - if ($this->testCase === true && \class_exists($this->name, false) && \method_exists($this->name, $afterClassMethod)) { - \call_user_func([$this->name, $afterClassMethod]); - } - } - - $this->tearDown(); - - $result->endTestSuite($this); - - return $result; - } - - public function setRunTestInSeparateProcess(bool $runTestInSeparateProcess): void - { - $this->runTestInSeparateProcess = $runTestInSeparateProcess; - } - - public function setName(string $name): void - { - $this->name = $name; - } - - /** - * Returns the test at the given index. - * - * @return false|Test - */ - public function testAt(int $index) - { - if (isset($this->tests[$index])) { - return $this->tests[$index]; - } - - return false; - } - - /** - * Returns the tests as an enumeration. - */ - public function tests(): array - { - return $this->tests; - } - - /** - * Set tests of the test suite - */ - public function setTests(array $tests): void - { - $this->tests = $tests; - } - - /** - * Mark the test suite as skipped. - * - * @param string $message - * - * @throws SkippedTestSuiteError - */ - public function markTestSuiteSkipped($message = ''): void - { - throw new SkippedTestSuiteError($message); - } - - /** - * @param bool $beStrictAboutChangesToGlobalState - */ - public function setBeStrictAboutChangesToGlobalState($beStrictAboutChangesToGlobalState): void - { - if (null === $this->beStrictAboutChangesToGlobalState && \is_bool($beStrictAboutChangesToGlobalState)) { - $this->beStrictAboutChangesToGlobalState = $beStrictAboutChangesToGlobalState; - } - } - - /** - * @param bool $backupGlobals - */ - public function setBackupGlobals($backupGlobals): void - { - if (null === $this->backupGlobals && \is_bool($backupGlobals)) { - $this->backupGlobals = $backupGlobals; - } - } - - /** - * @param bool $backupStaticAttributes - */ - public function setBackupStaticAttributes($backupStaticAttributes): void - { - if (null === $this->backupStaticAttributes && \is_bool($backupStaticAttributes)) { - $this->backupStaticAttributes = $backupStaticAttributes; - } - } - - /** - * Returns an iterator for this test suite. - */ - public function getIterator(): Iterator - { - $iterator = new TestSuiteIterator($this); - - if ($this->iteratorFilter !== null) { - $iterator = $this->iteratorFilter->factory($iterator, $this); - } - - return $iterator; - } - - public function injectFilter(Factory $filter): void - { - $this->iteratorFilter = $filter; - - foreach ($this as $test) { - if ($test instanceof self) { - $test->injectFilter($filter); - } - } - } - - /** - * Creates a default TestResult object. - */ - protected function createResult(): TestResult - { - return new TestResult; - } - - /** - * @throws Exception - */ - protected function addTestMethod(ReflectionClass $class, ReflectionMethod $method): void - { - 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 TestCase || $test instanceof DataProviderTestSuite) { - $test->setDependencies( - \PHPUnit\Util\Test::getDependencies($class->getName(), $name) - ); - } - - $this->addTest( - $test, - \PHPUnit\Util\Test::getGroups($class->getName(), $name) - ); - } - - /** - * @param string $message - */ - protected static function warning($message): WarningTestCase - { - return new WarningTestCase($message); - } - - /** - * @param string $class - * @param string $methodName - * @param string $message - */ - protected static function skipTest($class, $methodName, $message): SkippedTestCase - { - return new SkippedTestCase($class, $methodName, $message); - } - - /** - * @param string $class - * @param string $methodName - * @param string $message - */ - protected static function incompleteTest($class, $methodName, $message): IncompleteTestCase - { - return new IncompleteTestCase($class, $methodName, $message); - } -} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework; + +use Iterator; +use IteratorAggregate; +use PHPUnit\Runner\BaseTestRunner; +use PHPUnit\Runner\Filter\Factory; +use PHPUnit\Runner\PhptTestCase; +use PHPUnit\Util\FileLoader; +use PHPUnit\Util\InvalidArgumentHelper; +use ReflectionClass; +use ReflectionMethod; +use Throwable; + +/** + * A TestSuite is a composite of Tests. It runs a collection of test cases. + */ +class TestSuite implements Test, SelfDescribing, IteratorAggregate +{ + /** + * Enable or disable the backup and restoration of the $GLOBALS array. + * + * @var bool + */ + protected $backupGlobals; + + /** + * Enable or disable the backup and restoration of static attributes. + * + * @var bool + */ + protected $backupStaticAttributes; + + /** + * @var bool + */ + protected $runTestInSeparateProcess = false; + + /** + * The name of the test suite. + * + * @var string + */ + protected $name = ''; + + /** + * The test groups of the test suite. + * + * @var array + */ + protected $groups = []; + + /** + * The tests in the test suite. + * + * @var TestCase[] + */ + protected $tests = []; + + /** + * The number of tests in the test suite. + * + * @var int + */ + protected $numTests = -1; + + /** + * @var bool + */ + protected $testCase = false; + + /** + * @var array + */ + protected $foundClasses = []; + + /** + * Last count of tests in this suite. + * + * @var null|int + */ + private $cachedNumTests; + + /** + * @var bool + */ + private $beStrictAboutChangesToGlobalState; + + /** + * @var Factory + */ + private $iteratorFilter; + + /** + * @var string[] + */ + private $declaredClasses; + + /** + * @param string $name + * + * @throws Exception + */ + public static function createTest(ReflectionClass $theClass, $name): Test + { + $className = $theClass->getName(); + + if (!$theClass->isInstantiable()) { + return self::warning( + \sprintf('Cannot instantiate class "%s".', $className) + ); + } + + $backupSettings = \PHPUnit\Util\Test::getBackupSettings( + $className, + $name + ); + + $preserveGlobalState = \PHPUnit\Util\Test::getPreserveGlobalStateSettings( + $className, + $name + ); + + $runTestInSeparateProcess = \PHPUnit\Util\Test::getProcessIsolationSettings( + $className, + $name + ); + + $runClassInSeparateProcess = \PHPUnit\Util\Test::getClassProcessIsolationSettings( + $className, + $name + ); + + $constructor = $theClass->getConstructor(); + + if ($constructor === null) { + throw new Exception('No valid test provided.'); + } + // TestCase($name, $data) + if ($provider = @\PHPUnit\Util\Test::parseTestMethodAnnotations($className, $name)['method']['dataProvider'][0]) { + $test = new DataProviderTestSuite($provider, $theClass, $name); + $test->setGroupDetails(\PHPUnit\Util\Test::getGroups($className, $name)); + } else { + $test = new $className($name); + if ($runTestInSeparateProcess) { + $test->setRunTestInSeparateProcess(true); + + if ($preserveGlobalState !== null) { + $test->setPreserveGlobalState($preserveGlobalState); + } + } + + if ($runClassInSeparateProcess) { + $test->setRunClassInSeparateProcess(true); + + if ($preserveGlobalState !== null) { + $test->setPreserveGlobalState($preserveGlobalState); + } + } + + if ($backupSettings['backupGlobals'] !== null) { + $test->setBackupGlobals($backupSettings['backupGlobals']); + } + + if ($backupSettings['backupStaticAttributes'] !== null) { + $test->setBackupStaticAttributes( + $backupSettings['backupStaticAttributes'] + ); + } + } + + return $test; + } + + public static function isTestMethod(ReflectionMethod $method): bool + { + if (\strpos($method->name, 'test') === 0) { + return true; + } + + $annotations = \PHPUnit\Util\Test::parseAnnotations($method->getDocComment()); + + return isset($annotations['test']); + } + + /** + * Constructs a new TestSuite: + * + * - PHPUnit\Framework\TestSuite() constructs an empty TestSuite. + * + * - PHPUnit\Framework\TestSuite(ReflectionClass) constructs a + * TestSuite from the given class. + * + * - PHPUnit\Framework\TestSuite(ReflectionClass, String) + * constructs a TestSuite from the given class with the given + * name. + * + * - PHPUnit\Framework\TestSuite(String) either constructs a + * TestSuite from the given class (if the passed string is the + * name of an existing class) or constructs an empty TestSuite + * with the given name. + * + * @param string $name + * + * @throws Exception + */ + public function __construct($theClass = '', $name = '', bool $skipTestDiscovery = false) + { + $this->declaredClasses = \get_declared_classes(); + + $argumentsValid = false; + + if (\is_object($theClass) && + $theClass instanceof ReflectionClass) { + $argumentsValid = true; + } elseif (\is_string($theClass) && + $theClass !== '' && + \class_exists($theClass, false)) { + $argumentsValid = true; + + if ($name == '') { + $name = $theClass; + } + + $theClass = new ReflectionClass($theClass); + } elseif (\is_string($theClass)) { + $this->setName($theClass); + + return; + } + + if (!$argumentsValid) { + throw new Exception; + } + + if (!$theClass->isSubclassOf(TestCase::class)) { + throw new Exception( + 'Class "' . $theClass->name . '" does not extend PHPUnit\Framework\TestCase.' + ); + } + + if ($name != '') { + $this->setName($name); + } else { + $this->setName($theClass->getName()); + } + + $constructor = $theClass->getConstructor(); + + if ($constructor !== null && + !$constructor->isPublic()) { + $this->addTest( + self::warning( + \sprintf( + 'Class "%s" has no public constructor.', + $theClass->getName() + ) + ) + ); + + return; + } + if ($skipTestDiscovery) { + return; + } + foreach ($theClass->getMethods() as $method) { + if ($method->getDeclaringClass()->getName() === Assert::class) { + continue; + } + + if ($method->getDeclaringClass()->getName() === TestCase::class) { + continue; + } + + $this->addTestMethod($theClass, $method); + } + + if (empty($this->tests)) { + $this->addTest( + self::warning( + \sprintf( + 'No tests found in class "%s".', + $theClass->getName() + ) + ) + ); + } + + $this->testCase = true; + } + + /** + * Template Method that is called before the tests + * of this test suite are run. + */ + protected function setUp(): void + { + } + + /** + * Template Method that is called after the tests + * of this test suite have finished running. + */ + protected function tearDown(): void + { + } + + /** + * Returns a string representation of the test suite. + */ + public function toString(): string + { + return $this->getName(); + } + + /** + * Adds a test to the suite. + * + * @param array $groups + */ + public function addTest(Test $test, $groups = []): void + { + $class = new ReflectionClass($test); + + if (!$class->isAbstract()) { + $this->tests[] = $test; + $this->numTests = -1; + + if ($test instanceof self && empty($groups)) { + $groups = $test->getGroups(); + } + + if (empty($groups)) { + $groups = ['default']; + } + + foreach ($groups as $group) { + if (!isset($this->groups[$group])) { + $this->groups[$group] = [$test]; + } else { + $this->groups[$group][] = $test; + } + } + + if ($test instanceof TestCase) { + $test->setGroups($groups); + } + } + } + + /** + * Adds the tests from the given class to the suite. + * + * @throws Exception + */ + public function addTestSuite($testClass): void + { + if (\is_string($testClass) && \class_exists($testClass)) { + $testClass = new ReflectionClass($testClass); + } + + if (!\is_object($testClass)) { + throw InvalidArgumentHelper::factory( + 1, + 'class name or object' + ); + } + + if ($testClass instanceof self) { + $this->addTest($testClass); + } elseif ($testClass instanceof ReflectionClass) { + $suiteMethod = false; + + if (!$testClass->isAbstract() && $testClass->hasMethod(BaseTestRunner::SUITE_METHODNAME)) { + $method = $testClass->getMethod( + BaseTestRunner::SUITE_METHODNAME + ); + + if ($method->isStatic()) { + $this->addTest( + $method->invoke(null, $testClass->getName()) + ); + + $suiteMethod = true; + } + } + + if (!$suiteMethod && !$testClass->isAbstract() && $testClass->isSubclassOf(TestCase::class)) { + $this->addTest(new self($testClass)); + } + } else { + throw new Exception; + } + } + + /** + * Wraps both addTest() and addTestSuite + * as well as the separate import statements for the user's convenience. + * + * If the named file cannot be read or there are no new tests that can be + * added, a PHPUnit\Framework\WarningTestCase will be created instead, + * leaving the current test run untouched. + * + * @throws Exception + */ + public function addTestFile(string $filename): void + { + if (\file_exists($filename) && \substr($filename, -5) == '.phpt') { + $this->addTest( + new PhptTestCase($filename) + ); + + return; + } + + // The given file may contain further stub classes in addition to the + // test class itself. Figure out the actual test class. + $filename = FileLoader::checkAndLoad($filename); + $newClasses = \array_diff(\get_declared_classes(), $this->declaredClasses); + + // The diff is empty in case a parent class (with test methods) is added + // AFTER a child class that inherited from it. To account for that case, + // accumulate all discovered classes, so the parent class may be found in + // a later invocation. + if (!empty($newClasses)) { + // On the assumption that test classes are defined first in files, + // process discovered classes in approximate LIFO order, so as to + // avoid unnecessary reflection. + $this->foundClasses = \array_merge($newClasses, $this->foundClasses); + $this->declaredClasses = \get_declared_classes(); + } + + // The test class's name must match the filename, either in full, or as + // a PEAR/PSR-0 prefixed short name ('NameSpace_ShortName'), or as a + // PSR-1 local short name ('NameSpace\ShortName'). The comparison must be + // anchored to prevent false-positive matches (e.g., 'OtherShortName'). + $shortName = \basename($filename, '.php'); + $shortNameRegEx = '/(?:^|_|\\\\)' . \preg_quote($shortName, '/') . '$/'; + + foreach ($this->foundClasses as $i => $className) { + if (\preg_match($shortNameRegEx, $className)) { + $class = new ReflectionClass($className); + + if ($class->getFileName() == $filename) { + $newClasses = [$className]; + unset($this->foundClasses[$i]); + + break; + } + } + } + + foreach ($newClasses as $className) { + $class = new ReflectionClass($className); + + if (\dirname($class->getFileName()) === __DIR__) { + continue; + } + + if (!$class->isAbstract()) { + if ($class->hasMethod(BaseTestRunner::SUITE_METHODNAME)) { + $method = $class->getMethod( + BaseTestRunner::SUITE_METHODNAME + ); + + if ($method->isStatic()) { + $this->addTest($method->invoke(null, $className)); + } + } elseif ($class->implementsInterface(Test::class)) { + $this->addTestSuite($class); + } + } + } + + $this->numTests = -1; + } + + /** + * Wrapper for addTestFile() that adds multiple test files. + * + * @param array|Iterator $fileNames + * + * @throws Exception + */ + public function addTestFiles($fileNames): void + { + if (!(\is_array($fileNames) || + (\is_object($fileNames) && $fileNames instanceof Iterator))) { + throw InvalidArgumentHelper::factory( + 1, + 'array or iterator' + ); + } + + foreach ($fileNames as $filename) { + $this->addTestFile((string) $filename); + } + } + + /** + * Counts the number of test cases that will be run by this test. + * + * @param bool $preferCache indicates if cache is preferred + */ + public function count($preferCache = false): int + { + if ($preferCache && $this->cachedNumTests !== null) { + return $this->cachedNumTests; + } + + $numTests = 0; + + foreach ($this as $test) { + $numTests += \count($test); + } + + $this->cachedNumTests = $numTests; + + return $numTests; + } + + /** + * Returns the name of the suite. + */ + public function getName(): string + { + return $this->name; + } + + /** + * Returns the test groups of the suite. + */ + public function getGroups(): array + { + return \array_keys($this->groups); + } + + public function getGroupDetails() + { + return $this->groups; + } + + /** + * Set tests groups of the test case + */ + public function setGroupDetails(array $groups): void + { + $this->groups = $groups; + } + + /** + * @return \Generator|Test[] + */ + protected function yieldTests(): \Generator + { + yield from $this->tests; + } + + /** + * Runs the tests and collects their result in a TestResult. + * + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public function run(TestResult $result = null): TestResult + { + if ($result === null) { + $result = $this->createResult(); + } + + if (\count($this) == 0) { + return $result; + } + + $hookMethods = \PHPUnit\Util\Test::getHookMethods($this->name); + + $result->startTestSuite($this); + + try { + $this->setUp(); + + foreach ($hookMethods['beforeClass'] as $beforeClassMethod) { + if ($this->testCase === true && + \class_exists($this->name, false) && + \method_exists($this->name, $beforeClassMethod)) { + if ($missingRequirements = \PHPUnit\Util\Test::getMissingRequirements($this->name, $beforeClassMethod)) { + $this->markTestSuiteSkipped(\implode(\PHP_EOL, $missingRequirements)); + } + + \call_user_func([$this->name, $beforeClassMethod]); + } + } + } catch (SkippedTestSuiteError $e) { + $numTests = \count($this); + + for ($i = 0; $i < $numTests; $i++) { + $result->startTest($this); + $result->addFailure($this, $e, 0); + $result->endTest($this, 0); + } + + $this->tearDown(); + $result->endTestSuite($this); + + return $result; + } catch (Throwable $t) { + $numTests = \count($this); + + for ($i = 0; $i < $numTests; $i++) { + if ($result->shouldStop()) { + break; + } + + $result->startTest($this); + $result->addError($this, $t, 0); + $result->endTest($this, 0); + } + + $this->tearDown(); + $result->endTestSuite($this); + + return $result; + } + + foreach ($this->yieldTests() as $test) { + if ($result->shouldStop()) { + break; + } + + if ($test instanceof TestCase || $test instanceof self) { + $test->setBeStrictAboutChangesToGlobalState($this->beStrictAboutChangesToGlobalState); + $test->setBackupGlobals($this->backupGlobals); + $test->setBackupStaticAttributes($this->backupStaticAttributes); + $test->setRunTestInSeparateProcess($this->runTestInSeparateProcess); + } + + $test->run($result); + } + + foreach ($hookMethods['afterClass'] as $afterClassMethod) { + if ($this->testCase === true && \class_exists($this->name, false) && \method_exists($this->name, $afterClassMethod)) { + \call_user_func([$this->name, $afterClassMethod]); + } + } + + $this->tearDown(); + + $result->endTestSuite($this); + + return $result; + } + + public function setRunTestInSeparateProcess(bool $runTestInSeparateProcess): void + { + $this->runTestInSeparateProcess = $runTestInSeparateProcess; + } + + public function setName(string $name): void + { + $this->name = $name; + } + + /** + * Returns the test at the given index. + * + * @return false|Test + */ + public function testAt(int $index) + { + if (isset($this->tests[$index])) { + return $this->tests[$index]; + } + + return false; + } + + /** + * Returns the tests as an enumeration. + */ + public function tests(): array + { + return $this->tests; + } + + /** + * Set tests of the test suite + */ + public function setTests(array $tests): void + { + $this->tests = $tests; + } + + /** + * Mark the test suite as skipped. + * + * @param string $message + * + * @throws SkippedTestSuiteError + */ + public function markTestSuiteSkipped($message = ''): void + { + throw new SkippedTestSuiteError($message); + } + + /** + * @param bool $beStrictAboutChangesToGlobalState + */ + public function setBeStrictAboutChangesToGlobalState($beStrictAboutChangesToGlobalState): void + { + if (null === $this->beStrictAboutChangesToGlobalState && \is_bool($beStrictAboutChangesToGlobalState)) { + $this->beStrictAboutChangesToGlobalState = $beStrictAboutChangesToGlobalState; + } + } + + /** + * @param bool $backupGlobals + */ + public function setBackupGlobals($backupGlobals): void + { + if (null === $this->backupGlobals && \is_bool($backupGlobals)) { + $this->backupGlobals = $backupGlobals; + } + } + + /** + * @param bool $backupStaticAttributes + */ + public function setBackupStaticAttributes($backupStaticAttributes): void + { + if (null === $this->backupStaticAttributes && \is_bool($backupStaticAttributes)) { + $this->backupStaticAttributes = $backupStaticAttributes; + } + } + + /** + * Returns an iterator for this test suite. + */ + public function getIterator(): Iterator + { + $iterator = new TestSuiteIterator($this); + + if ($this->iteratorFilter !== null) { + $iterator = $this->iteratorFilter->factory($iterator, $this); + } + + return $iterator; + } + + public function injectFilter(Factory $filter): void + { + $this->iteratorFilter = $filter; + + foreach ($this as $test) { + if ($test instanceof self) { + $test->injectFilter($filter); + } + } + } + + /** + * Creates a default TestResult object. + */ + protected function createResult(): TestResult + { + return new TestResult; + } + + /** + * @throws Exception + */ + protected function addTestMethod(ReflectionClass $class, ReflectionMethod $method): void + { + 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 TestCase || $test instanceof DataProviderTestSuite) { + $test->setDependencies( + \PHPUnit\Util\Test::getDependencies($class->getName(), $name) + ); + } + + $this->addTest( + $test, + \PHPUnit\Util\Test::getGroups($class->getName(), $name) + ); + } + + /** + * @param string $message + */ + protected static function warning($message): WarningTestCase + { + return new WarningTestCase($message); + } + + /** + * @param string $class + * @param string $methodName + * @param string $message + */ + protected static function skipTest($class, $methodName, $message): SkippedTestCase + { + return new SkippedTestCase($class, $methodName, $message); + } + + /** + * @param string $class + * @param string $methodName + * @param string $message + */ + protected static function incompleteTest($class, $methodName, $message): IncompleteTestCase + { + return new IncompleteTestCase($class, $methodName, $message); + } +} diff --git a/src/TextUI/ResultPrinter.php b/src/TextUI/ResultPrinter.php index e8b5c30708a..d6feadfda48 100644 --- a/src/TextUI/ResultPrinter.php +++ b/src/TextUI/ResultPrinter.php @@ -496,18 +496,12 @@ protected function writeProgress(string $progress): void $this->column++; $this->numTestsRun++; - if ($this->column == $this->maxColumn || $this->numTestsRun == $this->numTests) { - if ($this->numTestsRun == $this->numTests) { - $this->write(\str_repeat(' ', $this->maxColumn - $this->column)); - } + if ($this->column == $this->maxColumn) { $this->write( \sprintf( - ' %' . $this->numTestsWidth . 'd / %' . - $this->numTestsWidth . 'd (%3s%%)', - $this->numTestsRun, - $this->numTests, - \floor(($this->numTestsRun / $this->numTests) * 100) + ' %' . $this->numTestsWidth . 'd ', + $this->numTestsRun ) ); From f41c70b4b5b66b707c97742c10a77be9c4ec568d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20B=C3=BCttner?= Date: Sat, 14 Jul 2018 11:10:54 +0200 Subject: [PATCH 02/13] calculating width differently for testnumber --- src/TextUI/ResultPrinter.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/TextUI/ResultPrinter.php b/src/TextUI/ResultPrinter.php index d6feadfda48..de17725eaeb 100644 --- a/src/TextUI/ResultPrinter.php +++ b/src/TextUI/ResultPrinter.php @@ -255,8 +255,8 @@ public function startTestSuite(TestSuite $suite): void { if ($this->numTests == -1) { $this->numTests = \count($suite); - $this->numTestsWidth = \strlen((string) $this->numTests); - $this->maxColumn = $this->numberOfColumns - \strlen(' / (XXX%)') - (2 * $this->numTestsWidth); + $this->numTestsWidth = \strlen((string) $this->numTests) * 2 + 3; + $this->maxColumn = $this->numberOfColumns - 2 - $this->numTestsWidth; } } From 7d7bfaad1f1eeac0f142bfd6009f4d6ecdd894a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20B=C3=BCttner?= Date: Sat, 14 Jul 2018 11:50:00 +0200 Subject: [PATCH 03/13] handling testWith annotations --- src/Framework/TestSuite.php | 1690 ++++++++++++++++--------------- src/Framework/WithTestSuite.php | 85 ++ 2 files changed, 934 insertions(+), 841 deletions(-) create mode 100644 src/Framework/WithTestSuite.php diff --git a/src/Framework/TestSuite.php b/src/Framework/TestSuite.php index 23d2c49c30e..8c244639d7d 100644 --- a/src/Framework/TestSuite.php +++ b/src/Framework/TestSuite.php @@ -1,841 +1,849 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Framework; - -use Iterator; -use IteratorAggregate; -use PHPUnit\Runner\BaseTestRunner; -use PHPUnit\Runner\Filter\Factory; -use PHPUnit\Runner\PhptTestCase; -use PHPUnit\Util\FileLoader; -use PHPUnit\Util\InvalidArgumentHelper; -use ReflectionClass; -use ReflectionMethod; -use Throwable; - -/** - * A TestSuite is a composite of Tests. It runs a collection of test cases. - */ -class TestSuite implements Test, SelfDescribing, IteratorAggregate -{ - /** - * Enable or disable the backup and restoration of the $GLOBALS array. - * - * @var bool - */ - protected $backupGlobals; - - /** - * Enable or disable the backup and restoration of static attributes. - * - * @var bool - */ - protected $backupStaticAttributes; - - /** - * @var bool - */ - protected $runTestInSeparateProcess = false; - - /** - * The name of the test suite. - * - * @var string - */ - protected $name = ''; - - /** - * The test groups of the test suite. - * - * @var array - */ - protected $groups = []; - - /** - * The tests in the test suite. - * - * @var TestCase[] - */ - protected $tests = []; - - /** - * The number of tests in the test suite. - * - * @var int - */ - protected $numTests = -1; - - /** - * @var bool - */ - protected $testCase = false; - - /** - * @var array - */ - protected $foundClasses = []; - - /** - * Last count of tests in this suite. - * - * @var null|int - */ - private $cachedNumTests; - - /** - * @var bool - */ - private $beStrictAboutChangesToGlobalState; - - /** - * @var Factory - */ - private $iteratorFilter; - - /** - * @var string[] - */ - private $declaredClasses; - - /** - * @param string $name - * - * @throws Exception - */ - public static function createTest(ReflectionClass $theClass, $name): Test - { - $className = $theClass->getName(); - - if (!$theClass->isInstantiable()) { - return self::warning( - \sprintf('Cannot instantiate class "%s".', $className) - ); - } - - $backupSettings = \PHPUnit\Util\Test::getBackupSettings( - $className, - $name - ); - - $preserveGlobalState = \PHPUnit\Util\Test::getPreserveGlobalStateSettings( - $className, - $name - ); - - $runTestInSeparateProcess = \PHPUnit\Util\Test::getProcessIsolationSettings( - $className, - $name - ); - - $runClassInSeparateProcess = \PHPUnit\Util\Test::getClassProcessIsolationSettings( - $className, - $name - ); - - $constructor = $theClass->getConstructor(); - - if ($constructor === null) { - throw new Exception('No valid test provided.'); - } - // TestCase($name, $data) - if ($provider = @\PHPUnit\Util\Test::parseTestMethodAnnotations($className, $name)['method']['dataProvider'][0]) { - $test = new DataProviderTestSuite($provider, $theClass, $name); - $test->setGroupDetails(\PHPUnit\Util\Test::getGroups($className, $name)); - } else { - $test = new $className($name); - if ($runTestInSeparateProcess) { - $test->setRunTestInSeparateProcess(true); - - if ($preserveGlobalState !== null) { - $test->setPreserveGlobalState($preserveGlobalState); - } - } - - if ($runClassInSeparateProcess) { - $test->setRunClassInSeparateProcess(true); - - if ($preserveGlobalState !== null) { - $test->setPreserveGlobalState($preserveGlobalState); - } - } - - if ($backupSettings['backupGlobals'] !== null) { - $test->setBackupGlobals($backupSettings['backupGlobals']); - } - - if ($backupSettings['backupStaticAttributes'] !== null) { - $test->setBackupStaticAttributes( - $backupSettings['backupStaticAttributes'] - ); - } - } - - return $test; - } - - public static function isTestMethod(ReflectionMethod $method): bool - { - if (\strpos($method->name, 'test') === 0) { - return true; - } - - $annotations = \PHPUnit\Util\Test::parseAnnotations($method->getDocComment()); - - return isset($annotations['test']); - } - - /** - * Constructs a new TestSuite: - * - * - PHPUnit\Framework\TestSuite() constructs an empty TestSuite. - * - * - PHPUnit\Framework\TestSuite(ReflectionClass) constructs a - * TestSuite from the given class. - * - * - PHPUnit\Framework\TestSuite(ReflectionClass, String) - * constructs a TestSuite from the given class with the given - * name. - * - * - PHPUnit\Framework\TestSuite(String) either constructs a - * TestSuite from the given class (if the passed string is the - * name of an existing class) or constructs an empty TestSuite - * with the given name. - * - * @param string $name - * - * @throws Exception - */ - public function __construct($theClass = '', $name = '', bool $skipTestDiscovery = false) - { - $this->declaredClasses = \get_declared_classes(); - - $argumentsValid = false; - - if (\is_object($theClass) && - $theClass instanceof ReflectionClass) { - $argumentsValid = true; - } elseif (\is_string($theClass) && - $theClass !== '' && - \class_exists($theClass, false)) { - $argumentsValid = true; - - if ($name == '') { - $name = $theClass; - } - - $theClass = new ReflectionClass($theClass); - } elseif (\is_string($theClass)) { - $this->setName($theClass); - - return; - } - - if (!$argumentsValid) { - throw new Exception; - } - - if (!$theClass->isSubclassOf(TestCase::class)) { - throw new Exception( - 'Class "' . $theClass->name . '" does not extend PHPUnit\Framework\TestCase.' - ); - } - - if ($name != '') { - $this->setName($name); - } else { - $this->setName($theClass->getName()); - } - - $constructor = $theClass->getConstructor(); - - if ($constructor !== null && - !$constructor->isPublic()) { - $this->addTest( - self::warning( - \sprintf( - 'Class "%s" has no public constructor.', - $theClass->getName() - ) - ) - ); - - return; - } - if ($skipTestDiscovery) { - return; - } - foreach ($theClass->getMethods() as $method) { - if ($method->getDeclaringClass()->getName() === Assert::class) { - continue; - } - - if ($method->getDeclaringClass()->getName() === TestCase::class) { - continue; - } - - $this->addTestMethod($theClass, $method); - } - - if (empty($this->tests)) { - $this->addTest( - self::warning( - \sprintf( - 'No tests found in class "%s".', - $theClass->getName() - ) - ) - ); - } - - $this->testCase = true; - } - - /** - * Template Method that is called before the tests - * of this test suite are run. - */ - protected function setUp(): void - { - } - - /** - * Template Method that is called after the tests - * of this test suite have finished running. - */ - protected function tearDown(): void - { - } - - /** - * Returns a string representation of the test suite. - */ - public function toString(): string - { - return $this->getName(); - } - - /** - * Adds a test to the suite. - * - * @param array $groups - */ - public function addTest(Test $test, $groups = []): void - { - $class = new ReflectionClass($test); - - if (!$class->isAbstract()) { - $this->tests[] = $test; - $this->numTests = -1; - - if ($test instanceof self && empty($groups)) { - $groups = $test->getGroups(); - } - - if (empty($groups)) { - $groups = ['default']; - } - - foreach ($groups as $group) { - if (!isset($this->groups[$group])) { - $this->groups[$group] = [$test]; - } else { - $this->groups[$group][] = $test; - } - } - - if ($test instanceof TestCase) { - $test->setGroups($groups); - } - } - } - - /** - * Adds the tests from the given class to the suite. - * - * @throws Exception - */ - public function addTestSuite($testClass): void - { - if (\is_string($testClass) && \class_exists($testClass)) { - $testClass = new ReflectionClass($testClass); - } - - if (!\is_object($testClass)) { - throw InvalidArgumentHelper::factory( - 1, - 'class name or object' - ); - } - - if ($testClass instanceof self) { - $this->addTest($testClass); - } elseif ($testClass instanceof ReflectionClass) { - $suiteMethod = false; - - if (!$testClass->isAbstract() && $testClass->hasMethod(BaseTestRunner::SUITE_METHODNAME)) { - $method = $testClass->getMethod( - BaseTestRunner::SUITE_METHODNAME - ); - - if ($method->isStatic()) { - $this->addTest( - $method->invoke(null, $testClass->getName()) - ); - - $suiteMethod = true; - } - } - - if (!$suiteMethod && !$testClass->isAbstract() && $testClass->isSubclassOf(TestCase::class)) { - $this->addTest(new self($testClass)); - } - } else { - throw new Exception; - } - } - - /** - * Wraps both addTest() and addTestSuite - * as well as the separate import statements for the user's convenience. - * - * If the named file cannot be read or there are no new tests that can be - * added, a PHPUnit\Framework\WarningTestCase will be created instead, - * leaving the current test run untouched. - * - * @throws Exception - */ - public function addTestFile(string $filename): void - { - if (\file_exists($filename) && \substr($filename, -5) == '.phpt') { - $this->addTest( - new PhptTestCase($filename) - ); - - return; - } - - // The given file may contain further stub classes in addition to the - // test class itself. Figure out the actual test class. - $filename = FileLoader::checkAndLoad($filename); - $newClasses = \array_diff(\get_declared_classes(), $this->declaredClasses); - - // The diff is empty in case a parent class (with test methods) is added - // AFTER a child class that inherited from it. To account for that case, - // accumulate all discovered classes, so the parent class may be found in - // a later invocation. - if (!empty($newClasses)) { - // On the assumption that test classes are defined first in files, - // process discovered classes in approximate LIFO order, so as to - // avoid unnecessary reflection. - $this->foundClasses = \array_merge($newClasses, $this->foundClasses); - $this->declaredClasses = \get_declared_classes(); - } - - // The test class's name must match the filename, either in full, or as - // a PEAR/PSR-0 prefixed short name ('NameSpace_ShortName'), or as a - // PSR-1 local short name ('NameSpace\ShortName'). The comparison must be - // anchored to prevent false-positive matches (e.g., 'OtherShortName'). - $shortName = \basename($filename, '.php'); - $shortNameRegEx = '/(?:^|_|\\\\)' . \preg_quote($shortName, '/') . '$/'; - - foreach ($this->foundClasses as $i => $className) { - if (\preg_match($shortNameRegEx, $className)) { - $class = new ReflectionClass($className); - - if ($class->getFileName() == $filename) { - $newClasses = [$className]; - unset($this->foundClasses[$i]); - - break; - } - } - } - - foreach ($newClasses as $className) { - $class = new ReflectionClass($className); - - if (\dirname($class->getFileName()) === __DIR__) { - continue; - } - - if (!$class->isAbstract()) { - if ($class->hasMethod(BaseTestRunner::SUITE_METHODNAME)) { - $method = $class->getMethod( - BaseTestRunner::SUITE_METHODNAME - ); - - if ($method->isStatic()) { - $this->addTest($method->invoke(null, $className)); - } - } elseif ($class->implementsInterface(Test::class)) { - $this->addTestSuite($class); - } - } - } - - $this->numTests = -1; - } - - /** - * Wrapper for addTestFile() that adds multiple test files. - * - * @param array|Iterator $fileNames - * - * @throws Exception - */ - public function addTestFiles($fileNames): void - { - if (!(\is_array($fileNames) || - (\is_object($fileNames) && $fileNames instanceof Iterator))) { - throw InvalidArgumentHelper::factory( - 1, - 'array or iterator' - ); - } - - foreach ($fileNames as $filename) { - $this->addTestFile((string) $filename); - } - } - - /** - * Counts the number of test cases that will be run by this test. - * - * @param bool $preferCache indicates if cache is preferred - */ - public function count($preferCache = false): int - { - if ($preferCache && $this->cachedNumTests !== null) { - return $this->cachedNumTests; - } - - $numTests = 0; - - foreach ($this as $test) { - $numTests += \count($test); - } - - $this->cachedNumTests = $numTests; - - return $numTests; - } - - /** - * Returns the name of the suite. - */ - public function getName(): string - { - return $this->name; - } - - /** - * Returns the test groups of the suite. - */ - public function getGroups(): array - { - return \array_keys($this->groups); - } - - public function getGroupDetails() - { - return $this->groups; - } - - /** - * Set tests groups of the test case - */ - public function setGroupDetails(array $groups): void - { - $this->groups = $groups; - } - - /** - * @return \Generator|Test[] - */ - protected function yieldTests(): \Generator - { - yield from $this->tests; - } - - /** - * Runs the tests and collects their result in a TestResult. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - */ - public function run(TestResult $result = null): TestResult - { - if ($result === null) { - $result = $this->createResult(); - } - - if (\count($this) == 0) { - return $result; - } - - $hookMethods = \PHPUnit\Util\Test::getHookMethods($this->name); - - $result->startTestSuite($this); - - try { - $this->setUp(); - - foreach ($hookMethods['beforeClass'] as $beforeClassMethod) { - if ($this->testCase === true && - \class_exists($this->name, false) && - \method_exists($this->name, $beforeClassMethod)) { - if ($missingRequirements = \PHPUnit\Util\Test::getMissingRequirements($this->name, $beforeClassMethod)) { - $this->markTestSuiteSkipped(\implode(\PHP_EOL, $missingRequirements)); - } - - \call_user_func([$this->name, $beforeClassMethod]); - } - } - } catch (SkippedTestSuiteError $e) { - $numTests = \count($this); - - for ($i = 0; $i < $numTests; $i++) { - $result->startTest($this); - $result->addFailure($this, $e, 0); - $result->endTest($this, 0); - } - - $this->tearDown(); - $result->endTestSuite($this); - - return $result; - } catch (Throwable $t) { - $numTests = \count($this); - - for ($i = 0; $i < $numTests; $i++) { - if ($result->shouldStop()) { - break; - } - - $result->startTest($this); - $result->addError($this, $t, 0); - $result->endTest($this, 0); - } - - $this->tearDown(); - $result->endTestSuite($this); - - return $result; - } - - foreach ($this->yieldTests() as $test) { - if ($result->shouldStop()) { - break; - } - - if ($test instanceof TestCase || $test instanceof self) { - $test->setBeStrictAboutChangesToGlobalState($this->beStrictAboutChangesToGlobalState); - $test->setBackupGlobals($this->backupGlobals); - $test->setBackupStaticAttributes($this->backupStaticAttributes); - $test->setRunTestInSeparateProcess($this->runTestInSeparateProcess); - } - - $test->run($result); - } - - foreach ($hookMethods['afterClass'] as $afterClassMethod) { - if ($this->testCase === true && \class_exists($this->name, false) && \method_exists($this->name, $afterClassMethod)) { - \call_user_func([$this->name, $afterClassMethod]); - } - } - - $this->tearDown(); - - $result->endTestSuite($this); - - return $result; - } - - public function setRunTestInSeparateProcess(bool $runTestInSeparateProcess): void - { - $this->runTestInSeparateProcess = $runTestInSeparateProcess; - } - - public function setName(string $name): void - { - $this->name = $name; - } - - /** - * Returns the test at the given index. - * - * @return false|Test - */ - public function testAt(int $index) - { - if (isset($this->tests[$index])) { - return $this->tests[$index]; - } - - return false; - } - - /** - * Returns the tests as an enumeration. - */ - public function tests(): array - { - return $this->tests; - } - - /** - * Set tests of the test suite - */ - public function setTests(array $tests): void - { - $this->tests = $tests; - } - - /** - * Mark the test suite as skipped. - * - * @param string $message - * - * @throws SkippedTestSuiteError - */ - public function markTestSuiteSkipped($message = ''): void - { - throw new SkippedTestSuiteError($message); - } - - /** - * @param bool $beStrictAboutChangesToGlobalState - */ - public function setBeStrictAboutChangesToGlobalState($beStrictAboutChangesToGlobalState): void - { - if (null === $this->beStrictAboutChangesToGlobalState && \is_bool($beStrictAboutChangesToGlobalState)) { - $this->beStrictAboutChangesToGlobalState = $beStrictAboutChangesToGlobalState; - } - } - - /** - * @param bool $backupGlobals - */ - public function setBackupGlobals($backupGlobals): void - { - if (null === $this->backupGlobals && \is_bool($backupGlobals)) { - $this->backupGlobals = $backupGlobals; - } - } - - /** - * @param bool $backupStaticAttributes - */ - public function setBackupStaticAttributes($backupStaticAttributes): void - { - if (null === $this->backupStaticAttributes && \is_bool($backupStaticAttributes)) { - $this->backupStaticAttributes = $backupStaticAttributes; - } - } - - /** - * Returns an iterator for this test suite. - */ - public function getIterator(): Iterator - { - $iterator = new TestSuiteIterator($this); - - if ($this->iteratorFilter !== null) { - $iterator = $this->iteratorFilter->factory($iterator, $this); - } - - return $iterator; - } - - public function injectFilter(Factory $filter): void - { - $this->iteratorFilter = $filter; - - foreach ($this as $test) { - if ($test instanceof self) { - $test->injectFilter($filter); - } - } - } - - /** - * Creates a default TestResult object. - */ - protected function createResult(): TestResult - { - return new TestResult; - } - - /** - * @throws Exception - */ - protected function addTestMethod(ReflectionClass $class, ReflectionMethod $method): void - { - 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 TestCase || $test instanceof DataProviderTestSuite) { - $test->setDependencies( - \PHPUnit\Util\Test::getDependencies($class->getName(), $name) - ); - } - - $this->addTest( - $test, - \PHPUnit\Util\Test::getGroups($class->getName(), $name) - ); - } - - /** - * @param string $message - */ - protected static function warning($message): WarningTestCase - { - return new WarningTestCase($message); - } - - /** - * @param string $class - * @param string $methodName - * @param string $message - */ - protected static function skipTest($class, $methodName, $message): SkippedTestCase - { - return new SkippedTestCase($class, $methodName, $message); - } - - /** - * @param string $class - * @param string $methodName - * @param string $message - */ - protected static function incompleteTest($class, $methodName, $message): IncompleteTestCase - { - return new IncompleteTestCase($class, $methodName, $message); - } -} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework; + +use Iterator; +use IteratorAggregate; +use PHPUnit\Runner\BaseTestRunner; +use PHPUnit\Runner\Filter\Factory; +use PHPUnit\Runner\PhptTestCase; +use PHPUnit\Util\FileLoader; +use PHPUnit\Util\InvalidArgumentHelper; +use ReflectionClass; +use ReflectionMethod; +use Throwable; + +/** + * A TestSuite is a composite of Tests. It runs a collection of test cases. + */ +class TestSuite implements Test, SelfDescribing, IteratorAggregate +{ + /** + * Enable or disable the backup and restoration of the $GLOBALS array. + * + * @var bool + */ + protected $backupGlobals; + + /** + * Enable or disable the backup and restoration of static attributes. + * + * @var bool + */ + protected $backupStaticAttributes; + + /** + * @var bool + */ + protected $runTestInSeparateProcess = false; + + /** + * The name of the test suite. + * + * @var string + */ + protected $name = ''; + + /** + * The test groups of the test suite. + * + * @var array + */ + protected $groups = []; + + /** + * The tests in the test suite. + * + * @var TestCase[] + */ + protected $tests = []; + + /** + * The number of tests in the test suite. + * + * @var int + */ + protected $numTests = -1; + + /** + * @var bool + */ + protected $testCase = false; + + /** + * @var array + */ + protected $foundClasses = []; + + /** + * Last count of tests in this suite. + * + * @var null|int + */ + private $cachedNumTests; + + /** + * @var bool + */ + private $beStrictAboutChangesToGlobalState; + + /** + * @var Factory + */ + private $iteratorFilter; + + /** + * @var string[] + */ + private $declaredClasses; + + /** + * @param string $name + * + * @throws Exception + */ + public static function createTest(ReflectionClass $theClass, $name): Test + { + $className = $theClass->getName(); + + if (!$theClass->isInstantiable()) { + return self::warning( + \sprintf('Cannot instantiate class "%s".', $className) + ); + } + + $backupSettings = \PHPUnit\Util\Test::getBackupSettings( + $className, + $name + ); + + $preserveGlobalState = \PHPUnit\Util\Test::getPreserveGlobalStateSettings( + $className, + $name + ); + + $runTestInSeparateProcess = \PHPUnit\Util\Test::getProcessIsolationSettings( + $className, + $name + ); + + $runClassInSeparateProcess = \PHPUnit\Util\Test::getClassProcessIsolationSettings( + $className, + $name + ); + + $constructor = $theClass->getConstructor(); + + if ($constructor === null) { + throw new Exception('No valid test provided.'); + } + $hasData = false; + // TestCase($name, $data) + if ($provider = @\PHPUnit\Util\Test::parseTestMethodAnnotations($className, $name)['method']['dataProvider'][0]) { + $test = new DataProviderTestSuite($provider, $theClass, $name); + $test->setGroupDetails(\PHPUnit\Util\Test::getGroups($className, $name)); + $hasData = true; + } + if (null!== @\PHPUnit\Util\Test::parseTestMethodAnnotations($className, $name)['method']['testWith']) { + $test = new WithTestSuite($theClass, $name); + $test->setGroupDetails(\PHPUnit\Util\Test::getGroups($className, $name)); + $hasData = true; + } + if (!$hasData) { + $test = new $className($name); + if ($runTestInSeparateProcess) { + $test->setRunTestInSeparateProcess(true); + + if ($preserveGlobalState !== null) { + $test->setPreserveGlobalState($preserveGlobalState); + } + } + + if ($runClassInSeparateProcess) { + $test->setRunClassInSeparateProcess(true); + + if ($preserveGlobalState !== null) { + $test->setPreserveGlobalState($preserveGlobalState); + } + } + + if ($backupSettings['backupGlobals'] !== null) { + $test->setBackupGlobals($backupSettings['backupGlobals']); + } + + if ($backupSettings['backupStaticAttributes'] !== null) { + $test->setBackupStaticAttributes( + $backupSettings['backupStaticAttributes'] + ); + } + } + + return $test; + } + + public static function isTestMethod(ReflectionMethod $method): bool + { + if (\strpos($method->name, 'test') === 0) { + return true; + } + + $annotations = \PHPUnit\Util\Test::parseAnnotations($method->getDocComment()); + + return isset($annotations['test']); + } + + /** + * Constructs a new TestSuite: + * + * - PHPUnit\Framework\TestSuite() constructs an empty TestSuite. + * + * - PHPUnit\Framework\TestSuite(ReflectionClass) constructs a + * TestSuite from the given class. + * + * - PHPUnit\Framework\TestSuite(ReflectionClass, String) + * constructs a TestSuite from the given class with the given + * name. + * + * - PHPUnit\Framework\TestSuite(String) either constructs a + * TestSuite from the given class (if the passed string is the + * name of an existing class) or constructs an empty TestSuite + * with the given name. + * + * @param string $name + * + * @throws Exception + */ + public function __construct($theClass = '', $name = '', bool $skipTestDiscovery = false) + { + $this->declaredClasses = \get_declared_classes(); + + $argumentsValid = false; + + if (\is_object($theClass) && + $theClass instanceof ReflectionClass) { + $argumentsValid = true; + } elseif (\is_string($theClass) && + $theClass !== '' && + \class_exists($theClass, false)) { + $argumentsValid = true; + + if ($name == '') { + $name = $theClass; + } + + $theClass = new ReflectionClass($theClass); + } elseif (\is_string($theClass)) { + $this->setName($theClass); + + return; + } + + if (!$argumentsValid) { + throw new Exception; + } + + if (!$theClass->isSubclassOf(TestCase::class)) { + throw new Exception( + 'Class "' . $theClass->name . '" does not extend PHPUnit\Framework\TestCase.' + ); + } + + if ($name != '') { + $this->setName($name); + } else { + $this->setName($theClass->getName()); + } + + $constructor = $theClass->getConstructor(); + + if ($constructor !== null && + !$constructor->isPublic()) { + $this->addTest( + self::warning( + \sprintf( + 'Class "%s" has no public constructor.', + $theClass->getName() + ) + ) + ); + + return; + } + if ($skipTestDiscovery) { + return; + } + foreach ($theClass->getMethods() as $method) { + if ($method->getDeclaringClass()->getName() === Assert::class) { + continue; + } + + if ($method->getDeclaringClass()->getName() === TestCase::class) { + continue; + } + + $this->addTestMethod($theClass, $method); + } + + if (empty($this->tests)) { + $this->addTest( + self::warning( + \sprintf( + 'No tests found in class "%s".', + $theClass->getName() + ) + ) + ); + } + + $this->testCase = true; + } + + /** + * Template Method that is called before the tests + * of this test suite are run. + */ + protected function setUp(): void + { + } + + /** + * Template Method that is called after the tests + * of this test suite have finished running. + */ + protected function tearDown(): void + { + } + + /** + * Returns a string representation of the test suite. + */ + public function toString(): string + { + return $this->getName(); + } + + /** + * Adds a test to the suite. + * + * @param array $groups + */ + public function addTest(Test $test, $groups = []): void + { + $class = new ReflectionClass($test); + + if (!$class->isAbstract()) { + $this->tests[] = $test; + $this->numTests = -1; + + if ($test instanceof self && empty($groups)) { + $groups = $test->getGroups(); + } + + if (empty($groups)) { + $groups = ['default']; + } + + foreach ($groups as $group) { + if (!isset($this->groups[$group])) { + $this->groups[$group] = [$test]; + } else { + $this->groups[$group][] = $test; + } + } + + if ($test instanceof TestCase) { + $test->setGroups($groups); + } + } + } + + /** + * Adds the tests from the given class to the suite. + * + * @throws Exception + */ + public function addTestSuite($testClass): void + { + if (\is_string($testClass) && \class_exists($testClass)) { + $testClass = new ReflectionClass($testClass); + } + + if (!\is_object($testClass)) { + throw InvalidArgumentHelper::factory( + 1, + 'class name or object' + ); + } + + if ($testClass instanceof self) { + $this->addTest($testClass); + } elseif ($testClass instanceof ReflectionClass) { + $suiteMethod = false; + + if (!$testClass->isAbstract() && $testClass->hasMethod(BaseTestRunner::SUITE_METHODNAME)) { + $method = $testClass->getMethod( + BaseTestRunner::SUITE_METHODNAME + ); + + if ($method->isStatic()) { + $this->addTest( + $method->invoke(null, $testClass->getName()) + ); + + $suiteMethod = true; + } + } + + if (!$suiteMethod && !$testClass->isAbstract() && $testClass->isSubclassOf(TestCase::class)) { + $this->addTest(new self($testClass)); + } + } else { + throw new Exception; + } + } + + /** + * Wraps both addTest() and addTestSuite + * as well as the separate import statements for the user's convenience. + * + * If the named file cannot be read or there are no new tests that can be + * added, a PHPUnit\Framework\WarningTestCase will be created instead, + * leaving the current test run untouched. + * + * @throws Exception + */ + public function addTestFile(string $filename): void + { + if (\file_exists($filename) && \substr($filename, -5) == '.phpt') { + $this->addTest( + new PhptTestCase($filename) + ); + + return; + } + + // The given file may contain further stub classes in addition to the + // test class itself. Figure out the actual test class. + $filename = FileLoader::checkAndLoad($filename); + $newClasses = \array_diff(\get_declared_classes(), $this->declaredClasses); + + // The diff is empty in case a parent class (with test methods) is added + // AFTER a child class that inherited from it. To account for that case, + // accumulate all discovered classes, so the parent class may be found in + // a later invocation. + if (!empty($newClasses)) { + // On the assumption that test classes are defined first in files, + // process discovered classes in approximate LIFO order, so as to + // avoid unnecessary reflection. + $this->foundClasses = \array_merge($newClasses, $this->foundClasses); + $this->declaredClasses = \get_declared_classes(); + } + + // The test class's name must match the filename, either in full, or as + // a PEAR/PSR-0 prefixed short name ('NameSpace_ShortName'), or as a + // PSR-1 local short name ('NameSpace\ShortName'). The comparison must be + // anchored to prevent false-positive matches (e.g., 'OtherShortName'). + $shortName = \basename($filename, '.php'); + $shortNameRegEx = '/(?:^|_|\\\\)' . \preg_quote($shortName, '/') . '$/'; + + foreach ($this->foundClasses as $i => $className) { + if (\preg_match($shortNameRegEx, $className)) { + $class = new ReflectionClass($className); + + if ($class->getFileName() == $filename) { + $newClasses = [$className]; + unset($this->foundClasses[$i]); + + break; + } + } + } + + foreach ($newClasses as $className) { + $class = new ReflectionClass($className); + + if (\dirname($class->getFileName()) === __DIR__) { + continue; + } + + if (!$class->isAbstract()) { + if ($class->hasMethod(BaseTestRunner::SUITE_METHODNAME)) { + $method = $class->getMethod( + BaseTestRunner::SUITE_METHODNAME + ); + + if ($method->isStatic()) { + $this->addTest($method->invoke(null, $className)); + } + } elseif ($class->implementsInterface(Test::class)) { + $this->addTestSuite($class); + } + } + } + + $this->numTests = -1; + } + + /** + * Wrapper for addTestFile() that adds multiple test files. + * + * @param array|Iterator $fileNames + * + * @throws Exception + */ + public function addTestFiles($fileNames): void + { + if (!(\is_array($fileNames) || + (\is_object($fileNames) && $fileNames instanceof Iterator))) { + throw InvalidArgumentHelper::factory( + 1, + 'array or iterator' + ); + } + + foreach ($fileNames as $filename) { + $this->addTestFile((string) $filename); + } + } + + /** + * Counts the number of test cases that will be run by this test. + * + * @param bool $preferCache indicates if cache is preferred + */ + public function count($preferCache = false): int + { + if ($preferCache && $this->cachedNumTests !== null) { + return $this->cachedNumTests; + } + + $numTests = 0; + + foreach ($this as $test) { + $numTests += \count($test); + } + + $this->cachedNumTests = $numTests; + + return $numTests; + } + + /** + * Returns the name of the suite. + */ + public function getName(): string + { + return $this->name; + } + + /** + * Returns the test groups of the suite. + */ + public function getGroups(): array + { + return \array_keys($this->groups); + } + + public function getGroupDetails() + { + return $this->groups; + } + + /** + * Set tests groups of the test case + */ + public function setGroupDetails(array $groups): void + { + $this->groups = $groups; + } + + /** + * @return \Generator|Test[] + */ + protected function yieldTests(): \Generator + { + yield from $this->tests; + } + + /** + * Runs the tests and collects their result in a TestResult. + * + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public function run(TestResult $result = null): TestResult + { + if ($result === null) { + $result = $this->createResult(); + } + + if (\count($this) == 0) { + return $result; + } + + $hookMethods = \PHPUnit\Util\Test::getHookMethods($this->name); + + $result->startTestSuite($this); + + try { + $this->setUp(); + + foreach ($hookMethods['beforeClass'] as $beforeClassMethod) { + if ($this->testCase === true && + \class_exists($this->name, false) && + \method_exists($this->name, $beforeClassMethod)) { + if ($missingRequirements = \PHPUnit\Util\Test::getMissingRequirements($this->name, $beforeClassMethod)) { + $this->markTestSuiteSkipped(\implode(\PHP_EOL, $missingRequirements)); + } + + \call_user_func([$this->name, $beforeClassMethod]); + } + } + } catch (SkippedTestSuiteError $e) { + $numTests = \count($this); + + for ($i = 0; $i < $numTests; $i++) { + $result->startTest($this); + $result->addFailure($this, $e, 0); + $result->endTest($this, 0); + } + + $this->tearDown(); + $result->endTestSuite($this); + + return $result; + } catch (Throwable $t) { + $numTests = \count($this); + + for ($i = 0; $i < $numTests; $i++) { + if ($result->shouldStop()) { + break; + } + + $result->startTest($this); + $result->addError($this, $t, 0); + $result->endTest($this, 0); + } + + $this->tearDown(); + $result->endTestSuite($this); + + return $result; + } + + foreach ($this->yieldTests() as $test) { + if ($result->shouldStop()) { + break; + } + + if ($test instanceof TestCase || $test instanceof self) { + $test->setBeStrictAboutChangesToGlobalState($this->beStrictAboutChangesToGlobalState); + $test->setBackupGlobals($this->backupGlobals); + $test->setBackupStaticAttributes($this->backupStaticAttributes); + $test->setRunTestInSeparateProcess($this->runTestInSeparateProcess); + } + + $test->run($result); + } + + foreach ($hookMethods['afterClass'] as $afterClassMethod) { + if ($this->testCase === true && \class_exists($this->name, false) && \method_exists($this->name, $afterClassMethod)) { + \call_user_func([$this->name, $afterClassMethod]); + } + } + + $this->tearDown(); + + $result->endTestSuite($this); + + return $result; + } + + public function setRunTestInSeparateProcess(bool $runTestInSeparateProcess): void + { + $this->runTestInSeparateProcess = $runTestInSeparateProcess; + } + + public function setName(string $name): void + { + $this->name = $name; + } + + /** + * Returns the test at the given index. + * + * @return false|Test + */ + public function testAt(int $index) + { + if (isset($this->tests[$index])) { + return $this->tests[$index]; + } + + return false; + } + + /** + * Returns the tests as an enumeration. + */ + public function tests(): array + { + return $this->tests; + } + + /** + * Set tests of the test suite + */ + public function setTests(array $tests): void + { + $this->tests = $tests; + } + + /** + * Mark the test suite as skipped. + * + * @param string $message + * + * @throws SkippedTestSuiteError + */ + public function markTestSuiteSkipped($message = ''): void + { + throw new SkippedTestSuiteError($message); + } + + /** + * @param bool $beStrictAboutChangesToGlobalState + */ + public function setBeStrictAboutChangesToGlobalState($beStrictAboutChangesToGlobalState): void + { + if (null === $this->beStrictAboutChangesToGlobalState && \is_bool($beStrictAboutChangesToGlobalState)) { + $this->beStrictAboutChangesToGlobalState = $beStrictAboutChangesToGlobalState; + } + } + + /** + * @param bool $backupGlobals + */ + public function setBackupGlobals($backupGlobals): void + { + if (null === $this->backupGlobals && \is_bool($backupGlobals)) { + $this->backupGlobals = $backupGlobals; + } + } + + /** + * @param bool $backupStaticAttributes + */ + public function setBackupStaticAttributes($backupStaticAttributes): void + { + if (null === $this->backupStaticAttributes && \is_bool($backupStaticAttributes)) { + $this->backupStaticAttributes = $backupStaticAttributes; + } + } + + /** + * Returns an iterator for this test suite. + */ + public function getIterator(): Iterator + { + $iterator = new TestSuiteIterator($this); + + if ($this->iteratorFilter !== null) { + $iterator = $this->iteratorFilter->factory($iterator, $this); + } + + return $iterator; + } + + public function injectFilter(Factory $filter): void + { + $this->iteratorFilter = $filter; + + foreach ($this as $test) { + if ($test instanceof self) { + $test->injectFilter($filter); + } + } + } + + /** + * Creates a default TestResult object. + */ + protected function createResult(): TestResult + { + return new TestResult; + } + + /** + * @throws Exception + */ + protected function addTestMethod(ReflectionClass $class, ReflectionMethod $method): void + { + 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 TestCase || $test instanceof DataProviderTestSuite) { + $test->setDependencies( + \PHPUnit\Util\Test::getDependencies($class->getName(), $name) + ); + } + + $this->addTest( + $test, + \PHPUnit\Util\Test::getGroups($class->getName(), $name) + ); + } + + /** + * @param string $message + */ + protected static function warning($message): WarningTestCase + { + return new WarningTestCase($message); + } + + /** + * @param string $class + * @param string $methodName + * @param string $message + */ + protected static function skipTest($class, $methodName, $message): SkippedTestCase + { + return new SkippedTestCase($class, $methodName, $message); + } + + /** + * @param string $class + * @param string $methodName + * @param string $message + */ + protected static function incompleteTest($class, $methodName, $message): IncompleteTestCase + { + return new IncompleteTestCase($class, $methodName, $message); + } +} diff --git a/src/Framework/WithTestSuite.php b/src/Framework/WithTestSuite.php new file mode 100644 index 00000000000..3f62b54054f --- /dev/null +++ b/src/Framework/WithTestSuite.php @@ -0,0 +1,85 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework; + +use Generator; +use ReflectionClass; + +class WithTestSuite extends TestSuite +{ + private $theClass; + private $method; + public function __construct(ReflectionClass $theClass, string $method) + { + parent::__construct($theClass, $theClass->getName().'::'.$method, true); + $this->theClass = $theClass; + $this->method = $method; + } + /** + * @var string[] + */ + private $dependencies = []; + + /** + * @param string[] $dependencies + */ + public function setDependencies(array $dependencies): void + { + $this->dependencies = $dependencies; + + foreach ($this->tests as $test) { + $test->setDependencies($dependencies); + } + } + + public function getDependencies(): array + { + return $this->dependencies; + } + + public function hasDependencies(): bool + { + return \count($this->dependencies) > 0; + } + + /** + * @return Generator|Test[] + */ + protected function yieldTests(): Generator + { + yield from parent::yieldTests(); + try { + foreach (\PHPUnit\Util\Test::getDataFromTestWithAnnotation($this->theClass->getMethod($this->method)->getDocComment())[0]??[] as $name => $set) { + if(!is_array($set)) { + yield self::warning("set $name is invalid."); + continue; + } + try { + $test = $this->theClass->newInstanceArgs([ + $this->method, + $set, + $name + ]); + $test->setDependencies($this->dependencies); + yield $test; + } catch (\Throwable $e) { + yield self::warning("Test creation failed. $e"); + } + } + } catch (\Throwable $e) { + yield self::warning("data provider failed. $e"); + } + } + + public function count($preferCache = false): int + { + return 1; + } +} From 1ec19f301edbb063cf7835f90d0e872783ca9ceb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20B=C3=BCttner?= Date: Sat, 14 Jul 2018 12:07:00 +0200 Subject: [PATCH 04/13] extract duplicated code --- src/Framework/DataProvidedTestSuite.php | 88 +++++++++++++++++++++++++ src/Framework/DataProviderTestSuite.php | 70 ++------------------ src/Framework/WithTestSuite.php | 75 ++------------------- 3 files changed, 98 insertions(+), 135 deletions(-) create mode 100644 src/Framework/DataProvidedTestSuite.php diff --git a/src/Framework/DataProvidedTestSuite.php b/src/Framework/DataProvidedTestSuite.php new file mode 100644 index 00000000000..09e0b17feaf --- /dev/null +++ b/src/Framework/DataProvidedTestSuite.php @@ -0,0 +1,88 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework; + +use Generator; +use ReflectionClass; +use Throwable; + +abstract class DataProvidedTestSuite extends TestSuite +{ + protected $theClass; + protected $method; + public function __construct(ReflectionClass $theClass, string $method) + { + parent::__construct($theClass, $theClass->getName().'::'.$method, true); + $this->theClass = $theClass; + $this->method = $method; + } + /** + * @var string[] + */ + private $dependencies = []; + + /** + * @param string[] $dependencies + */ + public function setDependencies(array $dependencies): void + { + $this->dependencies = $dependencies; + + foreach ($this->tests as $test) { + $test->setDependencies($dependencies); + } + } + + public function getDependencies(): array + { + return $this->dependencies; + } + + public function hasDependencies(): bool + { + return \count($this->dependencies) > 0; + } + + abstract protected function yieldData(): iterable; + + /** + * @return Generator|Test[] + */ + protected function yieldTests(): Generator + { + yield from parent::yieldTests(); + try { + foreach ($this->yieldData() as $name => $set) { + if(!is_array($set)) { + yield self::warning("set $name is invalid."); + continue; + } + try { + $test = $this->theClass->newInstanceArgs([ + $this->method, + $set, + $name + ]); + $test->setDependencies($this->dependencies); + yield $test; + } catch (Throwable $e) { + yield self::warning("Test creation failed. $e"); + } + } + } catch (Throwable $e) { + yield self::warning("data provider failed. $e"); + } + } + + public function count($preferCache = false): int + { + return 1; + } +} \ No newline at end of file diff --git a/src/Framework/DataProviderTestSuite.php b/src/Framework/DataProviderTestSuite.php index f34582ea606..3d2d5ad9cbf 100644 --- a/src/Framework/DataProviderTestSuite.php +++ b/src/Framework/DataProviderTestSuite.php @@ -9,80 +9,20 @@ */ namespace PHPUnit\Framework; -use Generator; use ReflectionClass; -class DataProviderTestSuite extends TestSuite +class DataProviderTestSuite extends DataProvidedTestSuite { private $provider; - private $theClass; - private $method; public function __construct($provider, ReflectionClass $theClass, string $method) { - parent::__construct($theClass, $theClass->getName().'::'.$method, true); + parent::__construct($theClass, $method); $this->provider = $provider; - $this->theClass = $theClass; - $this->method = $method; } - /** - * @var string[] - */ - private $dependencies = []; - /** - * @param string[] $dependencies - */ - public function setDependencies(array $dependencies): void + protected function yieldData(): iterable { - $this->dependencies = $dependencies; - - foreach ($this->tests as $test) { - $test->setDependencies($dependencies); - } - } - - public function getDependencies(): array - { - return $this->dependencies; - } - - public function hasDependencies(): bool - { - return \count($this->dependencies) > 0; - } - - /** - * @return Generator|Test[] - */ - protected function yieldTests(): Generator - { - yield from parent::yieldTests(); - try { - $provider = $this->theClass->newInstanceArgs(); - foreach ($provider->{$this->provider}() as $name => $set) { - if(!is_array($set)) { - yield self::warning("set $name is invalid."); - continue; - } - try { - $test = $this->theClass->newInstanceArgs([ - $this->method, - $set, - $name - ]); - $test->setDependencies($this->dependencies); - yield $test; - } catch (\Throwable $e) { - yield self::warning("Test creation failed. $e"); - } - } - } catch (\Throwable $e) { - yield self::warning("data provider failed. $e"); - } - } - - public function count($preferCache = false): int - { - return 1; + $provider = $this->theClass->newInstanceArgs(); + yield from $provider->{$this->provider}(); } } diff --git a/src/Framework/WithTestSuite.php b/src/Framework/WithTestSuite.php index 3f62b54054f..0391c3e1151 100644 --- a/src/Framework/WithTestSuite.php +++ b/src/Framework/WithTestSuite.php @@ -9,77 +9,12 @@ */ namespace PHPUnit\Framework; -use Generator; -use ReflectionClass; - -class WithTestSuite extends TestSuite +class WithTestSuite extends DataProvidedTestSuite { - private $theClass; - private $method; - public function __construct(ReflectionClass $theClass, string $method) - { - parent::__construct($theClass, $theClass->getName().'::'.$method, true); - $this->theClass = $theClass; - $this->method = $method; - } - /** - * @var string[] - */ - private $dependencies = []; - - /** - * @param string[] $dependencies - */ - public function setDependencies(array $dependencies): void - { - $this->dependencies = $dependencies; - - foreach ($this->tests as $test) { - $test->setDependencies($dependencies); - } - } - - public function getDependencies(): array - { - return $this->dependencies; - } - - public function hasDependencies(): bool - { - return \count($this->dependencies) > 0; - } - - /** - * @return Generator|Test[] - */ - protected function yieldTests(): Generator - { - yield from parent::yieldTests(); - try { - foreach (\PHPUnit\Util\Test::getDataFromTestWithAnnotation($this->theClass->getMethod($this->method)->getDocComment())[0]??[] as $name => $set) { - if(!is_array($set)) { - yield self::warning("set $name is invalid."); - continue; - } - try { - $test = $this->theClass->newInstanceArgs([ - $this->method, - $set, - $name - ]); - $test->setDependencies($this->dependencies); - yield $test; - } catch (\Throwable $e) { - yield self::warning("Test creation failed. $e"); - } - } - } catch (\Throwable $e) { - yield self::warning("data provider failed. $e"); - } - } - - public function count($preferCache = false): int + protected function yieldData(): iterable { - return 1; + return \PHPUnit\Util\Test::getDataFromTestWithAnnotation( + $this->theClass->getMethod($this->method)->getDocComment() + )[0]??[]; } } From 260fc6128316950604fc3f159440686c92a38e7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20B=C3=BCttner?= Date: Sat, 14 Jul 2018 14:11:42 +0200 Subject: [PATCH 05/13] removing total test count and percentage --- tests/TextUI/abstract-test-class.phpt | 2 +- tests/TextUI/assertion.phpt | 2 +- tests/TextUI/cache-result.phpt | 2 +- tests/TextUI/code-coverage-ignore.phpt | 2 +- tests/TextUI/code-coverage-phpt.phpt | 2 +- tests/TextUI/colors-always.phpt | 2 +- tests/TextUI/concrete-test-class.phpt | 2 +- tests/TextUI/custom-printer-verbose.phpt | 2 +- tests/TextUI/dataprovider-issue-2833.phpt | 2 +- tests/TextUI/dataprovider-issue-2859.phpt | 2 +- tests/TextUI/dataprovider-issue-2922.phpt | 2 +- tests/TextUI/dataprovider-log-xml-isolation.phpt | 2 +- tests/TextUI/dataprovider-log-xml.phpt | 2 +- tests/TextUI/default-isolation.phpt | 2 +- tests/TextUI/default.phpt | 2 +- tests/TextUI/dependencies-clone.phpt | 2 +- tests/TextUI/dependencies-isolation.phpt | 2 +- tests/TextUI/dependencies.phpt | 2 +- tests/TextUI/dependencies2-isolation.phpt | 2 +- tests/TextUI/dependencies2.phpt | 2 +- tests/TextUI/dependencies3-isolation.phpt | 2 +- tests/TextUI/dependencies3.phpt | 2 +- tests/TextUI/disable-code-coverage-ignore.phpt | 2 +- tests/TextUI/empty-testcase.phpt | 2 +- tests/TextUI/exception-stack.phpt | 2 +- tests/TextUI/exclude-group-isolation.phpt | 2 +- tests/TextUI/exclude-group.phpt | 2 +- tests/TextUI/failure-isolation.phpt | 2 +- tests/TextUI/failure-reverse-list.phpt | 2 +- tests/TextUI/failure.phpt | 2 +- tests/TextUI/fatal-isolation.phpt | 2 +- tests/TextUI/filter-class-isolation.phpt | 2 +- tests/TextUI/filter-class.phpt | 2 +- .../filter-dataprovider-by-classname-and-range-isolation.phpt | 2 +- tests/TextUI/filter-dataprovider-by-classname-and-range.phpt | 2 +- tests/TextUI/filter-dataprovider-by-number-isolation.phpt | 2 +- tests/TextUI/filter-dataprovider-by-number.phpt | 2 +- tests/TextUI/filter-dataprovider-by-only-range-isolation.phpt | 2 +- tests/TextUI/filter-dataprovider-by-only-range.phpt | 2 +- tests/TextUI/filter-dataprovider-by-only-regexp-isolation.phpt | 2 +- tests/TextUI/filter-dataprovider-by-only-regexp.phpt | 2 +- tests/TextUI/filter-dataprovider-by-only-string-isolation.phpt | 2 +- tests/TextUI/filter-dataprovider-by-only-string.phpt | 2 +- tests/TextUI/filter-dataprovider-by-range-isolation.phpt | 2 +- tests/TextUI/filter-dataprovider-by-range.phpt | 2 +- tests/TextUI/filter-dataprovider-by-regexp-isolation.phpt | 2 +- tests/TextUI/filter-dataprovider-by-regexp.phpt | 2 +- tests/TextUI/filter-dataprovider-by-string-isolation.phpt | 2 +- tests/TextUI/filter-dataprovider-by-string.phpt | 2 +- tests/TextUI/filter-method-case-insensitive.phpt | 2 +- tests/TextUI/filter-method-isolation.phpt | 2 +- tests/TextUI/filter-method.phpt | 2 +- tests/TextUI/forward-compatibility.phpt | 2 +- tests/TextUI/group-isolation.phpt | 2 +- tests/TextUI/group.phpt | 2 +- tests/TextUI/ini-isolation.phpt | 2 +- tests/TextUI/log-junit.phpt | 2 +- tests/TextUI/log-teamcity.phpt | 2 +- tests/TextUI/mycommand.phpt | 2 +- tests/TextUI/options-after-arguments.phpt | 2 +- tests/TextUI/output-isolation.phpt | 2 +- tests/TextUI/phar-extension.phpt | 2 +- tests/TextUI/phpt-xfail.phpt | 2 +- tests/TextUI/repeat.phpt | 2 +- ...ertions-when-annotated-with-does-not-perform-assertions.phpt | 2 +- tests/TextUI/report-useless-tests-incomplete.phpt | 2 +- tests/TextUI/report-useless-tests-isolation.phpt | 2 +- tests/TextUI/report-useless-tests.phpt | 2 +- .../test-order-randomized-with-dependency-resolution.phpt | 2 +- tests/TextUI/test-suffix-multiple.phpt | 2 +- tests/TextUI/test-suffix-single.phpt | 2 +- tests/TextUI/testdox-exclude-group.phpt | 2 +- tests/TextUI/testdox-group.phpt | 2 +- tests/TextUI/testdox-html.phpt | 2 +- tests/TextUI/testdox-text.phpt | 2 +- tests/TextUI/testdox-xml.phpt | 2 +- 76 files changed, 76 insertions(+), 76 deletions(-) diff --git a/tests/TextUI/abstract-test-class.phpt b/tests/TextUI/abstract-test-class.phpt index 41535e64b71..1128c6b87c1 100644 --- a/tests/TextUI/abstract-test-class.phpt +++ b/tests/TextUI/abstract-test-class.phpt @@ -11,7 +11,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -W 1 / 1 (100%) +W 1 Time: %s, Memory: %s diff --git a/tests/TextUI/assertion.phpt b/tests/TextUI/assertion.phpt index f9306fb8cd6..95bb4ef323d 100644 --- a/tests/TextUI/assertion.phpt +++ b/tests/TextUI/assertion.phpt @@ -25,7 +25,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -F 1 / 1 (100%) +F 1 Time: %s, Memory: %s diff --git a/tests/TextUI/cache-result.phpt b/tests/TextUI/cache-result.phpt index 55320c82b0b..d38bf111507 100644 --- a/tests/TextUI/cache-result.phpt +++ b/tests/TextUI/cache-result.phpt @@ -20,7 +20,7 @@ unlink($target); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -.SS.. 5 / 5 (100%) +.SS.. 5 Time: %s, Memory: %s diff --git a/tests/TextUI/code-coverage-ignore.phpt b/tests/TextUI/code-coverage-ignore.phpt index f6ca35a5312..4d316dd5689 100644 --- a/tests/TextUI/code-coverage-ignore.phpt +++ b/tests/TextUI/code-coverage-ignore.phpt @@ -20,7 +20,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -.. 2 / 2 (100%) +.. 2 Time: %s, Memory: %s diff --git a/tests/TextUI/code-coverage-phpt.phpt b/tests/TextUI/code-coverage-phpt.phpt index c32817b7be5..1c6f7741d65 100644 --- a/tests/TextUI/code-coverage-phpt.phpt +++ b/tests/TextUI/code-coverage-phpt.phpt @@ -22,7 +22,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -. 1 / 1 (100%) +. 1 Time: %s, Memory: %s diff --git a/tests/TextUI/colors-always.phpt b/tests/TextUI/colors-always.phpt index 792824d76ee..254bf1955cc 100644 --- a/tests/TextUI/colors-always.phpt +++ b/tests/TextUI/colors-always.phpt @@ -11,7 +11,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -... 3 / 3 (100%) +... 3 Time: %s, Memory: %s diff --git a/tests/TextUI/concrete-test-class.phpt b/tests/TextUI/concrete-test-class.phpt index ffbb6abf6e1..387393d3a13 100644 --- a/tests/TextUI/concrete-test-class.phpt +++ b/tests/TextUI/concrete-test-class.phpt @@ -11,7 +11,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -.. 2 / 2 (100%) +.. 2 Time: %s, Memory: %s diff --git a/tests/TextUI/custom-printer-verbose.phpt b/tests/TextUI/custom-printer-verbose.phpt index 06ed19d8786..5aeac86cad8 100644 --- a/tests/TextUI/custom-printer-verbose.phpt +++ b/tests/TextUI/custom-printer-verbose.phpt @@ -16,7 +16,7 @@ PHPUnit %s by Sebastian Bergmann and contributors. Runtime: %s Configuration: %sconfiguration.custom-printer.xml -I 1 / 1 (100%) +I 1 Time: %s, Memory: %s diff --git a/tests/TextUI/dataprovider-issue-2833.phpt b/tests/TextUI/dataprovider-issue-2833.phpt index e1d55b1aa8c..e5514c7582b 100644 --- a/tests/TextUI/dataprovider-issue-2833.phpt +++ b/tests/TextUI/dataprovider-issue-2833.phpt @@ -10,7 +10,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -.. 2 / 2 (100%) +.. 2 Time: %s, Memory: %s diff --git a/tests/TextUI/dataprovider-issue-2859.phpt b/tests/TextUI/dataprovider-issue-2859.phpt index c6e8ed66cc7..12bb59e089f 100644 --- a/tests/TextUI/dataprovider-issue-2859.phpt +++ b/tests/TextUI/dataprovider-issue-2859.phpt @@ -10,7 +10,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -. 1 / 1 (100%) +. 1 Time: %s, Memory: %s diff --git a/tests/TextUI/dataprovider-issue-2922.phpt b/tests/TextUI/dataprovider-issue-2922.phpt index 2a864fbf6fd..2f674ae7b86 100644 --- a/tests/TextUI/dataprovider-issue-2922.phpt +++ b/tests/TextUI/dataprovider-issue-2922.phpt @@ -11,7 +11,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -. 1 / 1 (100%) +. 1 Time: %s, Memory: %s diff --git a/tests/TextUI/dataprovider-log-xml-isolation.phpt b/tests/TextUI/dataprovider-log-xml-isolation.phpt index a1a49769ab0..0bf741eefd0 100644 --- a/tests/TextUI/dataprovider-log-xml-isolation.phpt +++ b/tests/TextUI/dataprovider-log-xml-isolation.phpt @@ -14,7 +14,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -..F. 4 / 4 (100%) +..F. 4 diff --git a/tests/TextUI/dataprovider-log-xml.phpt b/tests/TextUI/dataprovider-log-xml.phpt index 642236002c9..426acae54dd 100644 --- a/tests/TextUI/dataprovider-log-xml.phpt +++ b/tests/TextUI/dataprovider-log-xml.phpt @@ -13,7 +13,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -..F. 4 / 4 (100%) +..F. 4 diff --git a/tests/TextUI/default-isolation.phpt b/tests/TextUI/default-isolation.phpt index 49084f49ea0..c16ff37d41e 100644 --- a/tests/TextUI/default-isolation.phpt +++ b/tests/TextUI/default-isolation.phpt @@ -12,7 +12,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -... 3 / 3 (100%) +... 3 Time: %s, Memory: %s diff --git a/tests/TextUI/default.phpt b/tests/TextUI/default.phpt index cf4c9d348d5..206dd5c7f6c 100644 --- a/tests/TextUI/default.phpt +++ b/tests/TextUI/default.phpt @@ -11,7 +11,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -... 3 / 3 (100%) +... 3 Time: %s, Memory: %s diff --git a/tests/TextUI/dependencies-clone.phpt b/tests/TextUI/dependencies-clone.phpt index ed3e862e2ee..f2d5916e979 100644 --- a/tests/TextUI/dependencies-clone.phpt +++ b/tests/TextUI/dependencies-clone.phpt @@ -14,7 +14,7 @@ PHPUnit %s by Sebastian Bergmann and contributors. Runtime: %s -...... 6 / 6 (100%) +...... 6 Time: %s, Memory: %s diff --git a/tests/TextUI/dependencies-isolation.phpt b/tests/TextUI/dependencies-isolation.phpt index 331204e68cc..c2ccd20436e 100644 --- a/tests/TextUI/dependencies-isolation.phpt +++ b/tests/TextUI/dependencies-isolation.phpt @@ -15,7 +15,7 @@ PHPUnit %s by Sebastian Bergmann and contributors. Runtime: %s -...FSSS 7 / 7 (100%) +...FSSS 7 Time: %s, Memory: %s diff --git a/tests/TextUI/dependencies.phpt b/tests/TextUI/dependencies.phpt index f495cd76a57..d447f650461 100644 --- a/tests/TextUI/dependencies.phpt +++ b/tests/TextUI/dependencies.phpt @@ -14,7 +14,7 @@ PHPUnit %s by Sebastian Bergmann and contributors. Runtime: %s -...FSSS 7 / 7 (100%) +...FSSS 7 Time: %s, Memory: %s diff --git a/tests/TextUI/dependencies2-isolation.phpt b/tests/TextUI/dependencies2-isolation.phpt index 87af237926e..18cce6564c8 100644 --- a/tests/TextUI/dependencies2-isolation.phpt +++ b/tests/TextUI/dependencies2-isolation.phpt @@ -12,7 +12,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -.. 2 / 2 (100%) +.. 2 Time: %s, Memory: %s diff --git a/tests/TextUI/dependencies2.phpt b/tests/TextUI/dependencies2.phpt index 92dd403fa63..9e71ab0e56a 100644 --- a/tests/TextUI/dependencies2.phpt +++ b/tests/TextUI/dependencies2.phpt @@ -11,7 +11,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -.. 2 / 2 (100%) +.. 2 Time: %s, Memory: %s diff --git a/tests/TextUI/dependencies3-isolation.phpt b/tests/TextUI/dependencies3-isolation.phpt index c6656d7325f..7b4c2ac2ebd 100644 --- a/tests/TextUI/dependencies3-isolation.phpt +++ b/tests/TextUI/dependencies3-isolation.phpt @@ -12,7 +12,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -..... 5 / 5 (100%) +..... 5 Time: %s, Memory: %s diff --git a/tests/TextUI/dependencies3.phpt b/tests/TextUI/dependencies3.phpt index 210815d56e0..ef2a5371cc5 100644 --- a/tests/TextUI/dependencies3.phpt +++ b/tests/TextUI/dependencies3.phpt @@ -12,7 +12,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -..... 5 / 5 (100%) +..... 5 Time: %s, Memory: %s diff --git a/tests/TextUI/disable-code-coverage-ignore.phpt b/tests/TextUI/disable-code-coverage-ignore.phpt index 391a0453734..71b5bcdd3a1 100644 --- a/tests/TextUI/disable-code-coverage-ignore.phpt +++ b/tests/TextUI/disable-code-coverage-ignore.phpt @@ -21,7 +21,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -.. 2 / 2 (100%) +.. 2 Time: %s, Memory: %s diff --git a/tests/TextUI/empty-testcase.phpt b/tests/TextUI/empty-testcase.phpt index afc100802f2..baa2e0be4ad 100644 --- a/tests/TextUI/empty-testcase.phpt +++ b/tests/TextUI/empty-testcase.phpt @@ -12,7 +12,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -W 1 / 1 (100%) +W 1 Time: %s, Memory: %s diff --git a/tests/TextUI/exception-stack.phpt b/tests/TextUI/exception-stack.phpt index ccedd5a5563..984c36f3f28 100644 --- a/tests/TextUI/exception-stack.phpt +++ b/tests/TextUI/exception-stack.phpt @@ -11,7 +11,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -EE 2 / 2 (100%) +EE 2 Time: %s, Memory: %s diff --git a/tests/TextUI/exclude-group-isolation.phpt b/tests/TextUI/exclude-group-isolation.phpt index 0f8bb8080f7..4e396aa9502 100644 --- a/tests/TextUI/exclude-group-isolation.phpt +++ b/tests/TextUI/exclude-group-isolation.phpt @@ -14,7 +14,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -.. 2 / 2 (100%) +.. 2 Time: %s, Memory: %s diff --git a/tests/TextUI/exclude-group.phpt b/tests/TextUI/exclude-group.phpt index 90667489aad..fefe972d74b 100644 --- a/tests/TextUI/exclude-group.phpt +++ b/tests/TextUI/exclude-group.phpt @@ -13,7 +13,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -.. 2 / 2 (100%) +.. 2 Time: %s, Memory: %s diff --git a/tests/TextUI/failure-isolation.phpt b/tests/TextUI/failure-isolation.phpt index c319f60f5d7..08d0f408cdb 100644 --- a/tests/TextUI/failure-isolation.phpt +++ b/tests/TextUI/failure-isolation.phpt @@ -12,7 +12,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -FFFFFFFFFFFFF 13 / 13 (100%) +FFFFFFFFFFFFF 13 Time: %s, Memory: %s diff --git a/tests/TextUI/failure-reverse-list.phpt b/tests/TextUI/failure-reverse-list.phpt index b16b23540b2..1b011efd1f0 100644 --- a/tests/TextUI/failure-reverse-list.phpt +++ b/tests/TextUI/failure-reverse-list.phpt @@ -12,7 +12,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -FFFFFFFFFFFFF 13 / 13 (100%) +FFFFFFFFFFFFF 13 Time: %s, Memory: %s diff --git a/tests/TextUI/failure.phpt b/tests/TextUI/failure.phpt index 217af841e5f..679cd5cb43d 100644 --- a/tests/TextUI/failure.phpt +++ b/tests/TextUI/failure.phpt @@ -11,7 +11,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -FFFFFFFFFFFFF 13 / 13 (100%) +FFFFFFFFFFFFF 13 Time: %s, Memory: %s diff --git a/tests/TextUI/fatal-isolation.phpt b/tests/TextUI/fatal-isolation.phpt index bfa7340879e..b8e0f0d51de 100644 --- a/tests/TextUI/fatal-isolation.phpt +++ b/tests/TextUI/fatal-isolation.phpt @@ -12,7 +12,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -E 1 / 1 (100%) +E 1 Time: %s, Memory: %s diff --git a/tests/TextUI/filter-class-isolation.phpt b/tests/TextUI/filter-class-isolation.phpt index 1bc2ba3b0fd..655ee462f67 100644 --- a/tests/TextUI/filter-class-isolation.phpt +++ b/tests/TextUI/filter-class-isolation.phpt @@ -14,7 +14,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -... 3 / 3 (100%) +... 3 Time: %s, Memory: %s diff --git a/tests/TextUI/filter-class.phpt b/tests/TextUI/filter-class.phpt index 5477c0b798a..58393a9153d 100644 --- a/tests/TextUI/filter-class.phpt +++ b/tests/TextUI/filter-class.phpt @@ -13,7 +13,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -... 3 / 3 (100%) +... 3 Time: %s, Memory: %s diff --git a/tests/TextUI/filter-dataprovider-by-classname-and-range-isolation.phpt b/tests/TextUI/filter-dataprovider-by-classname-and-range-isolation.phpt index 27fe0098c33..1b4692c5b00 100644 --- a/tests/TextUI/filter-dataprovider-by-classname-and-range-isolation.phpt +++ b/tests/TextUI/filter-dataprovider-by-classname-and-range-isolation.phpt @@ -14,7 +14,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -... 3 / 3 (100%) +... 3 Time: %s, Memory: %s diff --git a/tests/TextUI/filter-dataprovider-by-classname-and-range.phpt b/tests/TextUI/filter-dataprovider-by-classname-and-range.phpt index 8984681f3c8..a3ec2a6bae2 100644 --- a/tests/TextUI/filter-dataprovider-by-classname-and-range.phpt +++ b/tests/TextUI/filter-dataprovider-by-classname-and-range.phpt @@ -13,7 +13,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -... 3 / 3 (100%) +... 3 Time: %s, Memory: %s diff --git a/tests/TextUI/filter-dataprovider-by-number-isolation.phpt b/tests/TextUI/filter-dataprovider-by-number-isolation.phpt index 6f141e65781..0167a04411c 100644 --- a/tests/TextUI/filter-dataprovider-by-number-isolation.phpt +++ b/tests/TextUI/filter-dataprovider-by-number-isolation.phpt @@ -14,7 +14,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -. 1 / 1 (100%) +. 1 Time: %s, Memory: %s diff --git a/tests/TextUI/filter-dataprovider-by-number.phpt b/tests/TextUI/filter-dataprovider-by-number.phpt index 90a1fb65280..f0a52f4921d 100644 --- a/tests/TextUI/filter-dataprovider-by-number.phpt +++ b/tests/TextUI/filter-dataprovider-by-number.phpt @@ -13,7 +13,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -. 1 / 1 (100%) +. 1 Time: %s, Memory: %s diff --git a/tests/TextUI/filter-dataprovider-by-only-range-isolation.phpt b/tests/TextUI/filter-dataprovider-by-only-range-isolation.phpt index bb007c084f7..e5f30326120 100644 --- a/tests/TextUI/filter-dataprovider-by-only-range-isolation.phpt +++ b/tests/TextUI/filter-dataprovider-by-only-range-isolation.phpt @@ -14,7 +14,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -... 3 / 3 (100%) +... 3 Time: %s, Memory: %s diff --git a/tests/TextUI/filter-dataprovider-by-only-range.phpt b/tests/TextUI/filter-dataprovider-by-only-range.phpt index fa677f0e8f3..ef0a56acde1 100644 --- a/tests/TextUI/filter-dataprovider-by-only-range.phpt +++ b/tests/TextUI/filter-dataprovider-by-only-range.phpt @@ -13,7 +13,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -... 3 / 3 (100%) +... 3 Time: %s, Memory: %s diff --git a/tests/TextUI/filter-dataprovider-by-only-regexp-isolation.phpt b/tests/TextUI/filter-dataprovider-by-only-regexp-isolation.phpt index 04c10e42c3e..fe2b61c746c 100644 --- a/tests/TextUI/filter-dataprovider-by-only-regexp-isolation.phpt +++ b/tests/TextUI/filter-dataprovider-by-only-regexp-isolation.phpt @@ -14,7 +14,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -.. 2 / 2 (100%) +.. 2 Time: %s, Memory: %s diff --git a/tests/TextUI/filter-dataprovider-by-only-regexp.phpt b/tests/TextUI/filter-dataprovider-by-only-regexp.phpt index 0fea03b7be9..a258cd98131 100644 --- a/tests/TextUI/filter-dataprovider-by-only-regexp.phpt +++ b/tests/TextUI/filter-dataprovider-by-only-regexp.phpt @@ -13,7 +13,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -.. 2 / 2 (100%) +.. 2 Time: %s, Memory: %s diff --git a/tests/TextUI/filter-dataprovider-by-only-string-isolation.phpt b/tests/TextUI/filter-dataprovider-by-only-string-isolation.phpt index 95c344c179e..e39a2401a40 100644 --- a/tests/TextUI/filter-dataprovider-by-only-string-isolation.phpt +++ b/tests/TextUI/filter-dataprovider-by-only-string-isolation.phpt @@ -14,7 +14,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -. 1 / 1 (100%) +. 1 Time: %s, Memory: %s diff --git a/tests/TextUI/filter-dataprovider-by-only-string.phpt b/tests/TextUI/filter-dataprovider-by-only-string.phpt index 2dac9ecdd99..79cb96846cd 100644 --- a/tests/TextUI/filter-dataprovider-by-only-string.phpt +++ b/tests/TextUI/filter-dataprovider-by-only-string.phpt @@ -13,7 +13,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -. 1 / 1 (100%) +. 1 Time: %s, Memory: %s diff --git a/tests/TextUI/filter-dataprovider-by-range-isolation.phpt b/tests/TextUI/filter-dataprovider-by-range-isolation.phpt index 90335cafc1c..9b01a856a55 100644 --- a/tests/TextUI/filter-dataprovider-by-range-isolation.phpt +++ b/tests/TextUI/filter-dataprovider-by-range-isolation.phpt @@ -14,7 +14,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -... 3 / 3 (100%) +... 3 Time: %s, Memory: %s diff --git a/tests/TextUI/filter-dataprovider-by-range.phpt b/tests/TextUI/filter-dataprovider-by-range.phpt index b028a669636..6e1ce230372 100644 --- a/tests/TextUI/filter-dataprovider-by-range.phpt +++ b/tests/TextUI/filter-dataprovider-by-range.phpt @@ -13,7 +13,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -... 3 / 3 (100%) +... 3 Time: %s, Memory: %s diff --git a/tests/TextUI/filter-dataprovider-by-regexp-isolation.phpt b/tests/TextUI/filter-dataprovider-by-regexp-isolation.phpt index 18b933c07b2..6c5652884d7 100644 --- a/tests/TextUI/filter-dataprovider-by-regexp-isolation.phpt +++ b/tests/TextUI/filter-dataprovider-by-regexp-isolation.phpt @@ -14,7 +14,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -.. 2 / 2 (100%) +.. 2 Time: %s, Memory: %s diff --git a/tests/TextUI/filter-dataprovider-by-regexp.phpt b/tests/TextUI/filter-dataprovider-by-regexp.phpt index 006a4600459..b9828cffe9e 100644 --- a/tests/TextUI/filter-dataprovider-by-regexp.phpt +++ b/tests/TextUI/filter-dataprovider-by-regexp.phpt @@ -13,7 +13,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -.. 2 / 2 (100%) +.. 2 Time: %s, Memory: %s diff --git a/tests/TextUI/filter-dataprovider-by-string-isolation.phpt b/tests/TextUI/filter-dataprovider-by-string-isolation.phpt index e88a17db679..4696f730687 100644 --- a/tests/TextUI/filter-dataprovider-by-string-isolation.phpt +++ b/tests/TextUI/filter-dataprovider-by-string-isolation.phpt @@ -14,7 +14,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -. 1 / 1 (100%) +. 1 Time: %s, Memory: %s diff --git a/tests/TextUI/filter-dataprovider-by-string.phpt b/tests/TextUI/filter-dataprovider-by-string.phpt index 6dc88ddb625..47ca701886a 100644 --- a/tests/TextUI/filter-dataprovider-by-string.phpt +++ b/tests/TextUI/filter-dataprovider-by-string.phpt @@ -13,7 +13,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -. 1 / 1 (100%) +. 1 Time: %s, Memory: %s diff --git a/tests/TextUI/filter-method-case-insensitive.phpt b/tests/TextUI/filter-method-case-insensitive.phpt index a2151f7c7a1..37e9273da9d 100644 --- a/tests/TextUI/filter-method-case-insensitive.phpt +++ b/tests/TextUI/filter-method-case-insensitive.phpt @@ -13,7 +13,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -. 1 / 1 (100%) +. 1 Time: %s, Memory: %s diff --git a/tests/TextUI/filter-method-isolation.phpt b/tests/TextUI/filter-method-isolation.phpt index 542dff443ab..042bdd09f99 100644 --- a/tests/TextUI/filter-method-isolation.phpt +++ b/tests/TextUI/filter-method-isolation.phpt @@ -14,7 +14,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -. 1 / 1 (100%) +. 1 Time: %s, Memory: %s diff --git a/tests/TextUI/filter-method.phpt b/tests/TextUI/filter-method.phpt index d63101e905e..e7180a00047 100644 --- a/tests/TextUI/filter-method.phpt +++ b/tests/TextUI/filter-method.phpt @@ -13,7 +13,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -. 1 / 1 (100%) +. 1 Time: %s, Memory: %s diff --git a/tests/TextUI/forward-compatibility.phpt b/tests/TextUI/forward-compatibility.phpt index cf4c9d348d5..206dd5c7f6c 100644 --- a/tests/TextUI/forward-compatibility.phpt +++ b/tests/TextUI/forward-compatibility.phpt @@ -11,7 +11,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -... 3 / 3 (100%) +... 3 Time: %s, Memory: %s diff --git a/tests/TextUI/group-isolation.phpt b/tests/TextUI/group-isolation.phpt index c0ca940bb6b..b99d2112782 100644 --- a/tests/TextUI/group-isolation.phpt +++ b/tests/TextUI/group-isolation.phpt @@ -14,7 +14,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -. 1 / 1 (100%) +. 1 Time: %s, Memory: %s diff --git a/tests/TextUI/group.phpt b/tests/TextUI/group.phpt index a7f862f2879..b51058fb12d 100644 --- a/tests/TextUI/group.phpt +++ b/tests/TextUI/group.phpt @@ -13,7 +13,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -. 1 / 1 (100%) +. 1 Time: %s, Memory: %s diff --git a/tests/TextUI/ini-isolation.phpt b/tests/TextUI/ini-isolation.phpt index 284ecb20401..17add9fc969 100644 --- a/tests/TextUI/ini-isolation.phpt +++ b/tests/TextUI/ini-isolation.phpt @@ -14,7 +14,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -. 1 / 1 (100%) +. 1 Time: %s, Memory: %s diff --git a/tests/TextUI/log-junit.phpt b/tests/TextUI/log-junit.phpt index c37191ed684..048ae5885ff 100644 --- a/tests/TextUI/log-junit.phpt +++ b/tests/TextUI/log-junit.phpt @@ -14,7 +14,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -.FEISRW 7 / 7 (100%) +.FEISRW 7 diff --git a/tests/TextUI/log-teamcity.phpt b/tests/TextUI/log-teamcity.phpt index db919a8843e..9534397d4d7 100644 --- a/tests/TextUI/log-teamcity.phpt +++ b/tests/TextUI/log-teamcity.phpt @@ -27,7 +27,7 @@ PHPUnit %s by Sebastian Bergmann and contributors. ##teamcity[testFinished name='testBalanceCannotBecomeNegative' duration='%s' flowId='%d'] ##teamcity[testStarted name='testBalanceCannotBecomeNegative2' locationHint='php_qn://%s%etests%e_files%eBankAccountTest.php::\BankAccountTest::testBalanceCannotBecomeNegative2' flowId='%d'] -. 3 / 3 (100%) +. 3 ##teamcity[testFinished name='testBalanceCannotBecomeNegative2' duration='%s' flowId='%d'] ##teamcity[testSuiteFinished name='BankAccountTest' flowId='%d'] diff --git a/tests/TextUI/mycommand.phpt b/tests/TextUI/mycommand.phpt index fc63788a3f7..a744283817f 100644 --- a/tests/TextUI/mycommand.phpt +++ b/tests/TextUI/mycommand.phpt @@ -17,7 +17,7 @@ MyCommand::main(); MyCommand::myHandler 123 PHPUnit %s by Sebastian Bergmann and contributors. -... 3 / 3 (100%) +... 3 Time: %s, Memory: %s diff --git a/tests/TextUI/options-after-arguments.phpt b/tests/TextUI/options-after-arguments.phpt index dabd8e42ed0..5fa39b89abf 100644 --- a/tests/TextUI/options-after-arguments.phpt +++ b/tests/TextUI/options-after-arguments.phpt @@ -11,7 +11,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -... 3 / 3 (100%) +... 3 Time: %s, Memory: %s diff --git a/tests/TextUI/output-isolation.phpt b/tests/TextUI/output-isolation.phpt index 15a87db05b2..51fe8acf09c 100644 --- a/tests/TextUI/output-isolation.phpt +++ b/tests/TextUI/output-isolation.phpt @@ -13,7 +13,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -. 1 / 1 (100%) +. 1 Time: %s, Memory: %s diff --git a/tests/TextUI/phar-extension.phpt b/tests/TextUI/phar-extension.phpt index b222c823522..2ac661c5bd2 100644 --- a/tests/TextUI/phar-extension.phpt +++ b/tests/TextUI/phar-extension.phpt @@ -14,7 +14,7 @@ Runtime: %s Configuration: %s%ephpunit-example-extension%ephpunit.xml Extension: phpunit/phpunit-example-extension 3.0.3 -. 1 / 1 (100%) +. 1 Time: %s, Memory: %s diff --git a/tests/TextUI/phpt-xfail.phpt b/tests/TextUI/phpt-xfail.phpt index 6b3e49f52bc..510c56d74dd 100644 --- a/tests/TextUI/phpt-xfail.phpt +++ b/tests/TextUI/phpt-xfail.phpt @@ -10,7 +10,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -I 1 / 1 (100%) +I 1 Time: %s, Memory: %s diff --git a/tests/TextUI/repeat.phpt b/tests/TextUI/repeat.phpt index ae7eb3f5ae3..bfce26ec273 100644 --- a/tests/TextUI/repeat.phpt +++ b/tests/TextUI/repeat.phpt @@ -13,7 +13,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -......... 9 / 9 (100%) +......... 9 Time: %s, Memory: %s diff --git a/tests/TextUI/report-tests-performing-assertions-when-annotated-with-does-not-perform-assertions.phpt b/tests/TextUI/report-tests-performing-assertions-when-annotated-with-does-not-perform-assertions.phpt index 1cafbde68d4..9b443004d00 100644 --- a/tests/TextUI/report-tests-performing-assertions-when-annotated-with-does-not-perform-assertions.phpt +++ b/tests/TextUI/report-tests-performing-assertions-when-annotated-with-does-not-perform-assertions.phpt @@ -11,7 +11,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -R 1 / 1 (100%) +R 1 Time: %s, Memory: %s diff --git a/tests/TextUI/report-useless-tests-incomplete.phpt b/tests/TextUI/report-useless-tests-incomplete.phpt index e00af36e123..35bcb476ccd 100644 --- a/tests/TextUI/report-useless-tests-incomplete.phpt +++ b/tests/TextUI/report-useless-tests-incomplete.phpt @@ -11,7 +11,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -I 1 / 1 (100%) +I 1 Time: %s, Memory: %s diff --git a/tests/TextUI/report-useless-tests-isolation.phpt b/tests/TextUI/report-useless-tests-isolation.phpt index 34d7195017e..08427949d3b 100644 --- a/tests/TextUI/report-useless-tests-isolation.phpt +++ b/tests/TextUI/report-useless-tests-isolation.phpt @@ -12,7 +12,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -R 1 / 1 (100%) +R 1 Time: %s, Memory: %s diff --git a/tests/TextUI/report-useless-tests.phpt b/tests/TextUI/report-useless-tests.phpt index a5c81d2fcef..b5417cbe1c5 100644 --- a/tests/TextUI/report-useless-tests.phpt +++ b/tests/TextUI/report-useless-tests.phpt @@ -11,7 +11,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -R 1 / 1 (100%) +R 1 Time: %s, Memory: %s diff --git a/tests/TextUI/test-order-randomized-with-dependency-resolution.phpt b/tests/TextUI/test-order-randomized-with-dependency-resolution.phpt index c3c02920f5b..ede3e01569a 100644 --- a/tests/TextUI/test-order-randomized-with-dependency-resolution.phpt +++ b/tests/TextUI/test-order-randomized-with-dependency-resolution.phpt @@ -18,7 +18,7 @@ PHPUnit %s by Sebastian Bergmann and contributors. Runtime: %s Random seed: %d -..... 5 / 5 (100%) +..... 5 Time: %s, Memory: %s diff --git a/tests/TextUI/test-suffix-multiple.phpt b/tests/TextUI/test-suffix-multiple.phpt index e5184196830..cdefcf1f098 100644 --- a/tests/TextUI/test-suffix-multiple.phpt +++ b/tests/TextUI/test-suffix-multiple.phpt @@ -12,7 +12,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -..... 5 / 5 (100%) +..... 5 Time: %s, Memory: %s diff --git a/tests/TextUI/test-suffix-single.phpt b/tests/TextUI/test-suffix-single.phpt index dad2c4dade3..6f175eb598c 100644 --- a/tests/TextUI/test-suffix-single.phpt +++ b/tests/TextUI/test-suffix-single.phpt @@ -12,7 +12,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -... 3 / 3 (100%) +... 3 Time: %s, Memory: %s diff --git a/tests/TextUI/testdox-exclude-group.phpt b/tests/TextUI/testdox-exclude-group.phpt index af82dfa7934..c2a9f948e56 100644 --- a/tests/TextUI/testdox-exclude-group.phpt +++ b/tests/TextUI/testdox-exclude-group.phpt @@ -16,7 +16,7 @@ PHPUnit\TextUI\Command::main(); PHPUnit %s by Sebastian Bergmann and contributors. .DoxGroup -. 2 / 2 (100%) [x] Two +. 2 [x] Two diff --git a/tests/TextUI/testdox-group.phpt b/tests/TextUI/testdox-group.phpt index 3f74d573b24..5e17ccb3337 100644 --- a/tests/TextUI/testdox-group.phpt +++ b/tests/TextUI/testdox-group.phpt @@ -16,7 +16,7 @@ PHPUnit\TextUI\Command::main(); PHPUnit %s by Sebastian Bergmann and contributors. DoxGroup -.. 2 / 2 (100%) [x] One +.. 2 [x] One diff --git a/tests/TextUI/testdox-html.phpt b/tests/TextUI/testdox-html.phpt index 8453712118b..67baeab99c8 100644 --- a/tests/TextUI/testdox-html.phpt +++ b/tests/TextUI/testdox-html.phpt @@ -45,7 +45,7 @@ PHPUnit %s by Sebastian Bergmann and contributors.

BankAccount

    -... 3 / 3 (100%)
  • ✓ Balance is initially zero
  • +... 3
  • ✓ Balance is initially zero
  • ✓ Balance cannot become negative
  • ✓ Balance cannot become negative
diff --git a/tests/TextUI/testdox-text.phpt b/tests/TextUI/testdox-text.phpt index f6bda8d1daf..b21fa069dfb 100644 --- a/tests/TextUI/testdox-text.phpt +++ b/tests/TextUI/testdox-text.phpt @@ -14,7 +14,7 @@ PHPUnit\TextUI\Command::main(); PHPUnit %s by Sebastian Bergmann and contributors. BankAccount -... 3 / 3 (100%) [x] Balance is initially zero +... 3 [x] Balance is initially zero [x] Balance cannot become negative [x] Balance cannot become negative diff --git a/tests/TextUI/testdox-xml.phpt b/tests/TextUI/testdox-xml.phpt index dcb2c7e56da..fd59fc881fc 100644 --- a/tests/TextUI/testdox-xml.phpt +++ b/tests/TextUI/testdox-xml.phpt @@ -13,7 +13,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -.FEISRW 7 / 7 (100%) +.FEISRW 7 From baeabd31fa8fd0552a82401526511cb33184b3b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20B=C3=BCttner?= Date: Sat, 14 Jul 2018 14:44:53 +0200 Subject: [PATCH 06/13] correcting last printed line checks removing trailing space from testcount output at line end --- src/TextUI/ResultPrinter.php | 2 +- tests/TextUI/abstract-test-class.phpt | 2 +- tests/TextUI/assertion.phpt | 2 +- tests/TextUI/cache-result.phpt | 2 +- tests/TextUI/code-coverage-ignore.phpt | 2 +- tests/TextUI/code-coverage-phpt.phpt | 2 +- tests/TextUI/colors-always.phpt | 2 +- tests/TextUI/concrete-test-class.phpt | 2 +- tests/TextUI/custom-printer-verbose.phpt | 2 +- tests/TextUI/dataprovider-issue-2833.phpt | 2 +- tests/TextUI/dataprovider-issue-2859.phpt | 2 +- tests/TextUI/dataprovider-issue-2922.phpt | 2 +- tests/TextUI/dataprovider-log-xml-isolation.phpt | 2 +- tests/TextUI/dataprovider-log-xml.phpt | 2 +- tests/TextUI/default-isolation.phpt | 2 +- tests/TextUI/default.phpt | 2 +- tests/TextUI/dependencies-clone.phpt | 2 +- tests/TextUI/dependencies-isolation.phpt | 2 +- tests/TextUI/dependencies.phpt | 2 +- tests/TextUI/dependencies2-isolation.phpt | 2 +- tests/TextUI/dependencies2.phpt | 2 +- tests/TextUI/dependencies3-isolation.phpt | 2 +- tests/TextUI/dependencies3.phpt | 2 +- tests/TextUI/disable-code-coverage-ignore.phpt | 2 +- tests/TextUI/empty-testcase.phpt | 2 +- tests/TextUI/exception-stack.phpt | 2 +- tests/TextUI/exclude-group-isolation.phpt | 2 +- tests/TextUI/exclude-group.phpt | 2 +- tests/TextUI/failure-isolation.phpt | 2 +- tests/TextUI/failure-reverse-list.phpt | 2 +- tests/TextUI/failure.phpt | 2 +- tests/TextUI/fatal-isolation.phpt | 2 +- tests/TextUI/filter-class-isolation.phpt | 2 +- tests/TextUI/filter-class.phpt | 2 +- .../filter-dataprovider-by-classname-and-range-isolation.phpt | 2 +- tests/TextUI/filter-dataprovider-by-classname-and-range.phpt | 2 +- tests/TextUI/filter-dataprovider-by-number-isolation.phpt | 2 +- tests/TextUI/filter-dataprovider-by-number.phpt | 2 +- tests/TextUI/filter-dataprovider-by-only-range-isolation.phpt | 2 +- tests/TextUI/filter-dataprovider-by-only-range.phpt | 2 +- tests/TextUI/filter-dataprovider-by-only-regexp-isolation.phpt | 2 +- tests/TextUI/filter-dataprovider-by-only-regexp.phpt | 2 +- tests/TextUI/filter-dataprovider-by-only-string-isolation.phpt | 2 +- tests/TextUI/filter-dataprovider-by-only-string.phpt | 2 +- tests/TextUI/filter-dataprovider-by-range-isolation.phpt | 2 +- tests/TextUI/filter-dataprovider-by-range.phpt | 2 +- tests/TextUI/filter-dataprovider-by-regexp-isolation.phpt | 2 +- tests/TextUI/filter-dataprovider-by-regexp.phpt | 2 +- tests/TextUI/filter-dataprovider-by-string-isolation.phpt | 2 +- tests/TextUI/filter-dataprovider-by-string.phpt | 2 +- tests/TextUI/filter-method-case-insensitive.phpt | 2 +- tests/TextUI/filter-method-isolation.phpt | 2 +- tests/TextUI/filter-method.phpt | 2 +- tests/TextUI/forward-compatibility.phpt | 2 +- tests/TextUI/group-isolation.phpt | 2 +- tests/TextUI/group.phpt | 2 +- tests/TextUI/ini-isolation.phpt | 2 +- tests/TextUI/log-junit.phpt | 2 +- tests/TextUI/mycommand.phpt | 2 +- tests/TextUI/options-after-arguments.phpt | 2 +- tests/TextUI/output-isolation.phpt | 2 +- tests/TextUI/phar-extension.phpt | 2 +- tests/TextUI/phpt-xfail.phpt | 2 +- tests/TextUI/repeat.phpt | 2 +- ...ertions-when-annotated-with-does-not-perform-assertions.phpt | 2 +- tests/TextUI/report-useless-tests-incomplete.phpt | 2 +- tests/TextUI/report-useless-tests-isolation.phpt | 2 +- tests/TextUI/report-useless-tests.phpt | 2 +- .../test-order-randomized-with-dependency-resolution.phpt | 2 +- tests/TextUI/test-suffix-multiple.phpt | 2 +- tests/TextUI/test-suffix-single.phpt | 2 +- tests/TextUI/testdox-exclude-group.phpt | 2 +- tests/TextUI/testdox-group.phpt | 2 +- tests/TextUI/testdox-html.phpt | 2 +- tests/TextUI/testdox-text.phpt | 2 +- tests/TextUI/testdox-xml.phpt | 2 +- 76 files changed, 76 insertions(+), 76 deletions(-) diff --git a/src/TextUI/ResultPrinter.php b/src/TextUI/ResultPrinter.php index de17725eaeb..c071db187e5 100644 --- a/src/TextUI/ResultPrinter.php +++ b/src/TextUI/ResultPrinter.php @@ -500,7 +500,7 @@ protected function writeProgress(string $progress): void $this->write( \sprintf( - ' %' . $this->numTestsWidth . 'd ', + ' %' . $this->numTestsWidth . 'd', $this->numTestsRun ) ); diff --git a/tests/TextUI/abstract-test-class.phpt b/tests/TextUI/abstract-test-class.phpt index 1128c6b87c1..771bedc0bec 100644 --- a/tests/TextUI/abstract-test-class.phpt +++ b/tests/TextUI/abstract-test-class.phpt @@ -11,7 +11,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -W 1 +W Time: %s, Memory: %s diff --git a/tests/TextUI/assertion.phpt b/tests/TextUI/assertion.phpt index 95bb4ef323d..446063de25c 100644 --- a/tests/TextUI/assertion.phpt +++ b/tests/TextUI/assertion.phpt @@ -25,7 +25,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -F 1 +F Time: %s, Memory: %s diff --git a/tests/TextUI/cache-result.phpt b/tests/TextUI/cache-result.phpt index d38bf111507..7bb06456ff8 100644 --- a/tests/TextUI/cache-result.phpt +++ b/tests/TextUI/cache-result.phpt @@ -20,7 +20,7 @@ unlink($target); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -.SS.. 5 +.SS.. Time: %s, Memory: %s diff --git a/tests/TextUI/code-coverage-ignore.phpt b/tests/TextUI/code-coverage-ignore.phpt index 4d316dd5689..59a50b84e6a 100644 --- a/tests/TextUI/code-coverage-ignore.phpt +++ b/tests/TextUI/code-coverage-ignore.phpt @@ -20,7 +20,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -.. 2 +.. Time: %s, Memory: %s diff --git a/tests/TextUI/code-coverage-phpt.phpt b/tests/TextUI/code-coverage-phpt.phpt index 1c6f7741d65..57df99ee776 100644 --- a/tests/TextUI/code-coverage-phpt.phpt +++ b/tests/TextUI/code-coverage-phpt.phpt @@ -22,7 +22,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -. 1 +. Time: %s, Memory: %s diff --git a/tests/TextUI/colors-always.phpt b/tests/TextUI/colors-always.phpt index 254bf1955cc..eee5872c486 100644 --- a/tests/TextUI/colors-always.phpt +++ b/tests/TextUI/colors-always.phpt @@ -11,7 +11,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -... 3 +... Time: %s, Memory: %s diff --git a/tests/TextUI/concrete-test-class.phpt b/tests/TextUI/concrete-test-class.phpt index 387393d3a13..90fc45d1a45 100644 --- a/tests/TextUI/concrete-test-class.phpt +++ b/tests/TextUI/concrete-test-class.phpt @@ -11,7 +11,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -.. 2 +.. Time: %s, Memory: %s diff --git a/tests/TextUI/custom-printer-verbose.phpt b/tests/TextUI/custom-printer-verbose.phpt index 5aeac86cad8..3616ae6d825 100644 --- a/tests/TextUI/custom-printer-verbose.phpt +++ b/tests/TextUI/custom-printer-verbose.phpt @@ -16,7 +16,7 @@ PHPUnit %s by Sebastian Bergmann and contributors. Runtime: %s Configuration: %sconfiguration.custom-printer.xml -I 1 +I Time: %s, Memory: %s diff --git a/tests/TextUI/dataprovider-issue-2833.phpt b/tests/TextUI/dataprovider-issue-2833.phpt index e5514c7582b..86f8d4afbf6 100644 --- a/tests/TextUI/dataprovider-issue-2833.phpt +++ b/tests/TextUI/dataprovider-issue-2833.phpt @@ -10,7 +10,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -.. 2 +.. Time: %s, Memory: %s diff --git a/tests/TextUI/dataprovider-issue-2859.phpt b/tests/TextUI/dataprovider-issue-2859.phpt index 12bb59e089f..79880afbe5d 100644 --- a/tests/TextUI/dataprovider-issue-2859.phpt +++ b/tests/TextUI/dataprovider-issue-2859.phpt @@ -10,7 +10,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -. 1 +. Time: %s, Memory: %s diff --git a/tests/TextUI/dataprovider-issue-2922.phpt b/tests/TextUI/dataprovider-issue-2922.phpt index 2f674ae7b86..5674d151a26 100644 --- a/tests/TextUI/dataprovider-issue-2922.phpt +++ b/tests/TextUI/dataprovider-issue-2922.phpt @@ -11,7 +11,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -. 1 +. Time: %s, Memory: %s diff --git a/tests/TextUI/dataprovider-log-xml-isolation.phpt b/tests/TextUI/dataprovider-log-xml-isolation.phpt index 0bf741eefd0..56cf537fc0c 100644 --- a/tests/TextUI/dataprovider-log-xml-isolation.phpt +++ b/tests/TextUI/dataprovider-log-xml-isolation.phpt @@ -14,7 +14,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -..F. 4 +..F. diff --git a/tests/TextUI/dataprovider-log-xml.phpt b/tests/TextUI/dataprovider-log-xml.phpt index 426acae54dd..87c776f9220 100644 --- a/tests/TextUI/dataprovider-log-xml.phpt +++ b/tests/TextUI/dataprovider-log-xml.phpt @@ -13,7 +13,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -..F. 4 +..F. diff --git a/tests/TextUI/default-isolation.phpt b/tests/TextUI/default-isolation.phpt index c16ff37d41e..f86cea8d3c8 100644 --- a/tests/TextUI/default-isolation.phpt +++ b/tests/TextUI/default-isolation.phpt @@ -12,7 +12,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -... 3 +... Time: %s, Memory: %s diff --git a/tests/TextUI/default.phpt b/tests/TextUI/default.phpt index 206dd5c7f6c..cea266c0056 100644 --- a/tests/TextUI/default.phpt +++ b/tests/TextUI/default.phpt @@ -11,7 +11,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -... 3 +... Time: %s, Memory: %s diff --git a/tests/TextUI/dependencies-clone.phpt b/tests/TextUI/dependencies-clone.phpt index f2d5916e979..0f6470e5dde 100644 --- a/tests/TextUI/dependencies-clone.phpt +++ b/tests/TextUI/dependencies-clone.phpt @@ -14,7 +14,7 @@ PHPUnit %s by Sebastian Bergmann and contributors. Runtime: %s -...... 6 +...... Time: %s, Memory: %s diff --git a/tests/TextUI/dependencies-isolation.phpt b/tests/TextUI/dependencies-isolation.phpt index c2ccd20436e..365b588426b 100644 --- a/tests/TextUI/dependencies-isolation.phpt +++ b/tests/TextUI/dependencies-isolation.phpt @@ -15,7 +15,7 @@ PHPUnit %s by Sebastian Bergmann and contributors. Runtime: %s -...FSSS 7 +...FSSS Time: %s, Memory: %s diff --git a/tests/TextUI/dependencies.phpt b/tests/TextUI/dependencies.phpt index d447f650461..63399ba1b41 100644 --- a/tests/TextUI/dependencies.phpt +++ b/tests/TextUI/dependencies.phpt @@ -14,7 +14,7 @@ PHPUnit %s by Sebastian Bergmann and contributors. Runtime: %s -...FSSS 7 +...FSSS Time: %s, Memory: %s diff --git a/tests/TextUI/dependencies2-isolation.phpt b/tests/TextUI/dependencies2-isolation.phpt index 18cce6564c8..b3d015fa85d 100644 --- a/tests/TextUI/dependencies2-isolation.phpt +++ b/tests/TextUI/dependencies2-isolation.phpt @@ -12,7 +12,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -.. 2 +.. Time: %s, Memory: %s diff --git a/tests/TextUI/dependencies2.phpt b/tests/TextUI/dependencies2.phpt index 9e71ab0e56a..caf91e75a93 100644 --- a/tests/TextUI/dependencies2.phpt +++ b/tests/TextUI/dependencies2.phpt @@ -11,7 +11,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -.. 2 +.. Time: %s, Memory: %s diff --git a/tests/TextUI/dependencies3-isolation.phpt b/tests/TextUI/dependencies3-isolation.phpt index 7b4c2ac2ebd..4b82e5d84d2 100644 --- a/tests/TextUI/dependencies3-isolation.phpt +++ b/tests/TextUI/dependencies3-isolation.phpt @@ -12,7 +12,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -..... 5 +..... Time: %s, Memory: %s diff --git a/tests/TextUI/dependencies3.phpt b/tests/TextUI/dependencies3.phpt index ef2a5371cc5..f847485c372 100644 --- a/tests/TextUI/dependencies3.phpt +++ b/tests/TextUI/dependencies3.phpt @@ -12,7 +12,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -..... 5 +..... Time: %s, Memory: %s diff --git a/tests/TextUI/disable-code-coverage-ignore.phpt b/tests/TextUI/disable-code-coverage-ignore.phpt index 71b5bcdd3a1..ba956aade55 100644 --- a/tests/TextUI/disable-code-coverage-ignore.phpt +++ b/tests/TextUI/disable-code-coverage-ignore.phpt @@ -21,7 +21,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -.. 2 +.. Time: %s, Memory: %s diff --git a/tests/TextUI/empty-testcase.phpt b/tests/TextUI/empty-testcase.phpt index baa2e0be4ad..b52f0d25136 100644 --- a/tests/TextUI/empty-testcase.phpt +++ b/tests/TextUI/empty-testcase.phpt @@ -12,7 +12,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -W 1 +W Time: %s, Memory: %s diff --git a/tests/TextUI/exception-stack.phpt b/tests/TextUI/exception-stack.phpt index 984c36f3f28..12de8916c43 100644 --- a/tests/TextUI/exception-stack.phpt +++ b/tests/TextUI/exception-stack.phpt @@ -11,7 +11,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -EE 2 +EE Time: %s, Memory: %s diff --git a/tests/TextUI/exclude-group-isolation.phpt b/tests/TextUI/exclude-group-isolation.phpt index 4e396aa9502..51355669a27 100644 --- a/tests/TextUI/exclude-group-isolation.phpt +++ b/tests/TextUI/exclude-group-isolation.phpt @@ -14,7 +14,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -.. 2 +.. Time: %s, Memory: %s diff --git a/tests/TextUI/exclude-group.phpt b/tests/TextUI/exclude-group.phpt index fefe972d74b..47ee2902d78 100644 --- a/tests/TextUI/exclude-group.phpt +++ b/tests/TextUI/exclude-group.phpt @@ -13,7 +13,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -.. 2 +.. Time: %s, Memory: %s diff --git a/tests/TextUI/failure-isolation.phpt b/tests/TextUI/failure-isolation.phpt index 08d0f408cdb..4c5e63efda4 100644 --- a/tests/TextUI/failure-isolation.phpt +++ b/tests/TextUI/failure-isolation.phpt @@ -12,7 +12,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -FFFFFFFFFFFFF 13 +FFFFFFFFFFFFF Time: %s, Memory: %s diff --git a/tests/TextUI/failure-reverse-list.phpt b/tests/TextUI/failure-reverse-list.phpt index 1b011efd1f0..530503fcf22 100644 --- a/tests/TextUI/failure-reverse-list.phpt +++ b/tests/TextUI/failure-reverse-list.phpt @@ -12,7 +12,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -FFFFFFFFFFFFF 13 +FFFFFFFFFFFFF Time: %s, Memory: %s diff --git a/tests/TextUI/failure.phpt b/tests/TextUI/failure.phpt index 679cd5cb43d..650aae6c8e7 100644 --- a/tests/TextUI/failure.phpt +++ b/tests/TextUI/failure.phpt @@ -11,7 +11,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -FFFFFFFFFFFFF 13 +FFFFFFFFFFFFF Time: %s, Memory: %s diff --git a/tests/TextUI/fatal-isolation.phpt b/tests/TextUI/fatal-isolation.phpt index b8e0f0d51de..06193dffddd 100644 --- a/tests/TextUI/fatal-isolation.phpt +++ b/tests/TextUI/fatal-isolation.phpt @@ -12,7 +12,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -E 1 +E Time: %s, Memory: %s diff --git a/tests/TextUI/filter-class-isolation.phpt b/tests/TextUI/filter-class-isolation.phpt index 655ee462f67..10cbb80878d 100644 --- a/tests/TextUI/filter-class-isolation.phpt +++ b/tests/TextUI/filter-class-isolation.phpt @@ -14,7 +14,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -... 3 +... Time: %s, Memory: %s diff --git a/tests/TextUI/filter-class.phpt b/tests/TextUI/filter-class.phpt index 58393a9153d..4477344aa11 100644 --- a/tests/TextUI/filter-class.phpt +++ b/tests/TextUI/filter-class.phpt @@ -13,7 +13,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -... 3 +... Time: %s, Memory: %s diff --git a/tests/TextUI/filter-dataprovider-by-classname-and-range-isolation.phpt b/tests/TextUI/filter-dataprovider-by-classname-and-range-isolation.phpt index 1b4692c5b00..79238a86c1e 100644 --- a/tests/TextUI/filter-dataprovider-by-classname-and-range-isolation.phpt +++ b/tests/TextUI/filter-dataprovider-by-classname-and-range-isolation.phpt @@ -14,7 +14,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -... 3 +... Time: %s, Memory: %s diff --git a/tests/TextUI/filter-dataprovider-by-classname-and-range.phpt b/tests/TextUI/filter-dataprovider-by-classname-and-range.phpt index a3ec2a6bae2..bf2349c5a08 100644 --- a/tests/TextUI/filter-dataprovider-by-classname-and-range.phpt +++ b/tests/TextUI/filter-dataprovider-by-classname-and-range.phpt @@ -13,7 +13,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -... 3 +... Time: %s, Memory: %s diff --git a/tests/TextUI/filter-dataprovider-by-number-isolation.phpt b/tests/TextUI/filter-dataprovider-by-number-isolation.phpt index 0167a04411c..761b594dcc1 100644 --- a/tests/TextUI/filter-dataprovider-by-number-isolation.phpt +++ b/tests/TextUI/filter-dataprovider-by-number-isolation.phpt @@ -14,7 +14,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -. 1 +. Time: %s, Memory: %s diff --git a/tests/TextUI/filter-dataprovider-by-number.phpt b/tests/TextUI/filter-dataprovider-by-number.phpt index f0a52f4921d..f6e4a8affe5 100644 --- a/tests/TextUI/filter-dataprovider-by-number.phpt +++ b/tests/TextUI/filter-dataprovider-by-number.phpt @@ -13,7 +13,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -. 1 +. Time: %s, Memory: %s diff --git a/tests/TextUI/filter-dataprovider-by-only-range-isolation.phpt b/tests/TextUI/filter-dataprovider-by-only-range-isolation.phpt index e5f30326120..9cecc6c07a8 100644 --- a/tests/TextUI/filter-dataprovider-by-only-range-isolation.phpt +++ b/tests/TextUI/filter-dataprovider-by-only-range-isolation.phpt @@ -14,7 +14,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -... 3 +... Time: %s, Memory: %s diff --git a/tests/TextUI/filter-dataprovider-by-only-range.phpt b/tests/TextUI/filter-dataprovider-by-only-range.phpt index ef0a56acde1..9408fa5fe31 100644 --- a/tests/TextUI/filter-dataprovider-by-only-range.phpt +++ b/tests/TextUI/filter-dataprovider-by-only-range.phpt @@ -13,7 +13,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -... 3 +... Time: %s, Memory: %s diff --git a/tests/TextUI/filter-dataprovider-by-only-regexp-isolation.phpt b/tests/TextUI/filter-dataprovider-by-only-regexp-isolation.phpt index fe2b61c746c..e8658e93587 100644 --- a/tests/TextUI/filter-dataprovider-by-only-regexp-isolation.phpt +++ b/tests/TextUI/filter-dataprovider-by-only-regexp-isolation.phpt @@ -14,7 +14,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -.. 2 +.. Time: %s, Memory: %s diff --git a/tests/TextUI/filter-dataprovider-by-only-regexp.phpt b/tests/TextUI/filter-dataprovider-by-only-regexp.phpt index a258cd98131..9f3b1428931 100644 --- a/tests/TextUI/filter-dataprovider-by-only-regexp.phpt +++ b/tests/TextUI/filter-dataprovider-by-only-regexp.phpt @@ -13,7 +13,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -.. 2 +.. Time: %s, Memory: %s diff --git a/tests/TextUI/filter-dataprovider-by-only-string-isolation.phpt b/tests/TextUI/filter-dataprovider-by-only-string-isolation.phpt index e39a2401a40..bef75ccefc8 100644 --- a/tests/TextUI/filter-dataprovider-by-only-string-isolation.phpt +++ b/tests/TextUI/filter-dataprovider-by-only-string-isolation.phpt @@ -14,7 +14,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -. 1 +. Time: %s, Memory: %s diff --git a/tests/TextUI/filter-dataprovider-by-only-string.phpt b/tests/TextUI/filter-dataprovider-by-only-string.phpt index 79cb96846cd..cfc52221dad 100644 --- a/tests/TextUI/filter-dataprovider-by-only-string.phpt +++ b/tests/TextUI/filter-dataprovider-by-only-string.phpt @@ -13,7 +13,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -. 1 +. Time: %s, Memory: %s diff --git a/tests/TextUI/filter-dataprovider-by-range-isolation.phpt b/tests/TextUI/filter-dataprovider-by-range-isolation.phpt index 9b01a856a55..d7ff9904494 100644 --- a/tests/TextUI/filter-dataprovider-by-range-isolation.phpt +++ b/tests/TextUI/filter-dataprovider-by-range-isolation.phpt @@ -14,7 +14,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -... 3 +... Time: %s, Memory: %s diff --git a/tests/TextUI/filter-dataprovider-by-range.phpt b/tests/TextUI/filter-dataprovider-by-range.phpt index 6e1ce230372..767c3566971 100644 --- a/tests/TextUI/filter-dataprovider-by-range.phpt +++ b/tests/TextUI/filter-dataprovider-by-range.phpt @@ -13,7 +13,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -... 3 +... Time: %s, Memory: %s diff --git a/tests/TextUI/filter-dataprovider-by-regexp-isolation.phpt b/tests/TextUI/filter-dataprovider-by-regexp-isolation.phpt index 6c5652884d7..c85ca9e2edf 100644 --- a/tests/TextUI/filter-dataprovider-by-regexp-isolation.phpt +++ b/tests/TextUI/filter-dataprovider-by-regexp-isolation.phpt @@ -14,7 +14,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -.. 2 +.. Time: %s, Memory: %s diff --git a/tests/TextUI/filter-dataprovider-by-regexp.phpt b/tests/TextUI/filter-dataprovider-by-regexp.phpt index b9828cffe9e..75e0c121c13 100644 --- a/tests/TextUI/filter-dataprovider-by-regexp.phpt +++ b/tests/TextUI/filter-dataprovider-by-regexp.phpt @@ -13,7 +13,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -.. 2 +.. Time: %s, Memory: %s diff --git a/tests/TextUI/filter-dataprovider-by-string-isolation.phpt b/tests/TextUI/filter-dataprovider-by-string-isolation.phpt index 4696f730687..0da1773d02b 100644 --- a/tests/TextUI/filter-dataprovider-by-string-isolation.phpt +++ b/tests/TextUI/filter-dataprovider-by-string-isolation.phpt @@ -14,7 +14,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -. 1 +. Time: %s, Memory: %s diff --git a/tests/TextUI/filter-dataprovider-by-string.phpt b/tests/TextUI/filter-dataprovider-by-string.phpt index 47ca701886a..b69b29ef064 100644 --- a/tests/TextUI/filter-dataprovider-by-string.phpt +++ b/tests/TextUI/filter-dataprovider-by-string.phpt @@ -13,7 +13,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -. 1 +. Time: %s, Memory: %s diff --git a/tests/TextUI/filter-method-case-insensitive.phpt b/tests/TextUI/filter-method-case-insensitive.phpt index 37e9273da9d..c11af677e33 100644 --- a/tests/TextUI/filter-method-case-insensitive.phpt +++ b/tests/TextUI/filter-method-case-insensitive.phpt @@ -13,7 +13,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -. 1 +. Time: %s, Memory: %s diff --git a/tests/TextUI/filter-method-isolation.phpt b/tests/TextUI/filter-method-isolation.phpt index 042bdd09f99..f9e962d95f0 100644 --- a/tests/TextUI/filter-method-isolation.phpt +++ b/tests/TextUI/filter-method-isolation.phpt @@ -14,7 +14,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -. 1 +. Time: %s, Memory: %s diff --git a/tests/TextUI/filter-method.phpt b/tests/TextUI/filter-method.phpt index e7180a00047..a7eb87fbc29 100644 --- a/tests/TextUI/filter-method.phpt +++ b/tests/TextUI/filter-method.phpt @@ -13,7 +13,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -. 1 +. Time: %s, Memory: %s diff --git a/tests/TextUI/forward-compatibility.phpt b/tests/TextUI/forward-compatibility.phpt index 206dd5c7f6c..cea266c0056 100644 --- a/tests/TextUI/forward-compatibility.phpt +++ b/tests/TextUI/forward-compatibility.phpt @@ -11,7 +11,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -... 3 +... Time: %s, Memory: %s diff --git a/tests/TextUI/group-isolation.phpt b/tests/TextUI/group-isolation.phpt index b99d2112782..126b40bc9f0 100644 --- a/tests/TextUI/group-isolation.phpt +++ b/tests/TextUI/group-isolation.phpt @@ -14,7 +14,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -. 1 +. Time: %s, Memory: %s diff --git a/tests/TextUI/group.phpt b/tests/TextUI/group.phpt index b51058fb12d..6ec7644aea9 100644 --- a/tests/TextUI/group.phpt +++ b/tests/TextUI/group.phpt @@ -13,7 +13,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -. 1 +. Time: %s, Memory: %s diff --git a/tests/TextUI/ini-isolation.phpt b/tests/TextUI/ini-isolation.phpt index 17add9fc969..891cc2adccc 100644 --- a/tests/TextUI/ini-isolation.phpt +++ b/tests/TextUI/ini-isolation.phpt @@ -14,7 +14,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -. 1 +. Time: %s, Memory: %s diff --git a/tests/TextUI/log-junit.phpt b/tests/TextUI/log-junit.phpt index 048ae5885ff..b1bced2d1d9 100644 --- a/tests/TextUI/log-junit.phpt +++ b/tests/TextUI/log-junit.phpt @@ -14,7 +14,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -.FEISRW 7 +.FEISRW diff --git a/tests/TextUI/mycommand.phpt b/tests/TextUI/mycommand.phpt index a744283817f..61c5a4c8df3 100644 --- a/tests/TextUI/mycommand.phpt +++ b/tests/TextUI/mycommand.phpt @@ -17,7 +17,7 @@ MyCommand::main(); MyCommand::myHandler 123 PHPUnit %s by Sebastian Bergmann and contributors. -... 3 +... Time: %s, Memory: %s diff --git a/tests/TextUI/options-after-arguments.phpt b/tests/TextUI/options-after-arguments.phpt index 5fa39b89abf..11f9c39fee0 100644 --- a/tests/TextUI/options-after-arguments.phpt +++ b/tests/TextUI/options-after-arguments.phpt @@ -11,7 +11,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -... 3 +... Time: %s, Memory: %s diff --git a/tests/TextUI/output-isolation.phpt b/tests/TextUI/output-isolation.phpt index 51fe8acf09c..e81af64634e 100644 --- a/tests/TextUI/output-isolation.phpt +++ b/tests/TextUI/output-isolation.phpt @@ -13,7 +13,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -. 1 +. Time: %s, Memory: %s diff --git a/tests/TextUI/phar-extension.phpt b/tests/TextUI/phar-extension.phpt index 2ac661c5bd2..8cdc87d3357 100644 --- a/tests/TextUI/phar-extension.phpt +++ b/tests/TextUI/phar-extension.phpt @@ -14,7 +14,7 @@ Runtime: %s Configuration: %s%ephpunit-example-extension%ephpunit.xml Extension: phpunit/phpunit-example-extension 3.0.3 -. 1 +. Time: %s, Memory: %s diff --git a/tests/TextUI/phpt-xfail.phpt b/tests/TextUI/phpt-xfail.phpt index 510c56d74dd..cd6aeb1c839 100644 --- a/tests/TextUI/phpt-xfail.phpt +++ b/tests/TextUI/phpt-xfail.phpt @@ -10,7 +10,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -I 1 +I Time: %s, Memory: %s diff --git a/tests/TextUI/repeat.phpt b/tests/TextUI/repeat.phpt index bfce26ec273..14f9c00e315 100644 --- a/tests/TextUI/repeat.phpt +++ b/tests/TextUI/repeat.phpt @@ -13,7 +13,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -......... 9 +......... Time: %s, Memory: %s diff --git a/tests/TextUI/report-tests-performing-assertions-when-annotated-with-does-not-perform-assertions.phpt b/tests/TextUI/report-tests-performing-assertions-when-annotated-with-does-not-perform-assertions.phpt index 9b443004d00..6b200d64248 100644 --- a/tests/TextUI/report-tests-performing-assertions-when-annotated-with-does-not-perform-assertions.phpt +++ b/tests/TextUI/report-tests-performing-assertions-when-annotated-with-does-not-perform-assertions.phpt @@ -11,7 +11,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -R 1 +R Time: %s, Memory: %s diff --git a/tests/TextUI/report-useless-tests-incomplete.phpt b/tests/TextUI/report-useless-tests-incomplete.phpt index 35bcb476ccd..7e33a0ef891 100644 --- a/tests/TextUI/report-useless-tests-incomplete.phpt +++ b/tests/TextUI/report-useless-tests-incomplete.phpt @@ -11,7 +11,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -I 1 +I Time: %s, Memory: %s diff --git a/tests/TextUI/report-useless-tests-isolation.phpt b/tests/TextUI/report-useless-tests-isolation.phpt index 08427949d3b..c47dd6188fe 100644 --- a/tests/TextUI/report-useless-tests-isolation.phpt +++ b/tests/TextUI/report-useless-tests-isolation.phpt @@ -12,7 +12,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -R 1 +R Time: %s, Memory: %s diff --git a/tests/TextUI/report-useless-tests.phpt b/tests/TextUI/report-useless-tests.phpt index b5417cbe1c5..4eb6664d940 100644 --- a/tests/TextUI/report-useless-tests.phpt +++ b/tests/TextUI/report-useless-tests.phpt @@ -11,7 +11,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -R 1 +R Time: %s, Memory: %s diff --git a/tests/TextUI/test-order-randomized-with-dependency-resolution.phpt b/tests/TextUI/test-order-randomized-with-dependency-resolution.phpt index ede3e01569a..60719b081ec 100644 --- a/tests/TextUI/test-order-randomized-with-dependency-resolution.phpt +++ b/tests/TextUI/test-order-randomized-with-dependency-resolution.phpt @@ -18,7 +18,7 @@ PHPUnit %s by Sebastian Bergmann and contributors. Runtime: %s Random seed: %d -..... 5 +..... Time: %s, Memory: %s diff --git a/tests/TextUI/test-suffix-multiple.phpt b/tests/TextUI/test-suffix-multiple.phpt index cdefcf1f098..494cee565ac 100644 --- a/tests/TextUI/test-suffix-multiple.phpt +++ b/tests/TextUI/test-suffix-multiple.phpt @@ -12,7 +12,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -..... 5 +..... Time: %s, Memory: %s diff --git a/tests/TextUI/test-suffix-single.phpt b/tests/TextUI/test-suffix-single.phpt index 6f175eb598c..16d49bd4e8c 100644 --- a/tests/TextUI/test-suffix-single.phpt +++ b/tests/TextUI/test-suffix-single.phpt @@ -12,7 +12,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -... 3 +... Time: %s, Memory: %s diff --git a/tests/TextUI/testdox-exclude-group.phpt b/tests/TextUI/testdox-exclude-group.phpt index c2a9f948e56..3ff2d484c09 100644 --- a/tests/TextUI/testdox-exclude-group.phpt +++ b/tests/TextUI/testdox-exclude-group.phpt @@ -16,7 +16,7 @@ PHPUnit\TextUI\Command::main(); PHPUnit %s by Sebastian Bergmann and contributors. .DoxGroup -. 2 [x] Two +. [x] Two diff --git a/tests/TextUI/testdox-group.phpt b/tests/TextUI/testdox-group.phpt index 5e17ccb3337..5e1be0ad47f 100644 --- a/tests/TextUI/testdox-group.phpt +++ b/tests/TextUI/testdox-group.phpt @@ -16,7 +16,7 @@ PHPUnit\TextUI\Command::main(); PHPUnit %s by Sebastian Bergmann and contributors. DoxGroup -.. 2 [x] One +.. [x] One diff --git a/tests/TextUI/testdox-html.phpt b/tests/TextUI/testdox-html.phpt index 67baeab99c8..961c16e5bca 100644 --- a/tests/TextUI/testdox-html.phpt +++ b/tests/TextUI/testdox-html.phpt @@ -45,7 +45,7 @@ PHPUnit %s by Sebastian Bergmann and contributors.

BankAccount

    -... 3
  • ✓ Balance is initially zero
  • +...
  • ✓ Balance is initially zero
  • ✓ Balance cannot become negative
  • ✓ Balance cannot become negative
diff --git a/tests/TextUI/testdox-text.phpt b/tests/TextUI/testdox-text.phpt index b21fa069dfb..a20763dad27 100644 --- a/tests/TextUI/testdox-text.phpt +++ b/tests/TextUI/testdox-text.phpt @@ -14,7 +14,7 @@ PHPUnit\TextUI\Command::main(); PHPUnit %s by Sebastian Bergmann and contributors. BankAccount -... 3 [x] Balance is initially zero +... [x] Balance is initially zero [x] Balance cannot become negative [x] Balance cannot become negative diff --git a/tests/TextUI/testdox-xml.phpt b/tests/TextUI/testdox-xml.phpt index fd59fc881fc..dab8369e5a3 100644 --- a/tests/TextUI/testdox-xml.phpt +++ b/tests/TextUI/testdox-xml.phpt @@ -13,7 +13,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -.FEISRW 7 +.FEISRW From 68d8059c5db7cb3f5677d5847e1b7db3f80befb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20B=C3=BCttner?= Date: Sat, 14 Jul 2018 15:49:53 +0200 Subject: [PATCH 07/13] fixing testWith retrieval correctly handling numeric indices --- src/Framework/DataProvidedTestSuite.php | 12 ++++++++---- src/Framework/WithTestSuite.php | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/Framework/DataProvidedTestSuite.php b/src/Framework/DataProvidedTestSuite.php index 09e0b17feaf..a54e7a0ed8d 100644 --- a/src/Framework/DataProvidedTestSuite.php +++ b/src/Framework/DataProvidedTestSuite.php @@ -59,11 +59,13 @@ protected function yieldTests(): Generator { yield from parent::yieldTests(); try { - foreach ($this->yieldData() as $name => $set) { + foreach ($this->yieldData() as $key => $set) { + $name = is_int($key) ? "#$key" : $key; if(!is_array($set)) { - yield self::warning("set $name is invalid."); + yield self::warning("{$this->name} set $name is invalid."); continue; } + try { $test = $this->theClass->newInstanceArgs([ $this->method, @@ -73,11 +75,13 @@ protected function yieldTests(): Generator $test->setDependencies($this->dependencies); yield $test; } catch (Throwable $e) { - yield self::warning("Test creation failed. $e"); + yield self::warning("Test creation failed for {$this->name} with set $name"); } } + } catch (SkippedTestError $e) { + yield self::warning("Test for {$this->name} skipped by data provider."); } catch (Throwable $e) { - yield self::warning("data provider failed. $e"); + yield self::warning("data provider for {$this->name} failed"); } } diff --git a/src/Framework/WithTestSuite.php b/src/Framework/WithTestSuite.php index 0391c3e1151..3e5f1a2ef11 100644 --- a/src/Framework/WithTestSuite.php +++ b/src/Framework/WithTestSuite.php @@ -15,6 +15,6 @@ protected function yieldData(): iterable { return \PHPUnit\Util\Test::getDataFromTestWithAnnotation( $this->theClass->getMethod($this->method)->getDocComment() - )[0]??[]; + )??[]; } } From 21f502bd0d3708ecd2067edb29c1859b0812c2dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20B=C3=BCttner?= Date: Sat, 14 Jul 2018 16:04:38 +0200 Subject: [PATCH 08/13] skipped tests aren't warnings but incomplete tests --- src/Framework/DataProvidedTestSuite.php | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/src/Framework/DataProvidedTestSuite.php b/src/Framework/DataProvidedTestSuite.php index a54e7a0ed8d..e1b2748d17b 100644 --- a/src/Framework/DataProvidedTestSuite.php +++ b/src/Framework/DataProvidedTestSuite.php @@ -62,7 +62,11 @@ protected function yieldTests(): Generator foreach ($this->yieldData() as $key => $set) { $name = is_int($key) ? "#$key" : $key; if(!is_array($set)) { - yield self::warning("{$this->name} set $name is invalid."); + yield self::incompleteTest( + $this->name, + $this->method, + "{$this->name} set $name is invalid." + ); continue; } @@ -75,13 +79,25 @@ protected function yieldTests(): Generator $test->setDependencies($this->dependencies); yield $test; } catch (Throwable $e) { - yield self::warning("Test creation failed for {$this->name} with set $name"); + yield new TestFailureTest( + $this->name, + $this->method, + "Test creation failed for {$this->name} with set $name" + ); } } } catch (SkippedTestError $e) { - yield self::warning("Test for {$this->name} skipped by data provider."); + yield new SkippedTestCase( + $this->name, + $this->method, + "Test for {$this->name} skipped by data provider." + ); } catch (Throwable $e) { - yield self::warning("data provider for {$this->name} failed"); + yield self::incompleteTest( + $this->name, + $this->method, + "data provider for {$this->name} failed" + ); } } From d79700a8b055de8459acf53df75248d0407f7e3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20B=C3=BCttner?= Date: Sat, 14 Jul 2018 16:49:44 +0200 Subject: [PATCH 09/13] adjusting additional tests expecting a percentage at the end of lines --- src/Framework/DataProvidedTestSuite.php | 3 +-- src/Framework/TestCase.php | 22 +++++++++---------- tests/Regression/GitHub/1149.phpt | 2 +- tests/Regression/GitHub/1265.phpt | 2 +- tests/Regression/GitHub/1335.phpt | 2 +- tests/Regression/GitHub/1337.phpt | 2 +- tests/Regression/GitHub/1348.phpt | 2 +- tests/Regression/GitHub/1351.phpt | 2 +- tests/Regression/GitHub/1374.phpt | 2 +- tests/Regression/GitHub/1437.phpt | 2 +- tests/Regression/GitHub/1468.phpt | 2 +- tests/Regression/GitHub/1471.phpt | 2 +- tests/Regression/GitHub/1472.phpt | 2 +- tests/Regression/GitHub/1570.phpt | 2 +- tests/Regression/GitHub/2137-filter.phpt | 2 +- tests/Regression/GitHub/2137-no_filter.phpt | 2 +- tests/Regression/GitHub/2158.phpt | 2 +- tests/Regression/GitHub/2366.phpt | 2 +- tests/Regression/GitHub/2380.phpt | 2 +- tests/Regression/GitHub/2382.phpt | 2 +- tests/Regression/GitHub/2435.phpt | 2 +- tests/Regression/GitHub/244.phpt | 2 +- .../Regression/GitHub/2448-existing-test.phpt | 2 +- ...-separate-class-preserve-no-bootstrap.phpt | 2 +- .../GitHub/2591-separate-class-preserve.phpt | 2 +- ...nction-no-preserve-no-bootstrap-php73.phpt | 2 +- ...ction-no-preserve-no-bootstrap-xdebug.phpt | 2 +- ...ate-function-no-preserve-no-bootstrap.phpt | 2 +- .../2591-separate-function-no-preserve.phpt | 2 +- .../2591-separate-function-preserve.phpt | 2 +- .../2724-diff-pid-from-master-process.phpt | 2 +- .../2725-separate-class-before-after-pid.phpt | 2 +- tests/Regression/GitHub/2731.phpt | 2 +- tests/Regression/GitHub/2811.phpt | 2 +- tests/Regression/GitHub/2830.phpt | 2 +- tests/Regression/GitHub/2972.phpt | 2 +- .../GitHub/3093/issue-3093-test.phpt | 2 +- tests/Regression/GitHub/433.phpt | 2 +- tests/Regression/GitHub/445.phpt | 2 +- tests/Regression/GitHub/498.phpt | 2 +- tests/Regression/GitHub/503.phpt | 2 +- tests/Regression/GitHub/581.phpt | 2 +- tests/Regression/GitHub/74.phpt | 2 +- tests/Regression/GitHub/765.phpt | 2 +- tests/Regression/GitHub/797.phpt | 2 +- tests/Regression/GitHub/863.phpt | 6 ++--- tests/Regression/Trac/1021.phpt | 2 +- tests/Regression/Trac/523.phpt | 2 +- tests/Regression/Trac/578.phpt | 2 +- tests/Regression/Trac/684.phpt | 2 +- tests/Regression/Trac/783.phpt | 2 +- 51 files changed, 62 insertions(+), 65 deletions(-) diff --git a/src/Framework/DataProvidedTestSuite.php b/src/Framework/DataProvidedTestSuite.php index e1b2748d17b..cc739742931 100644 --- a/src/Framework/DataProvidedTestSuite.php +++ b/src/Framework/DataProvidedTestSuite.php @@ -59,8 +59,7 @@ protected function yieldTests(): Generator { yield from parent::yieldTests(); try { - foreach ($this->yieldData() as $key => $set) { - $name = is_int($key) ? "#$key" : $key; + foreach ($this->yieldData() as $name => $set) { if(!is_array($set)) { yield self::incompleteTest( $this->name, diff --git a/src/Framework/TestCase.php b/src/Framework/TestCase.php index 8dbdc6ef7c6..3e839c9cb53 100644 --- a/src/Framework/TestCase.php +++ b/src/Framework/TestCase.php @@ -1098,20 +1098,18 @@ public function registerComparator(Comparator $comparator): void public function getDataSetAsString(bool $includeData = true): string { - $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); - } - - $exporter = new Exporter; + return ''; + } + $buffer = ''; + 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)', $exporter->shortenedRecursiveExport($this->data)); - } + if ($includeData) { + $buffer .= \sprintf(' (%s)', (new Exporter)->shortenedRecursiveExport($this->data)); } return $buffer; diff --git a/tests/Regression/GitHub/1149.phpt b/tests/Regression/GitHub/1149.phpt index bd4b60a5d21..6de8fa626c6 100644 --- a/tests/Regression/GitHub/1149.phpt +++ b/tests/Regression/GitHub/1149.phpt @@ -13,7 +13,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -.1. 2 / 2 (100%)2 +.1.2 Time: %s, Memory: %s diff --git a/tests/Regression/GitHub/1265.phpt b/tests/Regression/GitHub/1265.phpt index ed66d8094cb..69448d54397 100644 --- a/tests/Regression/GitHub/1265.phpt +++ b/tests/Regression/GitHub/1265.phpt @@ -14,7 +14,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -. 1 / 1 (100%) +. Time: %s, Memory: %s diff --git a/tests/Regression/GitHub/1335.phpt b/tests/Regression/GitHub/1335.phpt index afb94f9bf42..453586d96bf 100644 --- a/tests/Regression/GitHub/1335.phpt +++ b/tests/Regression/GitHub/1335.phpt @@ -12,7 +12,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -............ 12 / 12 (100%) +............ Time: %s, Memory: %s diff --git a/tests/Regression/GitHub/1337.phpt b/tests/Regression/GitHub/1337.phpt index c9b1512ee89..404f2f60feb 100644 --- a/tests/Regression/GitHub/1337.phpt +++ b/tests/Regression/GitHub/1337.phpt @@ -12,7 +12,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -.. 2 / 2 (100%) +.. Time: %s, Memory: %s diff --git a/tests/Regression/GitHub/1348.phpt b/tests/Regression/GitHub/1348.phpt index f49d9da7271..ab33fe251ae 100644 --- a/tests/Regression/GitHub/1348.phpt +++ b/tests/Regression/GitHub/1348.phpt @@ -20,7 +20,7 @@ PHPUnit %s by Sebastian Bergmann and contributors. . STDOUT does not break test result -E 2 / 2 (100%) +E Time: %s, Memory: %s diff --git a/tests/Regression/GitHub/1351.phpt b/tests/Regression/GitHub/1351.phpt index 71dd26b3ab8..45e585d823a 100644 --- a/tests/Regression/GitHub/1351.phpt +++ b/tests/Regression/GitHub/1351.phpt @@ -18,7 +18,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -F.E.E 5 / 5 (100%) +F.E.E Time: %s, Memory: %s diff --git a/tests/Regression/GitHub/1374.phpt b/tests/Regression/GitHub/1374.phpt index 3f7c80e51eb..86cf12acc2c 100644 --- a/tests/Regression/GitHub/1374.phpt +++ b/tests/Regression/GitHub/1374.phpt @@ -11,7 +11,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -S 1 / 1 (100%) +S Time: %s, Memory: %s diff --git a/tests/Regression/GitHub/1437.phpt b/tests/Regression/GitHub/1437.phpt index de7077ef275..b467b4bd2b3 100644 --- a/tests/Regression/GitHub/1437.phpt +++ b/tests/Regression/GitHub/1437.phpt @@ -11,7 +11,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -F 1 / 1 (100%) +F Time: %s, Memory: %s diff --git a/tests/Regression/GitHub/1468.phpt b/tests/Regression/GitHub/1468.phpt index 73c9d73bdf9..766a4de3eb2 100644 --- a/tests/Regression/GitHub/1468.phpt +++ b/tests/Regression/GitHub/1468.phpt @@ -12,7 +12,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -I 1 / 1 (100%) +I Time: %s, Memory: %s diff --git a/tests/Regression/GitHub/1471.phpt b/tests/Regression/GitHub/1471.phpt index ee3d6752281..c880a5b40b7 100644 --- a/tests/Regression/GitHub/1471.phpt +++ b/tests/Regression/GitHub/1471.phpt @@ -11,7 +11,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -F 1 / 1 (100%) +F Time: %s, Memory: %s diff --git a/tests/Regression/GitHub/1472.phpt b/tests/Regression/GitHub/1472.phpt index a255176f115..3cd6e0719f2 100644 --- a/tests/Regression/GitHub/1472.phpt +++ b/tests/Regression/GitHub/1472.phpt @@ -11,7 +11,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -. 1 / 1 (100%) +. Time: %s, Memory: %s diff --git a/tests/Regression/GitHub/1570.phpt b/tests/Regression/GitHub/1570.phpt index 7e30de5d9ed..db5a68d276f 100644 --- a/tests/Regression/GitHub/1570.phpt +++ b/tests/Regression/GitHub/1570.phpt @@ -12,7 +12,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -R 1 / 1 (100%)* +R* Time: %s, Memory: %s diff --git a/tests/Regression/GitHub/2137-filter.phpt b/tests/Regression/GitHub/2137-filter.phpt index 7ca926523d3..19bb43d9e51 100644 --- a/tests/Regression/GitHub/2137-filter.phpt +++ b/tests/Regression/GitHub/2137-filter.phpt @@ -14,7 +14,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -W 1 / 1 (100%) +W Time: %s, Memory: %s diff --git a/tests/Regression/GitHub/2137-no_filter.phpt b/tests/Regression/GitHub/2137-no_filter.phpt index d068472ff49..754c41bff4b 100644 --- a/tests/Regression/GitHub/2137-no_filter.phpt +++ b/tests/Regression/GitHub/2137-no_filter.phpt @@ -12,7 +12,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -WW 2 / 2 (100%) +WW Time: %s, Memory: %s diff --git a/tests/Regression/GitHub/2158.phpt b/tests/Regression/GitHub/2158.phpt index 9ce0b4b5f32..395e1538baa 100644 --- a/tests/Regression/GitHub/2158.phpt +++ b/tests/Regression/GitHub/2158.phpt @@ -12,7 +12,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -.. 2 / 2 (100%) +.. Time: %s, Memory: %s diff --git a/tests/Regression/GitHub/2366.phpt b/tests/Regression/GitHub/2366.phpt index c75e212b336..0f62d100ac9 100644 --- a/tests/Regression/GitHub/2366.phpt +++ b/tests/Regression/GitHub/2366.phpt @@ -12,7 +12,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -.. 2 / 2 (100%) +.. Time: %s, Memory: %s diff --git a/tests/Regression/GitHub/2380.phpt b/tests/Regression/GitHub/2380.phpt index 4defaeebf26..e03fb50a4a1 100644 --- a/tests/Regression/GitHub/2380.phpt +++ b/tests/Regression/GitHub/2380.phpt @@ -12,7 +12,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -. 1 / 1 (100%) +. Time: %s, Memory: %s diff --git a/tests/Regression/GitHub/2382.phpt b/tests/Regression/GitHub/2382.phpt index 969b25e0a3f..1f9033fa537 100644 --- a/tests/Regression/GitHub/2382.phpt +++ b/tests/Regression/GitHub/2382.phpt @@ -12,7 +12,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -. 1 / 1 (100%) +. Time: %s, Memory: %s diff --git a/tests/Regression/GitHub/2435.phpt b/tests/Regression/GitHub/2435.phpt index f4cabef4a63..e99616ec8c7 100644 --- a/tests/Regression/GitHub/2435.phpt +++ b/tests/Regression/GitHub/2435.phpt @@ -13,7 +13,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -. 1 / 1 (100%) +. Time: %s, Memory: %s diff --git a/tests/Regression/GitHub/244.phpt b/tests/Regression/GitHub/244.phpt index 6624e64159f..966d53715f8 100644 --- a/tests/Regression/GitHub/244.phpt +++ b/tests/Regression/GitHub/244.phpt @@ -13,7 +13,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -.FFF 4 / 4 (100%) +.FFF Time: %s, Memory: %s diff --git a/tests/Regression/GitHub/2448-existing-test.phpt b/tests/Regression/GitHub/2448-existing-test.phpt index 5706a96f3c1..8cf81cee080 100644 --- a/tests/Regression/GitHub/2448-existing-test.phpt +++ b/tests/Regression/GitHub/2448-existing-test.phpt @@ -14,7 +14,7 @@ PHPUnit\TextUI\Command::main(false); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -. 1 / 1 (100%) +. Time: %s, Memory: %s diff --git a/tests/Regression/GitHub/2591-separate-class-preserve-no-bootstrap.phpt b/tests/Regression/GitHub/2591-separate-class-preserve-no-bootstrap.phpt index 4d0dbdfe6cc..19554f96aa3 100644 --- a/tests/Regression/GitHub/2591-separate-class-preserve-no-bootstrap.phpt +++ b/tests/Regression/GitHub/2591-separate-class-preserve-no-bootstrap.phpt @@ -14,7 +14,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -E.E 3 / 3 (100%) +E.E Time: %s, Memory: %s diff --git a/tests/Regression/GitHub/2591-separate-class-preserve.phpt b/tests/Regression/GitHub/2591-separate-class-preserve.phpt index 9594b7f01c9..c42e848514c 100644 --- a/tests/Regression/GitHub/2591-separate-class-preserve.phpt +++ b/tests/Regression/GitHub/2591-separate-class-preserve.phpt @@ -14,7 +14,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -... 3 / 3 (100%) +... Time: %s, Memory: %s diff --git a/tests/Regression/GitHub/2591-separate-function-no-preserve-no-bootstrap-php73.phpt b/tests/Regression/GitHub/2591-separate-function-no-preserve-no-bootstrap-php73.phpt index 2b5e4f9f0ac..336cb8dfd92 100644 --- a/tests/Regression/GitHub/2591-separate-function-no-preserve-no-bootstrap-php73.phpt +++ b/tests/Regression/GitHub/2591-separate-function-no-preserve-no-bootstrap-php73.phpt @@ -21,7 +21,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -EE 2 / 2 (100%) +EE Time: %s, Memory: %s diff --git a/tests/Regression/GitHub/2591-separate-function-no-preserve-no-bootstrap-xdebug.phpt b/tests/Regression/GitHub/2591-separate-function-no-preserve-no-bootstrap-xdebug.phpt index 21e65dd07c9..e009be42fb4 100644 --- a/tests/Regression/GitHub/2591-separate-function-no-preserve-no-bootstrap-xdebug.phpt +++ b/tests/Regression/GitHub/2591-separate-function-no-preserve-no-bootstrap-xdebug.phpt @@ -19,7 +19,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -EE 2 / 2 (100%) +EE Time: %s, Memory: %s diff --git a/tests/Regression/GitHub/2591-separate-function-no-preserve-no-bootstrap.phpt b/tests/Regression/GitHub/2591-separate-function-no-preserve-no-bootstrap.phpt index b82f22466a0..73c651449b6 100644 --- a/tests/Regression/GitHub/2591-separate-function-no-preserve-no-bootstrap.phpt +++ b/tests/Regression/GitHub/2591-separate-function-no-preserve-no-bootstrap.phpt @@ -21,7 +21,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -EE 2 / 2 (100%) +EE Time: %s, Memory: %s diff --git a/tests/Regression/GitHub/2591-separate-function-no-preserve.phpt b/tests/Regression/GitHub/2591-separate-function-no-preserve.phpt index 44aee685233..a73dd274ae7 100644 --- a/tests/Regression/GitHub/2591-separate-function-no-preserve.phpt +++ b/tests/Regression/GitHub/2591-separate-function-no-preserve.phpt @@ -13,7 +13,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -.. 2 / 2 (100%) +.. Time: %s, Memory: %s diff --git a/tests/Regression/GitHub/2591-separate-function-preserve.phpt b/tests/Regression/GitHub/2591-separate-function-preserve.phpt index 8bc9c504633..db1d15756ab 100644 --- a/tests/Regression/GitHub/2591-separate-function-preserve.phpt +++ b/tests/Regression/GitHub/2591-separate-function-preserve.phpt @@ -13,7 +13,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -.. 2 / 2 (100%) +.. Time: %s, Memory: %s diff --git a/tests/Regression/GitHub/2724-diff-pid-from-master-process.phpt b/tests/Regression/GitHub/2724-diff-pid-from-master-process.phpt index e05078659dc..29ff6d90dc5 100644 --- a/tests/Regression/GitHub/2724-diff-pid-from-master-process.phpt +++ b/tests/Regression/GitHub/2724-diff-pid-from-master-process.phpt @@ -15,7 +15,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -. 1 / 1 (100%) +. Time: %s, Memory: %s diff --git a/tests/Regression/GitHub/2725-separate-class-before-after-pid.phpt b/tests/Regression/GitHub/2725-separate-class-before-after-pid.phpt index 0985903d4a6..7bfa92af930 100644 --- a/tests/Regression/GitHub/2725-separate-class-before-after-pid.phpt +++ b/tests/Regression/GitHub/2725-separate-class-before-after-pid.phpt @@ -11,7 +11,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -.. 2 / 2 (100%) +.. Time: %s, Memory: %s diff --git a/tests/Regression/GitHub/2731.phpt b/tests/Regression/GitHub/2731.phpt index 681d3c28d8b..d0c36848c3b 100644 --- a/tests/Regression/GitHub/2731.phpt +++ b/tests/Regression/GitHub/2731.phpt @@ -13,7 +13,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -F 1 / 1 (100%) +F Time: %s, Memory: %s diff --git a/tests/Regression/GitHub/2811.phpt b/tests/Regression/GitHub/2811.phpt index 7d442dc212c..2bc19b3ad5a 100644 --- a/tests/Regression/GitHub/2811.phpt +++ b/tests/Regression/GitHub/2811.phpt @@ -13,7 +13,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -. 1 / 1 (100%) +. Time: %s, Memory: %s diff --git a/tests/Regression/GitHub/2830.phpt b/tests/Regression/GitHub/2830.phpt index f46079dae4a..523d00cacbd 100644 --- a/tests/Regression/GitHub/2830.phpt +++ b/tests/Regression/GitHub/2830.phpt @@ -13,7 +13,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -. 1 / 1 (100%) +. Time: %s, Memory: %s diff --git a/tests/Regression/GitHub/2972.phpt b/tests/Regression/GitHub/2972.phpt index db9e56963dc..158a7ec63f3 100644 --- a/tests/Regression/GitHub/2972.phpt +++ b/tests/Regression/GitHub/2972.phpt @@ -11,7 +11,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -.. 2 / 2 (100%) +.. Time: %s, Memory: %s diff --git a/tests/Regression/GitHub/3093/issue-3093-test.phpt b/tests/Regression/GitHub/3093/issue-3093-test.phpt index ffac64da598..7f15c5e61ae 100644 --- a/tests/Regression/GitHub/3093/issue-3093-test.phpt +++ b/tests/Regression/GitHub/3093/issue-3093-test.phpt @@ -12,7 +12,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -.. 2 / 2 (100%) +.. Time: %s, Memory: %s diff --git a/tests/Regression/GitHub/433.phpt b/tests/Regression/GitHub/433.phpt index f64a29a1833..a796d2ee9e3 100644 --- a/tests/Regression/GitHub/433.phpt +++ b/tests/Regression/GitHub/433.phpt @@ -13,7 +13,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -..F 3 / 3 (100%) +..F Time: %s, Memory: %s diff --git a/tests/Regression/GitHub/445.phpt b/tests/Regression/GitHub/445.phpt index a49768c60f4..2f267e06a09 100644 --- a/tests/Regression/GitHub/445.phpt +++ b/tests/Regression/GitHub/445.phpt @@ -14,7 +14,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -..F 3 / 3 (100%) +..F Time: %s, Memory: %s diff --git a/tests/Regression/GitHub/498.phpt b/tests/Regression/GitHub/498.phpt index e231889b2fc..4c5347354a5 100644 --- a/tests/Regression/GitHub/498.phpt +++ b/tests/Regression/GitHub/498.phpt @@ -15,7 +15,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -W 1 / 1 (100%) +W Time: %s, Memory: %s diff --git a/tests/Regression/GitHub/503.phpt b/tests/Regression/GitHub/503.phpt index 2c8d992dcec..5e2d2480051 100644 --- a/tests/Regression/GitHub/503.phpt +++ b/tests/Regression/GitHub/503.phpt @@ -13,7 +13,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -F 1 / 1 (100%) +F Time: %s, Memory: %s diff --git a/tests/Regression/GitHub/581.phpt b/tests/Regression/GitHub/581.phpt index 861f325ce91..6f0f9786ec9 100644 --- a/tests/Regression/GitHub/581.phpt +++ b/tests/Regression/GitHub/581.phpt @@ -13,7 +13,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -F 1 / 1 (100%) +F Time: %s, Memory: %s diff --git a/tests/Regression/GitHub/74.phpt b/tests/Regression/GitHub/74.phpt index 4f7fa2936f3..ac5fde05ce3 100644 --- a/tests/Regression/GitHub/74.phpt +++ b/tests/Regression/GitHub/74.phpt @@ -13,7 +13,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -E 1 / 1 (100%) +E Time: %s, Memory: %s diff --git a/tests/Regression/GitHub/765.phpt b/tests/Regression/GitHub/765.phpt index 507eff91fab..917c65dee91 100644 --- a/tests/Regression/GitHub/765.phpt +++ b/tests/Regression/GitHub/765.phpt @@ -13,7 +13,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -.W 2 / 2 (100%) +.W Time: %s, Memory: %s diff --git a/tests/Regression/GitHub/797.phpt b/tests/Regression/GitHub/797.phpt index cff94bdd5ba..bedccee1c09 100644 --- a/tests/Regression/GitHub/797.phpt +++ b/tests/Regression/GitHub/797.phpt @@ -15,7 +15,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -. 1 / 1 (100%) +. Time: %s, Memory: %s diff --git a/tests/Regression/GitHub/863.phpt b/tests/Regression/GitHub/863.phpt index df1c62719bc..05824e2bee2 100644 --- a/tests/Regression/GitHub/863.phpt +++ b/tests/Regression/GitHub/863.phpt @@ -15,9 +15,9 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -............................................................... 63 / 150 ( 42%) -............................................................... 126 / 150 ( 84%) -........................ 150 / 150 (100%) +............................................................... 63 +............................................................... 126 +........................ Time: %s, Memory: %s diff --git a/tests/Regression/Trac/1021.phpt b/tests/Regression/Trac/1021.phpt index be084675f46..969b57fcf08 100644 --- a/tests/Regression/Trac/1021.phpt +++ b/tests/Regression/Trac/1021.phpt @@ -12,7 +12,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -.. 2 / 2 (100%) +.. Time: %s, Memory: %s diff --git a/tests/Regression/Trac/523.phpt b/tests/Regression/Trac/523.phpt index 6ee85b622b5..e2e050fa261 100644 --- a/tests/Regression/Trac/523.phpt +++ b/tests/Regression/Trac/523.phpt @@ -12,7 +12,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -. 1 / 1 (100%) +. Time: %s, Memory: %s diff --git a/tests/Regression/Trac/578.phpt b/tests/Regression/Trac/578.phpt index 111e3a011b0..92a0d48690e 100644 --- a/tests/Regression/Trac/578.phpt +++ b/tests/Regression/Trac/578.phpt @@ -12,7 +12,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -EEE 3 / 3 (100%) +EEE Time: %s, Memory: %s diff --git a/tests/Regression/Trac/684.phpt b/tests/Regression/Trac/684.phpt index 33eda07c037..f0489ad3173 100644 --- a/tests/Regression/Trac/684.phpt +++ b/tests/Regression/Trac/684.phpt @@ -12,7 +12,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -W 1 / 1 (100%) +W Time: %s, Memory: %s diff --git a/tests/Regression/Trac/783.phpt b/tests/Regression/Trac/783.phpt index b902d36dc89..6b3a4b510e9 100644 --- a/tests/Regression/Trac/783.phpt +++ b/tests/Regression/Trac/783.phpt @@ -14,7 +14,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -.. 2 / 2 (100%) +.. Time: %s, Memory: %s From 0869cc238fa45b207f23f8721b76b14d07cae5ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20B=C3=BCttner?= Date: Sat, 14 Jul 2018 17:20:09 +0200 Subject: [PATCH 10/13] restoring original dataset name logic --- src/Framework/TestCase.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Framework/TestCase.php b/src/Framework/TestCase.php index 3e839c9cb53..ad83d6920d9 100644 --- a/src/Framework/TestCase.php +++ b/src/Framework/TestCase.php @@ -1098,7 +1098,7 @@ public function registerComparator(Comparator $comparator): void public function getDataSetAsString(bool $includeData = true): string { - if (!empty($this->data)) { + if (empty($this->data)) { return ''; } $buffer = ''; From db18b3e7cf99b08ad16969b88f527af3e2e5635d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20B=C3=BCttner?= Date: Sat, 14 Jul 2018 19:42:46 +0200 Subject: [PATCH 11/13] fixing invalid data provider message --- src/Framework/DataProvidedTestSuite.php | 9 ++++----- src/Framework/DataProviderTestSuite.php | 9 +++++++++ src/Framework/TestSuite.php | 10 +++++++++- src/TextUI/ResultPrinter.php | 4 ++-- 4 files changed, 24 insertions(+), 8 deletions(-) diff --git a/src/Framework/DataProvidedTestSuite.php b/src/Framework/DataProvidedTestSuite.php index cc739742931..94df0e43419 100644 --- a/src/Framework/DataProvidedTestSuite.php +++ b/src/Framework/DataProvidedTestSuite.php @@ -15,6 +15,9 @@ abstract class DataProvidedTestSuite extends TestSuite { + /** + * @var ReflectionClass + */ protected $theClass; protected $method; public function __construct(ReflectionClass $theClass, string $method) @@ -92,11 +95,7 @@ protected function yieldTests(): Generator "Test for {$this->name} skipped by data provider." ); } catch (Throwable $e) { - yield self::incompleteTest( - $this->name, - $this->method, - "data provider for {$this->name} failed" - ); + yield self::warning("The data provider specified for {$this->name} is invalid."); } } diff --git a/src/Framework/DataProviderTestSuite.php b/src/Framework/DataProviderTestSuite.php index 3d2d5ad9cbf..a77b7cada7f 100644 --- a/src/Framework/DataProviderTestSuite.php +++ b/src/Framework/DataProviderTestSuite.php @@ -22,6 +22,15 @@ public function __construct($provider, ReflectionClass $theClass, string $method protected function yieldData(): iterable { + if (!$this->theClass->hasMethod($this->provider)) { + throw new Exception(); + } + if (!$this->theClass->getMethod($this->provider)->isPublic()) { + throw new Exception(); + } + if ($this->theClass->getMethod($this->provider)->isAbstract()) { + throw new Exception(); + } $provider = $this->theClass->newInstanceArgs(); yield from $provider->{$this->provider}(); } diff --git a/src/Framework/TestSuite.php b/src/Framework/TestSuite.php index 8c244639d7d..12ef4648092 100644 --- a/src/Framework/TestSuite.php +++ b/src/Framework/TestSuite.php @@ -572,6 +572,14 @@ protected function yieldTests(): \Generator yield from $this->tests; } + /** + * @return \Generator|Test[] + */ + protected function yieldFilteredTests(): \Generator + { + yield from $this->yieldTests(); + } + /** * Runs the tests and collects their result in a TestResult. * @@ -637,7 +645,7 @@ public function run(TestResult $result = null): TestResult return $result; } - foreach ($this->yieldTests() as $test) { + foreach ($this->yieldFilteredTests() as $test) { if ($result->shouldStop()) { break; } diff --git a/src/TextUI/ResultPrinter.php b/src/TextUI/ResultPrinter.php index c071db187e5..2ccab3760cf 100644 --- a/src/TextUI/ResultPrinter.php +++ b/src/TextUI/ResultPrinter.php @@ -255,8 +255,8 @@ public function startTestSuite(TestSuite $suite): void { if ($this->numTests == -1) { $this->numTests = \count($suite); - $this->numTestsWidth = \strlen((string) $this->numTests) * 2 + 3; - $this->maxColumn = $this->numberOfColumns - 2 - $this->numTestsWidth; + $this->numTestsWidth = \strlen((string) $this->numTests) + 3; + $this->maxColumn = $this->numberOfColumns - 1 - $this->numTestsWidth; } } From 43a76c340f82b06c58d0d78cf71e5fd1c35d8451 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20B=C3=BCttner?= Date: Sat, 14 Jul 2018 20:23:38 +0200 Subject: [PATCH 12/13] catching a few more possible exceptions from dataproviders --- src/Framework/DataProvidedTestSuite.php | 12 ++++++++++-- src/Framework/DataProviderTestSuite.php | 3 +-- tests/Regression/GitHub/863.phpt | 6 +++--- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/Framework/DataProvidedTestSuite.php b/src/Framework/DataProvidedTestSuite.php index 94df0e43419..c229e3a5d0e 100644 --- a/src/Framework/DataProvidedTestSuite.php +++ b/src/Framework/DataProvidedTestSuite.php @@ -88,14 +88,22 @@ protected function yieldTests(): Generator ); } } + } catch (RiskyTestError $exception) { + return new RiskyTestError($exception->getMessage(), 0, $exception); + } catch(IncompleteTestError $exception) { + return self::incompleteTest( + $this->theClass->getName(), + $this->method, + $exception->getMessage() + ); } catch (SkippedTestError $e) { - yield new SkippedTestCase( + return new SkippedTestCase( $this->name, $this->method, "Test for {$this->name} skipped by data provider." ); } catch (Throwable $e) { - yield self::warning("The data provider specified for {$this->name} is invalid."); + return self::warning("The data provider specified for {$this->name} is invalid."); } } diff --git a/src/Framework/DataProviderTestSuite.php b/src/Framework/DataProviderTestSuite.php index a77b7cada7f..73ef965bef3 100644 --- a/src/Framework/DataProviderTestSuite.php +++ b/src/Framework/DataProviderTestSuite.php @@ -31,7 +31,6 @@ protected function yieldData(): iterable if ($this->theClass->getMethod($this->provider)->isAbstract()) { throw new Exception(); } - $provider = $this->theClass->newInstanceArgs(); - yield from $provider->{$this->provider}(); + yield from $this->theClass->newInstanceArgs()->{$this->provider}(); } } diff --git a/tests/Regression/GitHub/863.phpt b/tests/Regression/GitHub/863.phpt index 05824e2bee2..b541a94a4ab 100644 --- a/tests/Regression/GitHub/863.phpt +++ b/tests/Regression/GitHub/863.phpt @@ -15,9 +15,9 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -............................................................... 63 -............................................................... 126 -........................ +......................................................................... 73 +......................................................................... 146 +.... Time: %s, Memory: %s From 47fdd0b8a6309e1534190ef8b76a97fff0d919ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20B=C3=BCttner?= Date: Sat, 14 Jul 2018 20:42:31 +0200 Subject: [PATCH 13/13] restoring tests() fixing spaces in xml log tests --- src/Framework/TestSuite.php | 14 ++++---------- tests/TextUI/dataprovider-log-xml-isolation.phpt | 2 +- tests/TextUI/dataprovider-log-xml.phpt | 2 +- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/src/Framework/TestSuite.php b/src/Framework/TestSuite.php index 12ef4648092..cfacb021f02 100644 --- a/src/Framework/TestSuite.php +++ b/src/Framework/TestSuite.php @@ -572,14 +572,6 @@ protected function yieldTests(): \Generator yield from $this->tests; } - /** - * @return \Generator|Test[] - */ - protected function yieldFilteredTests(): \Generator - { - yield from $this->yieldTests(); - } - /** * Runs the tests and collects their result in a TestResult. * @@ -645,7 +637,7 @@ public function run(TestResult $result = null): TestResult return $result; } - foreach ($this->yieldFilteredTests() as $test) { + foreach ($this->yieldTests() as $test) { if ($result->shouldStop()) { break; } @@ -699,10 +691,12 @@ public function testAt(int $index) /** * Returns the tests as an enumeration. + * @deprecated + * @todo see how this is used, since it removes the benefits of yielding */ public function tests(): array { - return $this->tests; + return iterator_to_array($this->yieldTests()); } /** diff --git a/tests/TextUI/dataprovider-log-xml-isolation.phpt b/tests/TextUI/dataprovider-log-xml-isolation.phpt index 56cf537fc0c..4cb1ff549c6 100644 --- a/tests/TextUI/dataprovider-log-xml-isolation.phpt +++ b/tests/TextUI/dataprovider-log-xml-isolation.phpt @@ -14,7 +14,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -..F. +..F. diff --git a/tests/TextUI/dataprovider-log-xml.phpt b/tests/TextUI/dataprovider-log-xml.phpt index 87c776f9220..875a25d7412 100644 --- a/tests/TextUI/dataprovider-log-xml.phpt +++ b/tests/TextUI/dataprovider-log-xml.phpt @@ -13,7 +13,7 @@ PHPUnit\TextUI\Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann and contributors. -..F. +..F.