From cf14306c2b3f82a81f8d56669a71633b4d4b5fce Mon Sep 17 00:00:00 2001 From: marvin-borner@live.com Date: Mon, 16 Apr 2018 21:09:05 +0200 Subject: Main merge to user management system - files are now at /main/public/ --- .../promise/tests/PromiseTest/RejectTestTrait.php | 368 --------------------- 1 file changed, 368 deletions(-) delete mode 100755 assets/php/vendor/react/promise/tests/PromiseTest/RejectTestTrait.php (limited to 'assets/php/vendor/react/promise/tests/PromiseTest/RejectTestTrait.php') diff --git a/assets/php/vendor/react/promise/tests/PromiseTest/RejectTestTrait.php b/assets/php/vendor/react/promise/tests/PromiseTest/RejectTestTrait.php deleted file mode 100755 index 063f178..0000000 --- a/assets/php/vendor/react/promise/tests/PromiseTest/RejectTestTrait.php +++ /dev/null @@ -1,368 +0,0 @@ -getPromiseTestAdapter(); - - $mock = $this->createCallableMock(); - $mock - ->expects($this->once()) - ->method('__invoke') - ->with($this->identicalTo(1)); - - $adapter->promise() - ->then($this->expectCallableNever(), $mock); - - $adapter->reject(1); - } - - /** @test */ - public function rejectShouldRejectWithFulfilledPromise() - { - $adapter = $this->getPromiseTestAdapter(); - - $mock = $this->createCallableMock(); - $mock - ->expects($this->once()) - ->method('__invoke') - ->with($this->identicalTo(1)); - - $adapter->promise() - ->then($this->expectCallableNever(), $mock); - - $adapter->reject(Promise\resolve(1)); - } - - /** @test */ - public function rejectShouldRejectWithRejectedPromise() - { - $adapter = $this->getPromiseTestAdapter(); - - $mock = $this->createCallableMock(); - $mock - ->expects($this->once()) - ->method('__invoke') - ->with($this->identicalTo(1)); - - $adapter->promise() - ->then($this->expectCallableNever(), $mock); - - $adapter->reject(Promise\reject(1)); - } - - /** @test */ - public function rejectShouldForwardReasonWhenCallbackIsNull() - { - $adapter = $this->getPromiseTestAdapter(); - - $mock = $this->createCallableMock(); - $mock - ->expects($this->once()) - ->method('__invoke') - ->with($this->identicalTo(1)); - - $adapter->promise() - ->then( - $this->expectCallableNever() - ) - ->then( - $this->expectCallableNever(), - $mock - ); - - $adapter->reject(1); - } - - /** @test */ - public function rejectShouldMakePromiseImmutable() - { - $adapter = $this->getPromiseTestAdapter(); - - $mock = $this->createCallableMock(); - $mock - ->expects($this->once()) - ->method('__invoke') - ->with($this->identicalTo(1)); - - $adapter->promise() - ->then(null, function ($value) use ($adapter) { - $adapter->reject(3); - - return Promise\reject($value); - }) - ->then( - $this->expectCallableNever(), - $mock - ); - - $adapter->reject(1); - $adapter->reject(2); - } - - /** @test */ - public function notifyShouldInvokeOtherwiseHandler() - { - $adapter = $this->getPromiseTestAdapter(); - - $mock = $this->createCallableMock(); - $mock - ->expects($this->once()) - ->method('__invoke') - ->with($this->identicalTo(1)); - - $adapter->promise() - ->otherwise($mock); - - $adapter->reject(1); - } - - /** @test */ - public function doneShouldInvokeRejectionHandler() - { - $adapter = $this->getPromiseTestAdapter(); - - $mock = $this->createCallableMock(); - $mock - ->expects($this->once()) - ->method('__invoke') - ->with($this->identicalTo(1)); - - $this->assertNull($adapter->promise()->done(null, $mock)); - $adapter->reject(1); - } - - /** @test */ - public function doneShouldThrowExceptionThrownByRejectionHandler() - { - $adapter = $this->getPromiseTestAdapter(); - - $this->setExpectedException('\Exception', 'UnhandledRejectionException'); - - $this->assertNull($adapter->promise()->done(null, function () { - throw new \Exception('UnhandledRejectionException'); - })); - $adapter->reject(1); - } - - /** @test */ - public function doneShouldThrowUnhandledRejectionExceptionWhenRejectedWithNonException() - { - $adapter = $this->getPromiseTestAdapter(); - - $this->setExpectedException('React\\Promise\\UnhandledRejectionException'); - - $this->assertNull($adapter->promise()->done()); - $adapter->reject(1); - } - - /** @test */ - public function doneShouldThrowUnhandledRejectionExceptionWhenRejectionHandlerRejects() - { - $adapter = $this->getPromiseTestAdapter(); - - $this->setExpectedException('React\\Promise\\UnhandledRejectionException'); - - $this->assertNull($adapter->promise()->done(null, function () { - return \React\Promise\reject(); - })); - $adapter->reject(1); - } - - /** @test */ - public function doneShouldThrowRejectionExceptionWhenRejectionHandlerRejectsWithException() - { - $adapter = $this->getPromiseTestAdapter(); - - $this->setExpectedException('\Exception', 'UnhandledRejectionException'); - - $this->assertNull($adapter->promise()->done(null, function () { - return \React\Promise\reject(new \Exception('UnhandledRejectionException')); - })); - $adapter->reject(1); - } - - /** @test */ - public function doneShouldThrowUnhandledRejectionExceptionWhenRejectionHandlerRetunsPendingPromiseWhichRejectsLater() - { - $adapter = $this->getPromiseTestAdapter(); - - $this->setExpectedException('React\\Promise\\UnhandledRejectionException'); - - $d = new Deferred(); - $promise = $d->promise(); - - $this->assertNull($adapter->promise()->done(null, function () use ($promise) { - return $promise; - })); - $adapter->reject(1); - $d->reject(1); - } - - /** @test */ - public function doneShouldThrowExceptionProvidedAsRejectionValue() - { - $adapter = $this->getPromiseTestAdapter(); - - $this->setExpectedException('\Exception', 'UnhandledRejectionException'); - - $this->assertNull($adapter->promise()->done()); - $adapter->reject(new \Exception('UnhandledRejectionException')); - } - - /** @test */ - public function doneShouldThrowWithDeepNestingPromiseChains() - { - $this->setExpectedException('\Exception', 'UnhandledRejectionException'); - - $exception = new \Exception('UnhandledRejectionException'); - - $d = new Deferred(); - - $result = \React\Promise\resolve(\React\Promise\resolve($d->promise()->then(function () use ($exception) { - $d = new Deferred(); - $d->resolve(); - - return \React\Promise\resolve($d->promise()->then(function () {}))->then( - function () use ($exception) { - throw $exception; - } - ); - }))); - - $result->done(); - - $d->resolve(); - } - - /** @test */ - public function doneShouldRecoverWhenRejectionHandlerCatchesException() - { - $adapter = $this->getPromiseTestAdapter(); - - $this->assertNull($adapter->promise()->done(null, function (\Exception $e) { - - })); - $adapter->reject(new \Exception('UnhandledRejectionException')); - } - - /** @test */ - public function alwaysShouldNotSuppressRejection() - { - $adapter = $this->getPromiseTestAdapter(); - - $exception = new \Exception(); - - $mock = $this->createCallableMock(); - $mock - ->expects($this->once()) - ->method('__invoke') - ->with($this->identicalTo($exception)); - - $adapter->promise() - ->always(function () {}) - ->then(null, $mock); - - $adapter->reject($exception); - } - - /** @test */ - public function alwaysShouldNotSuppressRejectionWhenHandlerReturnsANonPromise() - { - $adapter = $this->getPromiseTestAdapter(); - - $exception = new \Exception(); - - $mock = $this->createCallableMock(); - $mock - ->expects($this->once()) - ->method('__invoke') - ->with($this->identicalTo($exception)); - - $adapter->promise() - ->always(function () { - return 1; - }) - ->then(null, $mock); - - $adapter->reject($exception); - } - - /** @test */ - public function alwaysShouldNotSuppressRejectionWhenHandlerReturnsAPromise() - { - $adapter = $this->getPromiseTestAdapter(); - - $exception = new \Exception(); - - $mock = $this->createCallableMock(); - $mock - ->expects($this->once()) - ->method('__invoke') - ->with($this->identicalTo($exception)); - - $adapter->promise() - ->always(function () { - return \React\Promise\resolve(1); - }) - ->then(null, $mock); - - $adapter->reject($exception); - } - - /** @test */ - public function alwaysShouldRejectWhenHandlerThrowsForRejection() - { - $adapter = $this->getPromiseTestAdapter(); - - $exception = new \Exception(); - - $mock = $this->createCallableMock(); - $mock - ->expects($this->once()) - ->method('__invoke') - ->with($this->identicalTo($exception)); - - $adapter->promise() - ->always(function () use ($exception) { - throw $exception; - }) - ->then(null, $mock); - - $adapter->reject($exception); - } - - /** @test */ - public function alwaysShouldRejectWhenHandlerRejectsForRejection() - { - $adapter = $this->getPromiseTestAdapter(); - - $exception = new \Exception(); - - $mock = $this->createCallableMock(); - $mock - ->expects($this->once()) - ->method('__invoke') - ->with($this->identicalTo($exception)); - - $adapter->promise() - ->always(function () use ($exception) { - return \React\Promise\reject($exception); - }) - ->then(null, $mock); - - $adapter->reject($exception); - } -} -- cgit v1.2.3