summaryrefslogtreecommitdiff
path: root/vendor/phpunit/phpunit/src/Runner/Hook
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2022-03-22 12:24:31 +0300
committerAndrew Dolgov <[email protected]>2022-03-22 12:24:31 +0300
commit1c4f7ab3b838b23afb2ee4dab14acbf75956e952 (patch)
tree0a19274107d717efe92d2c0376cd3105fead5a11 /vendor/phpunit/phpunit/src/Runner/Hook
parent711662948768492e8d05b778a7d80eacaec368d2 (diff)
* add phpunit as a dev dependency
* add some basic tests for UrlHelper::rewrite_relative() * fix UrlHelper::rewrite_relative() to work better on non-absolute relative URL paths
Diffstat (limited to 'vendor/phpunit/phpunit/src/Runner/Hook')
-rw-r--r--vendor/phpunit/phpunit/src/Runner/Hook/AfterIncompleteTestHook.php24
-rw-r--r--vendor/phpunit/phpunit/src/Runner/Hook/AfterLastTestHook.php24
-rw-r--r--vendor/phpunit/phpunit/src/Runner/Hook/AfterRiskyTestHook.php24
-rw-r--r--vendor/phpunit/phpunit/src/Runner/Hook/AfterSkippedTestHook.php24
-rw-r--r--vendor/phpunit/phpunit/src/Runner/Hook/AfterSuccessfulTestHook.php24
-rw-r--r--vendor/phpunit/phpunit/src/Runner/Hook/AfterTestErrorHook.php24
-rw-r--r--vendor/phpunit/phpunit/src/Runner/Hook/AfterTestFailureHook.php24
-rw-r--r--vendor/phpunit/phpunit/src/Runner/Hook/AfterTestHook.php30
-rw-r--r--vendor/phpunit/phpunit/src/Runner/Hook/AfterTestWarningHook.php24
-rw-r--r--vendor/phpunit/phpunit/src/Runner/Hook/BeforeFirstTestHook.php24
-rw-r--r--vendor/phpunit/phpunit/src/Runner/Hook/BeforeTestHook.php24
-rw-r--r--vendor/phpunit/phpunit/src/Runner/Hook/Hook.php23
-rw-r--r--vendor/phpunit/phpunit/src/Runner/Hook/TestHook.php23
-rw-r--r--vendor/phpunit/phpunit/src/Runner/Hook/TestListenerAdapter.php141
14 files changed, 457 insertions, 0 deletions
diff --git a/vendor/phpunit/phpunit/src/Runner/Hook/AfterIncompleteTestHook.php b/vendor/phpunit/phpunit/src/Runner/Hook/AfterIncompleteTestHook.php
new file mode 100644
index 000000000..432be9a93
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Runner/Hook/AfterIncompleteTestHook.php
@@ -0,0 +1,24 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Runner;
+
+/**
+ * This interface, as well as the associated mechanism for extending PHPUnit,
+ * will be removed in PHPUnit 10. There is no alternative available in this
+ * version of PHPUnit.
+ *
+ * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
+ *
+ * @see https://github.com/sebastianbergmann/phpunit/issues/4676
+ */
+interface AfterIncompleteTestHook extends TestHook
+{
+ public function executeAfterIncompleteTest(string $test, string $message, float $time): void;
+}
diff --git a/vendor/phpunit/phpunit/src/Runner/Hook/AfterLastTestHook.php b/vendor/phpunit/phpunit/src/Runner/Hook/AfterLastTestHook.php
new file mode 100644
index 000000000..eb789f264
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Runner/Hook/AfterLastTestHook.php
@@ -0,0 +1,24 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Runner;
+
+/**
+ * This interface, as well as the associated mechanism for extending PHPUnit,
+ * will be removed in PHPUnit 10. There is no alternative available in this
+ * version of PHPUnit.
+ *
+ * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
+ *
+ * @see https://github.com/sebastianbergmann/phpunit/issues/4676
+ */
+interface AfterLastTestHook extends Hook
+{
+ public function executeAfterLastTest(): void;
+}
diff --git a/vendor/phpunit/phpunit/src/Runner/Hook/AfterRiskyTestHook.php b/vendor/phpunit/phpunit/src/Runner/Hook/AfterRiskyTestHook.php
new file mode 100644
index 000000000..31cc91abf
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Runner/Hook/AfterRiskyTestHook.php
@@ -0,0 +1,24 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Runner;
+
+/**
+ * This interface, as well as the associated mechanism for extending PHPUnit,
+ * will be removed in PHPUnit 10. There is no alternative available in this
+ * version of PHPUnit.
+ *
+ * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
+ *
+ * @see https://github.com/sebastianbergmann/phpunit/issues/4676
+ */
+interface AfterRiskyTestHook extends TestHook
+{
+ public function executeAfterRiskyTest(string $test, string $message, float $time): void;
+}
diff --git a/vendor/phpunit/phpunit/src/Runner/Hook/AfterSkippedTestHook.php b/vendor/phpunit/phpunit/src/Runner/Hook/AfterSkippedTestHook.php
new file mode 100644
index 000000000..76980b3fc
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Runner/Hook/AfterSkippedTestHook.php
@@ -0,0 +1,24 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Runner;
+
+/**
+ * This interface, as well as the associated mechanism for extending PHPUnit,
+ * will be removed in PHPUnit 10. There is no alternative available in this
+ * version of PHPUnit.
+ *
+ * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
+ *
+ * @see https://github.com/sebastianbergmann/phpunit/issues/4676
+ */
+interface AfterSkippedTestHook extends TestHook
+{
+ public function executeAfterSkippedTest(string $test, string $message, float $time): void;
+}
diff --git a/vendor/phpunit/phpunit/src/Runner/Hook/AfterSuccessfulTestHook.php b/vendor/phpunit/phpunit/src/Runner/Hook/AfterSuccessfulTestHook.php
new file mode 100644
index 000000000..d0a10dd15
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Runner/Hook/AfterSuccessfulTestHook.php
@@ -0,0 +1,24 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Runner;
+
+/**
+ * This interface, as well as the associated mechanism for extending PHPUnit,
+ * will be removed in PHPUnit 10. There is no alternative available in this
+ * version of PHPUnit.
+ *
+ * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
+ *
+ * @see https://github.com/sebastianbergmann/phpunit/issues/4676
+ */
+interface AfterSuccessfulTestHook extends TestHook
+{
+ public function executeAfterSuccessfulTest(string $test, float $time): void;
+}
diff --git a/vendor/phpunit/phpunit/src/Runner/Hook/AfterTestErrorHook.php b/vendor/phpunit/phpunit/src/Runner/Hook/AfterTestErrorHook.php
new file mode 100644
index 000000000..12ecebd32
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Runner/Hook/AfterTestErrorHook.php
@@ -0,0 +1,24 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Runner;
+
+/**
+ * This interface, as well as the associated mechanism for extending PHPUnit,
+ * will be removed in PHPUnit 10. There is no alternative available in this
+ * version of PHPUnit.
+ *
+ * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
+ *
+ * @see https://github.com/sebastianbergmann/phpunit/issues/4676
+ */
+interface AfterTestErrorHook extends TestHook
+{
+ public function executeAfterTestError(string $test, string $message, float $time): void;
+}
diff --git a/vendor/phpunit/phpunit/src/Runner/Hook/AfterTestFailureHook.php b/vendor/phpunit/phpunit/src/Runner/Hook/AfterTestFailureHook.php
new file mode 100644
index 000000000..94b2f3004
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Runner/Hook/AfterTestFailureHook.php
@@ -0,0 +1,24 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Runner;
+
+/**
+ * This interface, as well as the associated mechanism for extending PHPUnit,
+ * will be removed in PHPUnit 10. There is no alternative available in this
+ * version of PHPUnit.
+ *
+ * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
+ *
+ * @see https://github.com/sebastianbergmann/phpunit/issues/4676
+ */
+interface AfterTestFailureHook extends TestHook
+{
+ public function executeAfterTestFailure(string $test, string $message, float $time): void;
+}
diff --git a/vendor/phpunit/phpunit/src/Runner/Hook/AfterTestHook.php b/vendor/phpunit/phpunit/src/Runner/Hook/AfterTestHook.php
new file mode 100644
index 000000000..3d5bcaa93
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Runner/Hook/AfterTestHook.php
@@ -0,0 +1,30 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Runner;
+
+/**
+ * This interface, as well as the associated mechanism for extending PHPUnit,
+ * will be removed in PHPUnit 10. There is no alternative available in this
+ * version of PHPUnit.
+ *
+ * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
+ *
+ * @see https://github.com/sebastianbergmann/phpunit/issues/4676
+ */
+interface AfterTestHook extends TestHook
+{
+ /**
+ * This hook will fire after any test, regardless of the result.
+ *
+ * For more fine grained control, have a look at the other hooks
+ * that extend PHPUnit\Runner\Hook.
+ */
+ public function executeAfterTest(string $test, float $time): void;
+}
diff --git a/vendor/phpunit/phpunit/src/Runner/Hook/AfterTestWarningHook.php b/vendor/phpunit/phpunit/src/Runner/Hook/AfterTestWarningHook.php
new file mode 100644
index 000000000..860fcceeb
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Runner/Hook/AfterTestWarningHook.php
@@ -0,0 +1,24 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Runner;
+
+/**
+ * This interface, as well as the associated mechanism for extending PHPUnit,
+ * will be removed in PHPUnit 10. There is no alternative available in this
+ * version of PHPUnit.
+ *
+ * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
+ *
+ * @see https://github.com/sebastianbergmann/phpunit/issues/4676
+ */
+interface AfterTestWarningHook extends TestHook
+{
+ public function executeAfterTestWarning(string $test, string $message, float $time): void;
+}
diff --git a/vendor/phpunit/phpunit/src/Runner/Hook/BeforeFirstTestHook.php b/vendor/phpunit/phpunit/src/Runner/Hook/BeforeFirstTestHook.php
new file mode 100644
index 000000000..feeb90fba
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Runner/Hook/BeforeFirstTestHook.php
@@ -0,0 +1,24 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Runner;
+
+/**
+ * This interface, as well as the associated mechanism for extending PHPUnit,
+ * will be removed in PHPUnit 10. There is no alternative available in this
+ * version of PHPUnit.
+ *
+ * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
+ *
+ * @see https://github.com/sebastianbergmann/phpunit/issues/4676
+ */
+interface BeforeFirstTestHook extends Hook
+{
+ public function executeBeforeFirstTest(): void;
+}
diff --git a/vendor/phpunit/phpunit/src/Runner/Hook/BeforeTestHook.php b/vendor/phpunit/phpunit/src/Runner/Hook/BeforeTestHook.php
new file mode 100644
index 000000000..b7e0827d0
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Runner/Hook/BeforeTestHook.php
@@ -0,0 +1,24 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Runner;
+
+/**
+ * This interface, as well as the associated mechanism for extending PHPUnit,
+ * will be removed in PHPUnit 10. There is no alternative available in this
+ * version of PHPUnit.
+ *
+ * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
+ *
+ * @see https://github.com/sebastianbergmann/phpunit/issues/4676
+ */
+interface BeforeTestHook extends TestHook
+{
+ public function executeBeforeTest(string $test): void;
+}
diff --git a/vendor/phpunit/phpunit/src/Runner/Hook/Hook.php b/vendor/phpunit/phpunit/src/Runner/Hook/Hook.php
new file mode 100644
index 000000000..a08dc72b0
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Runner/Hook/Hook.php
@@ -0,0 +1,23 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Runner;
+
+/**
+ * This interface, as well as the associated mechanism for extending PHPUnit,
+ * will be removed in PHPUnit 10. There is no alternative available in this
+ * version of PHPUnit.
+ *
+ * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
+ *
+ * @see https://github.com/sebastianbergmann/phpunit/issues/4676
+ */
+interface Hook
+{
+}
diff --git a/vendor/phpunit/phpunit/src/Runner/Hook/TestHook.php b/vendor/phpunit/phpunit/src/Runner/Hook/TestHook.php
new file mode 100644
index 000000000..31e880e2c
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Runner/Hook/TestHook.php
@@ -0,0 +1,23 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Runner;
+
+/**
+ * This interface, as well as the associated mechanism for extending PHPUnit,
+ * will be removed in PHPUnit 10. There is no alternative available in this
+ * version of PHPUnit.
+ *
+ * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
+ *
+ * @see https://github.com/sebastianbergmann/phpunit/issues/4676
+ */
+interface TestHook extends Hook
+{
+}
diff --git a/vendor/phpunit/phpunit/src/Runner/Hook/TestListenerAdapter.php b/vendor/phpunit/phpunit/src/Runner/Hook/TestListenerAdapter.php
new file mode 100644
index 000000000..60fbfba31
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Runner/Hook/TestListenerAdapter.php
@@ -0,0 +1,141 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Runner;
+
+use PHPUnit\Framework\AssertionFailedError;
+use PHPUnit\Framework\Test;
+use PHPUnit\Framework\TestListener;
+use PHPUnit\Framework\TestSuite;
+use PHPUnit\Framework\Warning;
+use PHPUnit\Util\Test as TestUtil;
+use Throwable;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+final class TestListenerAdapter implements TestListener
+{
+ /**
+ * @var TestHook[]
+ */
+ private $hooks = [];
+
+ /**
+ * @var bool
+ */
+ private $lastTestWasNotSuccessful;
+
+ public function add(TestHook $hook): void
+ {
+ $this->hooks[] = $hook;
+ }
+
+ public function startTest(Test $test): void
+ {
+ foreach ($this->hooks as $hook) {
+ if ($hook instanceof BeforeTestHook) {
+ $hook->executeBeforeTest(TestUtil::describeAsString($test));
+ }
+ }
+
+ $this->lastTestWasNotSuccessful = false;
+ }
+
+ public function addError(Test $test, Throwable $t, float $time): void
+ {
+ foreach ($this->hooks as $hook) {
+ if ($hook instanceof AfterTestErrorHook) {
+ $hook->executeAfterTestError(TestUtil::describeAsString($test), $t->getMessage(), $time);
+ }
+ }
+
+ $this->lastTestWasNotSuccessful = true;
+ }
+
+ public function addWarning(Test $test, Warning $e, float $time): void
+ {
+ foreach ($this->hooks as $hook) {
+ if ($hook instanceof AfterTestWarningHook) {
+ $hook->executeAfterTestWarning(TestUtil::describeAsString($test), $e->getMessage(), $time);
+ }
+ }
+
+ $this->lastTestWasNotSuccessful = true;
+ }
+
+ public function addFailure(Test $test, AssertionFailedError $e, float $time): void
+ {
+ foreach ($this->hooks as $hook) {
+ if ($hook instanceof AfterTestFailureHook) {
+ $hook->executeAfterTestFailure(TestUtil::describeAsString($test), $e->getMessage(), $time);
+ }
+ }
+
+ $this->lastTestWasNotSuccessful = true;
+ }
+
+ public function addIncompleteTest(Test $test, Throwable $t, float $time): void
+ {
+ foreach ($this->hooks as $hook) {
+ if ($hook instanceof AfterIncompleteTestHook) {
+ $hook->executeAfterIncompleteTest(TestUtil::describeAsString($test), $t->getMessage(), $time);
+ }
+ }
+
+ $this->lastTestWasNotSuccessful = true;
+ }
+
+ public function addRiskyTest(Test $test, Throwable $t, float $time): void
+ {
+ foreach ($this->hooks as $hook) {
+ if ($hook instanceof AfterRiskyTestHook) {
+ $hook->executeAfterRiskyTest(TestUtil::describeAsString($test), $t->getMessage(), $time);
+ }
+ }
+
+ $this->lastTestWasNotSuccessful = true;
+ }
+
+ public function addSkippedTest(Test $test, Throwable $t, float $time): void
+ {
+ foreach ($this->hooks as $hook) {
+ if ($hook instanceof AfterSkippedTestHook) {
+ $hook->executeAfterSkippedTest(TestUtil::describeAsString($test), $t->getMessage(), $time);
+ }
+ }
+
+ $this->lastTestWasNotSuccessful = true;
+ }
+
+ public function endTest(Test $test, float $time): void
+ {
+ if (!$this->lastTestWasNotSuccessful) {
+ foreach ($this->hooks as $hook) {
+ if ($hook instanceof AfterSuccessfulTestHook) {
+ $hook->executeAfterSuccessfulTest(TestUtil::describeAsString($test), $time);
+ }
+ }
+ }
+
+ foreach ($this->hooks as $hook) {
+ if ($hook instanceof AfterTestHook) {
+ $hook->executeAfterTest(TestUtil::describeAsString($test), $time);
+ }
+ }
+ }
+
+ public function startTestSuite(TestSuite $suite): void
+ {
+ }
+
+ public function endTestSuite(TestSuite $suite): void
+ {
+ }
+}