aboutsummaryrefslogtreecommitdiffhomepage
path: root/assets/php/vendor/react/promise/tests/FunctionRejectTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'assets/php/vendor/react/promise/tests/FunctionRejectTest.php')
-rw-r--r--assets/php/vendor/react/promise/tests/FunctionRejectTest.php64
1 files changed, 64 insertions, 0 deletions
diff --git a/assets/php/vendor/react/promise/tests/FunctionRejectTest.php b/assets/php/vendor/react/promise/tests/FunctionRejectTest.php
new file mode 100644
index 0000000..84b8ec6
--- /dev/null
+++ b/assets/php/vendor/react/promise/tests/FunctionRejectTest.php
@@ -0,0 +1,64 @@
+<?php
+
+namespace React\Promise;
+
+class FunctionRejectTest extends TestCase
+{
+ /** @test */
+ public function shouldRejectAnImmediateValue()
+ {
+ $expected = 123;
+
+ $mock = $this->createCallableMock();
+ $mock
+ ->expects($this->once())
+ ->method('__invoke')
+ ->with($this->identicalTo($expected));
+
+ reject($expected)
+ ->then(
+ $this->expectCallableNever(),
+ $mock
+ );
+ }
+
+ /** @test */
+ public function shouldRejectAFulfilledPromise()
+ {
+ $expected = 123;
+
+ $resolved = new FulfilledPromise($expected);
+
+ $mock = $this->createCallableMock();
+ $mock
+ ->expects($this->once())
+ ->method('__invoke')
+ ->with($this->identicalTo($expected));
+
+ reject($resolved)
+ ->then(
+ $this->expectCallableNever(),
+ $mock
+ );
+ }
+
+ /** @test */
+ public function shouldRejectARejectedPromise()
+ {
+ $expected = 123;
+
+ $resolved = new RejectedPromise($expected);
+
+ $mock = $this->createCallableMock();
+ $mock
+ ->expects($this->once())
+ ->method('__invoke')
+ ->with($this->identicalTo($expected));
+
+ reject($resolved)
+ ->then(
+ $this->expectCallableNever(),
+ $mock
+ );
+ }
+}