aboutsummaryrefslogtreecommitdiffhomepage
path: root/assets/php/vendor/react/promise/tests/fixtures
diff options
context:
space:
mode:
Diffstat (limited to 'assets/php/vendor/react/promise/tests/fixtures')
-rw-r--r--assets/php/vendor/react/promise/tests/fixtures/SimpleFulfilledTestPromise.php21
-rw-r--r--assets/php/vendor/react/promise/tests/fixtures/SimpleFulfilledTestThenable.php21
-rw-r--r--assets/php/vendor/react/promise/tests/fixtures/SimpleRejectedTestPromise.php21
-rw-r--r--assets/php/vendor/react/promise/tests/fixtures/SimpleTestCancellable.php13
-rw-r--r--assets/php/vendor/react/promise/tests/fixtures/SimpleTestCancellableThenable.php18
5 files changed, 94 insertions, 0 deletions
diff --git a/assets/php/vendor/react/promise/tests/fixtures/SimpleFulfilledTestPromise.php b/assets/php/vendor/react/promise/tests/fixtures/SimpleFulfilledTestPromise.php
new file mode 100644
index 0000000..ef4d530
--- /dev/null
+++ b/assets/php/vendor/react/promise/tests/fixtures/SimpleFulfilledTestPromise.php
@@ -0,0 +1,21 @@
+<?php
+
+namespace React\Promise;
+
+class SimpleFulfilledTestPromise implements PromiseInterface
+{
+ public function then(callable $onFulfilled = null, callable $onRejected = null, callable $onProgress = null)
+ {
+ try {
+ if ($onFulfilled) {
+ $onFulfilled('foo');
+ }
+
+ return new self();
+ } catch (\Throwable $exception) {
+ return new RejectedPromise($exception);
+ } catch (\Exception $exception) {
+ return new RejectedPromise($exception);
+ }
+ }
+}
diff --git a/assets/php/vendor/react/promise/tests/fixtures/SimpleFulfilledTestThenable.php b/assets/php/vendor/react/promise/tests/fixtures/SimpleFulfilledTestThenable.php
new file mode 100644
index 0000000..3f66f63
--- /dev/null
+++ b/assets/php/vendor/react/promise/tests/fixtures/SimpleFulfilledTestThenable.php
@@ -0,0 +1,21 @@
+<?php
+
+namespace React\Promise;
+
+class SimpleFulfilledTestThenable
+{
+ public function then(callable $onFulfilled = null, callable $onRejected = null, callable $onProgress = null)
+ {
+ try {
+ if ($onFulfilled) {
+ $onFulfilled('foo');
+ }
+
+ return new self();
+ } catch (\Throwable $exception) {
+ return new RejectedPromise($exception);
+ } catch (\Exception $exception) {
+ return new RejectedPromise($exception);
+ }
+ }
+}
diff --git a/assets/php/vendor/react/promise/tests/fixtures/SimpleRejectedTestPromise.php b/assets/php/vendor/react/promise/tests/fixtures/SimpleRejectedTestPromise.php
new file mode 100644
index 0000000..b30a226
--- /dev/null
+++ b/assets/php/vendor/react/promise/tests/fixtures/SimpleRejectedTestPromise.php
@@ -0,0 +1,21 @@
+<?php
+
+namespace React\Promise;
+
+class SimpleRejectedTestPromise implements PromiseInterface
+{
+ public function then(callable $onFulfilled = null, callable $onRejected = null, callable $onProgress = null)
+ {
+ try {
+ if ($onRejected) {
+ $onRejected('foo');
+ }
+
+ return new self();
+ } catch (\Throwable $exception) {
+ return new RejectedPromise($exception);
+ } catch (\Exception $exception) {
+ return new RejectedPromise($exception);
+ }
+ }
+}
diff --git a/assets/php/vendor/react/promise/tests/fixtures/SimpleTestCancellable.php b/assets/php/vendor/react/promise/tests/fixtures/SimpleTestCancellable.php
new file mode 100644
index 0000000..f232a68
--- /dev/null
+++ b/assets/php/vendor/react/promise/tests/fixtures/SimpleTestCancellable.php
@@ -0,0 +1,13 @@
+<?php
+
+namespace React\Promise;
+
+class SimpleTestCancellable
+{
+ public $cancelCalled = false;
+
+ public function cancel()
+ {
+ $this->cancelCalled = true;
+ }
+}
diff --git a/assets/php/vendor/react/promise/tests/fixtures/SimpleTestCancellableThenable.php b/assets/php/vendor/react/promise/tests/fixtures/SimpleTestCancellableThenable.php
new file mode 100644
index 0000000..c0f1593
--- /dev/null
+++ b/assets/php/vendor/react/promise/tests/fixtures/SimpleTestCancellableThenable.php
@@ -0,0 +1,18 @@
+<?php
+
+namespace React\Promise;
+
+class SimpleTestCancellableThenable
+{
+ public $cancelCalled = false;
+
+ public function then(callable $onFulfilled = null, callable $onRejected = null, callable $onProgress = null)
+ {
+ return new self();
+ }
+
+ public function cancel()
+ {
+ $this->cancelCalled = true;
+ }
+}