Commit 060c6593 authored by Simon Welsh's avatar Simon Welsh

Start migrating HHI files to new namespaces

parent 96265797
<?hh // decl
interface PHPUnit_Framework_SelfDescribing {
namespace PHPUnit\Framework;
interface SelfDescribing {
public function toString(): string;
}
<?hh // decl
interface PHPUnit_Framework_SkippedTest {}
namespace PHPUnit\Framework;
interface SkippedTest {}
<?hh // decl
class PHPUnit_Framework_SkippedTestCase extends PHPUnit_Framework_TestCase {
namespace PHPUnit\Framework;
class SkippedTestCase extends TestCase {
protected bool $useErrorHandler = false;
protected bool $useOutputBuffering = false;
public function __construct(protected string $message);
public function __construct(
string $className,
string $methodName,
protected string $message = '',
);
public function getMessage(): string;
}
<?hh // decl
class PHPUnit_Framework_SkippedTestError
extends PHPUnit_Framework_AssertionFailedError
implements PHPUnit_Framework_SkippedTest {}
namespace PHPUnit\Framework;
class SkippedTestError extends AssertionFailedError implements SkippedTest {}
<?hh // decl
class PHPUnit_Framework_SkippedTestSuiteError
extends PHPUnit_Framework_AssertionFailedError
implements PHPUnit_Framework_SkippedTest {}
namespace PHPUnit\Framework;
class SkippedTestSuiteError extends AssertionFailedError
implements SkippedTest {}
<?hh // decl
class PHPUnit_Framework_SyntheticError
extends PHPUnit_Framework_AssertionFailedError {
namespace PHPUnit\Framework;
class SyntheticError extends AssertionFailedError {
public function __construct(
string $Message,
string $message,
int $code,
protected string $file,
protected int $line,
protected array $trace,
protected string $syntheticFile,
protected int $syntheticLine,
protected array $syntheticTrace,
);
public function getSyntheticFile(): string;
public function getSyntheticLine(): int;
......
<?hh // decl
interface PHPUnit_Framework_Test extends Countable {
public function run(
?PHPUnit_Framework_TestResult $result = null,
): PHPUnit_Framework_TestResult;
namespace PHPUnit\Framework;
interface Test extends \Countable {
public function run(?TestResult $result = null): TestResult;
}
This diff is collapsed.
<?hh // decl
class PHPUnit_Framework_TestFailure {
protected ?PHPUnit_Framework_Test $failedTest;
protected Exception $thrownException;
namespace PHPUnit\Framework;
public function __construct(
PHPUnit_Framework_Test $failedTest,
Exception $thrownException,
);
// Once Hack knows about Throwable, remove this include
use Exception as Throwable;
class TestFailure {
protected ?Test $failedTest;
protected Throwable $thrownException;
public function __construct(Test $failedTest, Throwable $thrownException);
public function toString(): string;
public function getExceptionAsString(): string;
public static function exceptionToString(Exception $e): string;
public static function exceptionToString(Throwable $e): string;
public function getTestName(): string;
public function failedTest(): ?PHPUnit_Framework_Test;
public function failedTest(): ?Test;
public function thrownException(): Exception;
public function exceptionMessage(): string;
public function isFailure(): bool;
......
<?hh // decl
namespace PHPUnit\Framework;
// Once Hack knows about Throwable, remove this include
use Exception as Throwable;
// Due to the way interfaces get checked at run time, this needs to match the
// actual implementation, so no bonus types :(
interface PHPUnit_Framework_TestListener {
public function addError(PHPUnit_Framework_Test $test, Exception $e, $time);
public function addFailure(
PHPUnit_Framework_Test $test,
PHPUnit_Framework_AssertionFailedError $e,
$time,
);
public function addIncompleteTest(
PHPUnit_Framework_Test $test,
Exception $e,
$time,
);
public function addRiskyTest(
PHPUnit_Framework_Test $test,
Exception $e,
$time,
);
public function addSkippedTest(
PHPUnit_Framework_Test $test,
Exception $e,
$time,
);
public function startTestSuite(PHPUnit_Framework_TestSuite $suite);
public function endTestSuite(PHPUnit_Framework_TestSuite $suite);
public function startTest(PHPUnit_Framework_Test $test);
public function endTest(PHPUnit_Framework_Test $test, $time);
interface TestListener {
public function addError(Test $test, Throwable $e, $time);
public function addWarning(Test $test, Warning $e, $time);
public function addFailure(Test $test, AssertionFailedError $e, $time);
public function addIncompleteTest(Test $test, Throwable $e, $time);
public function addRiskyTest(Test $test, Throwable $e, $time);
public function addSkippedTest(Test $test, Throwable $e, $time);
public function startTestSuite(TestSuite $suite);
public function endTestSuite(TestSuite $suite);
public function startTest(Test $test);
public function endTest(Test $test, $time);
}
<?hh // decl
class PHPUnit_Framework_TestResult implements Countable {
namespace PHPUnit\Framework;
// Once Hack knows about Throwable, remove this include
use Exception as Throwable;
class TestResult implements \Countable {
protected array<string,
shape(
'result' => PHPUnit_Framework_TestResult,
'result' => TestResult,
'size' => int,
)> $passed = [];
protected array<PHPUnit_Framework_TestFailure> $error = [];
protected array<PHPUnit_Framework_TestFailure> $failures = [];
protected array<PHPUnit_Framework_TestFailure> $warnings = [];
protected array<PHPUnit_Framework_TestFailure> $notImplemented = [];
protected array<PHPUnit_Framework_TestFailure> $risky = [];
protected array<PHPUnit_Framework_TestFailure> $skipped = [];
protected array<PHPUnit_Framework_TestListener> $listeners = [];
protected array<TestFailure> $error = [];
protected array<TestFailure> $failures = [];
protected array<TestFailure> $warnings = [];
protected array<TestFailure> $notImplemented = [];
protected array<TestFailure> $risky = [];
protected array<TestFailure> $skipped = [];
protected array<TestListener> $listeners = [];
protected int $runTests = 0;
protected float $time = 0.0;
protected ?PHPUnit_Framework_TestSuite $topTestSuite;
protected ?TestSuite $topTestSuite;
protected /*?SebastianBergmann\CodeCoverage\CodeCoverage*/ $codeCoverage;
protected bool $convertErrorsToExceptions = true;
......@@ -40,33 +45,23 @@ class PHPUnit_Framework_TestResult implements Countable {
protected int $timeoutForMediumTests = 10;
protected int $timeoutForLargeTests = 60;
public function addListener(PHPUnit_Framework_TestListener $listener): void;
public function removeListener(
PHPUnit_Framework_TestListener $listener,
): void;
public function addListener(TestListener $listener): void;
public function removeListener(TestListener $listener): void;
public function flushListeners(): void;
public function addError(
PHPUnit_Framework_Test $test,
Exception $e,
float $time,
): void;
public function addWarning(
PHPUnit_Framework_Test $test,
PHPUnit_Framework_Warning $e,
$time,
): void;
public function addError(Test $test, Throwable $e, float $time): void;
public function addWarning(Test $test, Warning $e, float $time): void;
public function addFailure(
PHPUnit_Framework_Test $test,
PHPUnit_Framework_AssertionFailedError $e,
Test $test,
AssertionFailedError $e,
float $time,
): void;
public function startTestSuite(PHPUnit_Framework_TestSuite $suite): void;
public function endTestSuite(PHPUnit_Framework_TestSuite $suite): void;
public function startTestSuite(TestSuite $suite): void;
public function endTestSuite(TestSuite $suite): void;
public function startTest(PHPUnit_Framework_Test $test): void;
public function endTest(PHPUnit_Framework_Test $test, float $time): void;
public function startTest(Test $test): void;
public function endTest(Test $test, float $time): void;
public function allHarmless(): bool;
public function riskyCount(): int;
......@@ -74,34 +69,34 @@ class PHPUnit_Framework_TestResult implements Countable {
public function allCompletelyImplemented(): bool;
public function notImplementedCount(): int;
public function risky(): array<PHPUnit_Framework_TestFailure>;
public function notImplemented(): array<PHPUnit_Framework_TestFailure>;
public function risky(): array<TestFailure>;
public function notImplemented(): array<TestFailure>;
public function noneSkipped(): bool;
public function skippedCount(): int;
public function skipped(): array<PHPUnit_Framework_TestFailure>;
public function skipped(): array<TestFailure>;
public function errorCount(): int;
public function errors(): array<PHPUnit_Framework_TestFailure>;
public function errors(): array<TestFailure>;
public function failureCount(): int;
public function failures(): array<PHPUnit_Framework_TestFailure>;
public function failures(): array<TestFailure>;
public function warningCount(): int;
public function warnings(): array<PHPUnit_Framework_TestFailure>;
public function warnings(): array<TestFailure>;
public function passed(
): array<string,
shape(
'result' => PHPUnit_Framework_TestResult,
'result' => TestResult,
'size' => int,
)>;
public function topTestSute(): ?PHPUnit_Framework_TestSuite;
public function topTestSute(): ?TestSuite;
public function getCollectCodeCoverageInformation(): bool;
public function run(PHPUnit_Framework_Test $test): void;
public function run(Test $test): void;
public function count(): int;
......@@ -119,7 +114,7 @@ class PHPUnit_Framework_TestResult implements Countable {
public function stopOnError(bool $flag): void;
public function stopOnFailure(bool $flag): void;
public function stopOnWarning(bool $flag);
public function stopOnWarning(bool $flag): void;
public function beStrictAboutTestsThatDoNotTestAnything(bool $flag): void;
public function isStrictAboutTestsThatDoNotTestAnything(): bool;
......@@ -144,7 +139,7 @@ class PHPUnit_Framework_TestResult implements Countable {
public function time(): float;
public function wasSuccessful(bool $includeWarnings = true): bool;
public function wasSuccessful(): bool;
public function setTimeoutForSmallTests(int $timeout): void;
public function setTimeoutForMediumTests(int $timeout): void;
......
<?hh // decl
class PHPUnit_Framework_TestSuite
implements
PHPUnit_Framework_Test,
PHPUnit_Framework_SelfDescribing,
IteratorAggregate<PHPUnit_Framework_Test> {
namespace PHPUnit\Framework;
class TestSuite implements Test, SelfDescribing, \IteratorAggregate<Test> {
protected ?bool $backupGlobals = null;
protected ?bool $backupStaticAttributes = null;
protected bool $runTestInSeparateProcess = false;
protected string $name = '';
protected array<string, array<PHPUnit_Framework_Test>> $groups = [];
protected array<PHPUnit_Framework_Test> $tests = [];
protected array<string, array<Test>> $groups = [];
protected array<Test> $tests = [];
protected int $numTests = -1;
protected bool $testCase = false;
protected array<string> $foundClasses = [];
......@@ -19,10 +17,7 @@ class PHPUnit_Framework_TestSuite
public function __construct($theClass, string $name = '');
public function toString(): string;
public function addTest(
PHPUnit_Framework_Test $test,
array<string> $groups = [],
): void;
public function addTest(Test $test, array<string> $groups = []): void;
public function addTestSuite($testClass): void;
public function addTestFile(string $filename): void;
public function addTestFiles(Traversable<string> $filenames): void;
......@@ -30,58 +25,48 @@ class PHPUnit_Framework_TestSuite
public function count(bool $preferCache = false): int;
public static function createTest(
ReflectionClass $theClass,
\ReflectionClass $theClass,
string $name,
): PHPUnit_Framework_Test;
): Test;
protected function createResult(): PHPUnit_Framework_TestResult;
protected function createResult(): TestResult;
public function getName(): string;
public function getGroups(): array<string>;
public function getGroupDetails(
): array<string, array<PHPUnit_Framework_Test>>;
public function getGroupDetails(): array<string, array<Test>>;
public function setGroupDetails(
array<string, array<PHPUnit_Framework_Test>> $groups,
): void;
public function run(
?PHPUnit_Framework_TestResult $result = null,
): PHPUnit_Framework_TestResult;
public function setGroupDetails(array<string, array<Test>> $groups): void;
public function run(?TestResult $result = null): TestResult;
public function setRunTestInSeparateProcess(
bool $runTestInSeparateProcess,
): void;
public function runTest(
PHPUnit_Framework_Test $test,
PHPUnit_Framework_TestResult $result,
): void;
public function runTest(Test $test, TestResult $result): void;
public function setName(string $name): void;
public function testAt(int $index); // False-able return :(
public function tests(): array<PHPUnit_Framework_Test>;
public function setTests(array<PHPUnit_Framework_Test> $tests): void;
public function tests(): array<Test>;
public function setTests(array<Test> $tests): void;
public function markTestSuiteSkipped(string $message = ''): void;
public function markTestSuiteSkipped(string $message = ''): noreturn;
protected function addTestMethod(
ReflectionClass $class,
ReflectionMethod $method,
\ReflectionClass $class,
\ReflectionMethod $method,
): void;
public static function isTestMethod(ReflectionMethod $method): bool;
public static function isTestMethod(\ReflectionMethod $method): bool;
protected static function warning(
string $message,
): PHPUnit_Framework_Warning;
protected static function warning(string $message): Warning;
protected static function skipTest<T>(
classname<T> $class,
string $methodName,
string $message,
): PHPUnit_Framework_SkippedTestCase;
): SkippedTestCase;
protected static function incompleteTest<T>(
classname<T> $class,
string $methodName,
string $message,
): PHPUnit_Framework_IncompleteTestCase;
): IncompleteTestCase;
public function setbeStrictAboutChangesToGlobalState(
bool $beStrictAboutChangesToGlobalState,
......@@ -91,9 +76,9 @@ class PHPUnit_Framework_TestSuite
bool $backupStaticAttributes,
): void;
public function getIterator(): RecursiveIteratorIterator;
public function getIterator(): \RecursiveIteratorIterator;
public function injectFilter(PHPUnit_Runner_Filter_Factory $filter): void;
public function injectFilter(\PHPUnit\Runner\Filter\Factory $filter): void;
protected function setUp(): void;
protected function tearDown(): void;
......
<?hh // decl
class PHPUnit_Framework_UnintentionallyCoveredCodeError
extends PHPUnit_Framework_RiskyTestError {}
namespace PHPUnit\Framework;
class UnintentionallyCoveredCodeError extends RiskyTestError {}
<?hh // decl
class PHPUnit_Framework_Warning extends PHPUnit_Framework_Exception
implements PHPUnit_Framework_SelfDescribing {
namespace PHPUnit\Framework;
class Warning extends Exception implements SelfDescribing {
public function toString(): string;
}
<?hh // decl
class PHPUnit_Framework_WarningTestCase extends PHPUnit_Framework_TestCase {
namespace PHPUnit\Framework;
class WarningTestCase extends TestCase {
protected bool $useErrorHandler = false;
public function __construct(protected string $message);
......
<?hh // decl
class PHPUnit_Runner_Filter_Factory {
public function addFilter(ReflectionClass $filter, mixed $args): void;
namespace PHPUnit\Runner\Filter;
class Factory {
public function addFilter(\ReflectionClass $filter, mixed $args): void;
public function factory(
Iterator $iterator,
PHPUnit_Framework_TestSuite $suite,
): FilterIterator;
\Iterator $iterator,
\PHPUnit\Framework\TestSuite $suite,
): \FilterIterator;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment