You are here

public function RejectedPromiseTest::testCanResolveThenWithSuccess in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/guzzlehttp/promises/tests/RejectedPromiseTest.php \GuzzleHttp\Promise\Tests\RejectedPromiseTest::testCanResolveThenWithSuccess()

File

vendor/guzzlehttp/promises/tests/RejectedPromiseTest.php, line 123

Class

RejectedPromiseTest
@covers GuzzleHttp\Promise\RejectedPromise

Namespace

GuzzleHttp\Promise\Tests

Code

public function testCanResolveThenWithSuccess() {
  $actual = null;
  $p = new RejectedPromise('foo');
  $p
    ->otherwise(function ($v) {
    return $v . ' bar';
  })
    ->then(function ($v) use (&$actual) {
    $actual = $v;
  });
  \GuzzleHttp\Promise\queue()
    ->run();
  $this
    ->assertEquals('foo bar', $actual);
}