Completed
Push — fix-checkstyle ( 525678...700890 )
by
unknown
03:06
created

DownloadSpec::let()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 7
rs 9.4285
cc 1
eloc 5
nc 1
nop 2
1
<?php
2
3
namespace spec\Akeneo\Crowdin\Api;
4
5
use Akeneo\Crowdin\Client;
6
use Guzzle\Http\Client as HttpClient;
7
use Guzzle\Http\Message\Request;
8
use Guzzle\Http\Message\Response;
9
use PhpSpec\ObjectBehavior;
10
use Prophecy\Argument;
11
12
class DownloadSpec extends ObjectBehavior
13
{
14
    public function let(Client $client, HttpClient $http)
15
    {
16
        $client->getHttpClient()->willReturn($http);
17
        $client->getProjectIdentifier()->willReturn('akeneo');
18
        $client->getProjectApiKey()->willReturn('1234');
19
        $this->beConstructedWith($client);
20
    }
21
22
    public function it_should_be_an_api()
23
    {
24
        $this->shouldBeAnInstanceOf('Akeneo\Crowdin\Api\AbstractApi');
25
    }
26
27
    public function it_has_a_package_with_all_languages()
28
    {
29
        $this->setPackage('all.zip');
30
        $this->getPackage()->shouldReturn('all.zip');
31
    }
32
33
    public function it_has_a_package_with_one_language()
34
    {
35
        $this->setPackage('fr.zip');
36
        $this->getPackage()->shouldReturn('fr.zip');
37
    }
38
39
    public function it_has_a_copy_destination()
40
    {
41
        $this->setCopyDestination('/tmp/');
42
        $this->getCopyDestination()->shouldReturn('/tmp/');
43
    }
44
45 View Code Duplication
    public function it_downloads_all_translations(HttpClient $http, Request $request, Response $response)
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...
46
    {
47
        $this->setCopyDestination('/tmp');
48
        $this->setPackage('all.zip');
49
        $http->get('project/akeneo/download/all.zip?key=1234')->willReturn($request);
50
        $request->setResponseBody('/tmp/all.zip')->willReturn($request);
51
        $request->send()->willReturn($response);
52
        $response->getBody(true)->willReturn('bin');
53
        $this->execute()->shouldBe('bin');
54
    }
55
56 View Code Duplication
    public function it_downloads_french_translations(HttpClient $http, Request $request, Response $response)
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...
57
    {
58
        $this->setCopyDestination('/tmp');
59
        $this->setPackage('fr.zip');
60
        $http->get('project/akeneo/download/fr.zip?key=1234')->willReturn($request);
61
        $request->setResponseBody('/tmp/fr.zip')->willReturn($request);
62
        $request->send()->willReturn($response);
63
        $response->getBody(true)->willReturn('bin');
64
        $this->execute()->shouldBe('bin');
65
    }
66
}
67