Code Duplication    Length = 20-23 lines in 2 locations

test/Service/FileSenderTest.php 2 locations

@@ 26-45 (lines=20) @@
23
     * @param string $type type of request to test
24
     * @return void
25
     */
26
    public function testSenderDoesPlainRequestWithoutUploadField($type)
27
    {
28
        $method = 'PUT';
29
        $uri = 'http://localhost/file/example';
30
        $options = [];
31
32
        $clientMock = $this->getMockBuilder('GuzzleHttp\Client')->getMock();
33
34
        $promiseMock = $this->createMock('GuzzleHttp\Promise\Promise');
35
36
        $clientMock
37
            ->method($type)
38
            ->with($method, $uri, $options)
39
            ->will($this->returnValue($promiseMock));
40
41
        $sut = new FileSender(
42
            $clientMock
43
        );
44
        $this->assertEquals($promiseMock, $sut->$type($method, $uri, $options));
45
    }
46
47
    /**
48
     * checks if FileSender does nothing if it gets a falsy file path
@@ 59-81 (lines=23) @@
56
     * @param string $type type of request to test
57
     * @return void
58
     */
59
    public function testSenderDoesPlainRequestWithFalsyUploadField($type)
60
    {
61
        $method = 'PUT';
62
        $uri = 'http://localhost/file/example';
63
        $options = [
64
            'upload' => ''
65
        ];
66
        $expectedOptions = [];
67
68
        $clientMock = $this->getMockBuilder('GuzzleHttp\Client')->getMock();
69
70
        $promiseMock = $this->createMock('GuzzleHttp\Promise\Promise');
71
72
        $clientMock
73
            ->method($type)
74
            ->with($method, $uri, $expectedOptions)
75
            ->will($this->returnValue($promiseMock));
76
77
        $sut = new FileSender(
78
            $clientMock
79
        );
80
        $this->assertEquals($promiseMock, $sut->$type($method, $uri, $options));
81
    }
82
83
    /**
84
     * test if FileSender excepts to being called without json in upload cases