ObservableResolverTestCase::testResolve()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 10

Duplication

Lines 15
Ratio 100 %

Importance

Changes 0
Metric Value
dl 15
loc 15
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 10
nc 1
nop 0
1
<?php
2
3
/**
4
 * This file is part of the Cubiche package.
5
 *
6
 * Copyright (c) Cubiche
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
namespace Cubiche\Core\Async\Tests\Units\Promise;
12
13
/**
14
 * Observable Resolver Test Case class.
15
 *
16
 * @author Karel Osorio Ramírez <[email protected]>
17
 */
18
abstract class ObservableResolverTestCase extends ResolverTestCase
19
{
20
    /**
21
     * Test resolve.
22
     */
23 View Code Duplication
    public function testResolve()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
24
    {
25
        $this
26
            ->given(
27
                $resolveCallback = $this->delegateMockWithReturn('bar'),
28
                /** @var \Cubiche\Core\Async\Promise\ObservableResolver $resolver */
29
                $resolver = $this->newTestedInstance($resolveCallback)
30
            )
31
            ->when($resolver->resolve('foo'))
32
            ->then()
33
                ->delegateCall($resolveCallback)
34
                    ->withArguments('foo')
35
                    ->once()
36
        ;
37
    }
38
39
    /**
40
     * Test reject.
41
     */
42 View Code Duplication
    public function testReject()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
43
    {
44
        $this
45
            ->given(
46
                $reason = new \Exception(),
47
                $rejectCallback = $this->delegateMock(),
48
                /** @var \Cubiche\Core\Async\Promise\ObservableResolver $resolver */
49
                $resolver = $this->newTestedInstance(null, $rejectCallback)
50
            )
51
            ->when($resolver->reject($reason))
52
            ->then()
53
                ->delegateCall($rejectCallback)
54
                    ->withArguments($reason)
55
                    ->once()
56
        ;
57
    }
58
59
    /**
60
     * Test notify.
61
     */
62 View Code Duplication
    public function testNotify()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
63
    {
64
        $this
65
            ->given(
66
                $notifyCallback = $this->delegateMock(),
67
                /** @var \Cubiche\Core\Async\Promise\ObservableResolver $resolver */
68
                $resolver = $this->newTestedInstance(null, null, $notifyCallback)
69
            )
70
            ->when($resolver->notify('foo'))
71
            ->then()
72
                ->delegateCall($notifyCallback)
73
                    ->withArguments('foo')
74
                    ->once()
75
        ;
76
    }
77
}
78