Completed
Push — master ( 463d73...47ba96 )
by Gerrit
02:04
created

ArgumentCallTest::shouldResolveCallArgument()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 24

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 24
rs 9.536
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
/**
3
 * Copyright (C) 2017  Gerrit Addiks.
4
 * This package (including this file) was released under the terms of the GPL-3.0.
5
 * You should have received a copy of the GNU General Public License along with this program.
6
 * If not, see <http://www.gnu.org/licenses/> or send me a mail so i can send you a copy.
7
 * @license GPL-3.0
8
 * @author Gerrit Addiks <[email protected]>
9
 */
10
11
namespace Addiks\SymfonyGenerics\Tests\Unit\Arguments;
12
13
use PHPUnit\Framework\TestCase;
14
use Addiks\SymfonyGenerics\Arguments\ArgumentCall;
15
use Addiks\SymfonyGenerics\Arguments\Argument;
16
17
final class ArgumentCallTest extends TestCase
18
{
19
20
    /**
21
     * @test
22
     */
23
    public function shouldResolveCallArgument()
24
    {
25
        /** @var Argument $callee */
26
        $callee = $this->createMock(Argument::class);
27
        $callee->method("resolve")->willReturn($this);
0 ignored issues
show
Bug introduced by
The method method() does not seem to exist on object<Addiks\SymfonyGenerics\Arguments\Argument>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
28
29
        /** @var Argument $argumentA */
30
        $argumentA = $this->createMock(Argument::class);
31
        $argumentA->method("resolve")->willReturn("some-foo");
0 ignored issues
show
Bug introduced by
The method method() does not seem to exist on object<Addiks\SymfonyGenerics\Arguments\Argument>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
32
33
        /** @var Argument $argumentB */
34
        $argumentB = $this->createMock(Argument::class);
35
        $argumentB->method("resolve")->willReturn(31415);
0 ignored issues
show
Bug introduced by
The method method() does not seem to exist on object<Addiks\SymfonyGenerics\Arguments\Argument>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
36
37
        $subject = new ArgumentCall($callee, "someMethod", [
38
            $argumentA,
39
            $argumentB
40
        ]);
41
42
        /** @var mixed $actualResult */
43
        $actualResult = $subject->resolve();
44
45
        $this->assertEquals("some-result", $actualResult);
46
    }
47
48
    public function someMethod(string $foo, int $bar): string
49
    {
50
        $this->assertEquals("some-foo", $foo);
51
        $this->assertEquals(31415, $bar);
52
        return "some-result";
53
    }
54
55
}
56