ExportSpec::it_builds_last_translations()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 7
Ratio 100 %

Importance

Changes 0
Metric Value
dl 7
loc 7
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 3
1
<?php
2
3
namespace spec\Akeneo\Crowdin\Api;
4
5
use Akeneo\Crowdin\Client;
6
use GuzzleHttp\Client as HttpClient;
7
use GuzzleHttp\Psr7\Request;
8
use GuzzleHttp\Psr7\Response;
9
use PhpSpec\ObjectBehavior;
10
use Prophecy\Argument;
11
12
class ExportSpec 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 View Code Duplication
    public function it_builds_last_translations(HttpClient $http, Request $request, Response $response)
0 ignored issues
show
Unused Code introduced by
The parameter $request is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
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...
28
    {
29
        $content = '<?xml version="1.0" encoding="ISO-8859-1"?><success status="built"></success>';
30
        $response->getBody()->willReturn($content);
31
        $http->get('project/akeneo/export?key=1234')->willReturn($response);
32
        $this->execute()->shouldBe($content);
33
    }
34
35 View Code Duplication
    public function it_skips_build_if_less_than_half_an_hour(HttpClient $http, Request $request, Response $response)
0 ignored issues
show
Unused Code introduced by
The parameter $request is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
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...
36
    {
37
        $content = '<?xml version="1.0" encoding="ISO-8859-1"?><success status="skipped"></success>';
38
        $response->getBody()->willReturn($content);
39
        $http->get('project/akeneo/export?key=1234')->willReturn($response);
40
        $this->execute()->shouldBe($content);
41
    }
42
}
43