summaryrefslogtreecommitdiff
path: root/server/vendor/guzzlehttp/promises/tests/FulfilledPromiseTest.php
diff options
context:
space:
mode:
authorEole <EoleDev@outlook.fr>2016-04-27 16:42:28 +0200
committerEole <EoleDev@outlook.fr>2016-04-27 16:42:28 +0200
commit49f416dc5061032e0514ea0cfeceaca37d13e432 (patch)
tree1202ac2a6fa860b8929afdc886c94fc50bd0a1de /server/vendor/guzzlehttp/promises/tests/FulfilledPromiseTest.php
parentc7edd70b5e5b0f5159c78ce3d924d4e7f60db816 (diff)
parentc9202d9113210981ae47df40511645da2ee140df (diff)
Merge branch 'develop' into Eole_Graph
Conflicts: client/index.html client/js/controllers/home/home.js client/partials/home/home.html
Diffstat (limited to 'server/vendor/guzzlehttp/promises/tests/FulfilledPromiseTest.php')
-rw-r--r--server/vendor/guzzlehttp/promises/tests/FulfilledPromiseTest.php108
1 files changed, 0 insertions, 108 deletions
diff --git a/server/vendor/guzzlehttp/promises/tests/FulfilledPromiseTest.php b/server/vendor/guzzlehttp/promises/tests/FulfilledPromiseTest.php
deleted file mode 100644
index 554c150..0000000
--- a/server/vendor/guzzlehttp/promises/tests/FulfilledPromiseTest.php
+++ /dev/null
@@ -1,108 +0,0 @@
-<?php
-namespace GuzzleHttp\Tests\Promise;
-
-use GuzzleHttp\Promise\Promise;
-use GuzzleHttp\Promise\FulfilledPromise;
-
-/**
- * @covers GuzzleHttp\Promise\FulfilledPromise
- */
-class FulfilledPromiseTest extends \PHPUnit_Framework_TestCase
-{
- public function testReturnsValueWhenWaitedUpon()
- {
- $p = new FulfilledPromise('foo');
- $this->assertEquals('fulfilled', $p->getState());
- $this->assertEquals('foo', $p->wait(true));
- }
-
- public function testCannotCancel()
- {
- $p = new FulfilledPromise('foo');
- $this->assertEquals('fulfilled', $p->getState());
- $p->cancel();
- $this->assertEquals('foo', $p->wait());
- }
-
- /**
- * @expectedException \LogicException
- * @exepctedExceptionMessage Cannot resolve a fulfilled promise
- */
- public function testCannotResolve()
- {
- $p = new FulfilledPromise('foo');
- $p->resolve('bar');
- }
-
- /**
- * @expectedException \LogicException
- * @exepctedExceptionMessage Cannot reject a fulfilled promise
- */
- public function testCannotReject()
- {
- $p = new FulfilledPromise('foo');
- $p->reject('bar');
- }
-
- public function testCanResolveWithSameValue()
- {
- $p = new FulfilledPromise('foo');
- $p->resolve('foo');
- }
-
- /**
- * @expectedException \InvalidArgumentException
- */
- public function testCannotResolveWithPromise()
- {
- new FulfilledPromise(new Promise());
- }
-
- public function testReturnsSelfWhenNoOnFulfilled()
- {
- $p = new FulfilledPromise('a');
- $this->assertSame($p, $p->then());
- }
-
- public function testAsynchronouslyInvokesOnFulfilled()
- {
- $p = new FulfilledPromise('a');
- $r = null;
- $f = function ($d) use (&$r) { $r = $d; };
- $p2 = $p->then($f);
- $this->assertNotSame($p, $p2);
- $this->assertNull($r);
- \GuzzleHttp\Promise\queue()->run();
- $this->assertEquals('a', $r);
- }
-
- public function testReturnsNewRejectedWhenOnFulfilledFails()
- {
- $p = new FulfilledPromise('a');
- $f = function () { throw new \Exception('b'); };
- $p2 = $p->then($f);
- $this->assertNotSame($p, $p2);
- try {
- $p2->wait();
- $this->fail();
- } catch (\Exception $e) {
- $this->assertEquals('b', $e->getMessage());
- }
- }
-
- public function testOtherwiseIsSugarForRejections()
- {
- $c = null;
- $p = new FulfilledPromise('foo');
- $p->otherwise(function ($v) use (&$c) { $c = $v; });
- $this->assertNull($c);
- }
-
- public function testDoesNotTryToFulfillTwiceDuringTrampoline()
- {
- $fp = new FulfilledPromise('a');
- $t1 = $fp->then(function ($v) { return $v . ' b'; });
- $t1->resolve('why!');
- $this->assertEquals('why!', $t1->wait());
- }
-}