~tcuthbert/wordpress/openstack-objectstorage-k8s

« back to all changes in this revision

Viewing changes to vendor/react/promise/tests/PromiseTest/PromisePendingTestTrait.php

  • Committer: Thomas Cuthbert
  • Date: 2020-04-23 05:22:45 UTC
  • Revision ID: thomas.cuthbert@canonical.com-20200423052245-1jxao3mw31w435js
[,r=trivial] bionic composer vendor update

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
 
 
3
namespace React\Promise\PromiseTest;
 
4
 
 
5
trait PromisePendingTestTrait
 
6
{
 
7
    /**
 
8
     * @return \React\Promise\PromiseAdapter\PromiseAdapterInterface
 
9
     */
 
10
    abstract public function getPromiseTestAdapter(callable $canceller = null);
 
11
 
 
12
    /** @test */
 
13
    public function thenShouldReturnAPromiseForPendingPromise()
 
14
    {
 
15
        $adapter = $this->getPromiseTestAdapter();
 
16
 
 
17
        $this->assertInstanceOf('React\\Promise\\PromiseInterface', $adapter->promise()->then());
 
18
    }
 
19
 
 
20
    /** @test */
 
21
    public function thenShouldReturnAllowNullForPendingPromise()
 
22
    {
 
23
        $adapter = $this->getPromiseTestAdapter();
 
24
 
 
25
        $this->assertInstanceOf('React\\Promise\\PromiseInterface', $adapter->promise()->then(null, null, null));
 
26
    }
 
27
 
 
28
    /** @test */
 
29
    public function cancelShouldReturnNullForPendingPromise()
 
30
    {
 
31
        $adapter = $this->getPromiseTestAdapter();
 
32
 
 
33
        $this->assertNull($adapter->promise()->cancel());
 
34
    }
 
35
 
 
36
    /** @test */
 
37
    public function doneShouldReturnNullForPendingPromise()
 
38
    {
 
39
        $adapter = $this->getPromiseTestAdapter();
 
40
 
 
41
        $this->assertNull($adapter->promise()->done());
 
42
    }
 
43
 
 
44
    /** @test */
 
45
    public function doneShouldReturnAllowNullForPendingPromise()
 
46
    {
 
47
        $adapter = $this->getPromiseTestAdapter();
 
48
 
 
49
        $this->assertNull($adapter->promise()->done(null, null, null));
 
50
    }
 
51
 
 
52
    /** @test */
 
53
    public function otherwiseShouldNotInvokeRejectionHandlerForPendingPromise()
 
54
    {
 
55
        $adapter = $this->getPromiseTestAdapter();
 
56
 
 
57
        $adapter->settle();
 
58
        $adapter->promise()->otherwise($this->expectCallableNever());
 
59
    }
 
60
 
 
61
    /** @test */
 
62
    public function alwaysShouldReturnAPromiseForPendingPromise()
 
63
    {
 
64
        $adapter = $this->getPromiseTestAdapter();
 
65
 
 
66
        $this->assertInstanceOf('React\\Promise\\PromiseInterface', $adapter->promise()->always(function () {}));
 
67
    }
 
68
}