Completed
Pull Request — master (#189)
by Robbie
02:42 queued 01:08
created

testErrorWhenModuleNotFound()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 6

Duplication

Lines 10
Ratio 100 %

Importance

Changes 0
Metric Value
dl 10
loc 10
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 6
nc 1
nop 0
1
<?php
2
3
/**
4
 * @mixin PHPUnit_Framework_TestCase
5
 */
6
class RatingApiControllerTest extends FunctionalTest
7
{
8
    protected static $fixture_file = 'RatingApiControllerTest.yml';
9
10 View Code Duplication
    public function testErrorWhenMissingParams()
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...
11
    {
12
        $response = $this->get('api/rating');
13
14
        $this->assertJson($response->getBody());
0 ignored issues
show
Bug introduced by
The method assertJson() does not seem to exist on object<RatingApiControllerTest>.

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...
15
16
        $result = json_decode($response->getBody());
17
        $this->assertFalse($result->success);
0 ignored issues
show
Bug introduced by
The method assertFalse() does not seem to exist on object<RatingApiControllerTest>.

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...
18
        $this->assertContains('Missing', $result->message);
19
    }
20
21 View Code Duplication
    public function testErrorWhenModuleNotFound()
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...
22
    {
23
        $response = $this->get('api/rating/bar/baz');
24
25
        $this->assertJson($response->getBody());
0 ignored issues
show
Bug introduced by
The method assertJson() does not seem to exist on object<RatingApiControllerTest>.

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...
26
27
        $result = json_decode($response->getBody());
28
        $this->assertFalse($result->success);
0 ignored issues
show
Bug introduced by
The method assertFalse() does not seem to exist on object<RatingApiControllerTest>.

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...
29
        $this->assertContains('not be found', $result->message);
30
    }
31
32 View Code Duplication
    public function testResponseIncludesRating()
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...
33
    {
34
        $response = $this->get('api/rating/foo/bar');
35
36
        $this->assertJson($response->getBody());
0 ignored issues
show
Bug introduced by
The method assertJson() does not seem to exist on object<RatingApiControllerTest>.

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...
37
38
        $result = json_decode($response->getBody());
39
        $this->assertTrue($result->success);
0 ignored issues
show
Bug introduced by
The method assertTrue() does not seem to exist on object<RatingApiControllerTest>.

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...
40
        $this->assertSame(53, $result->rating);
0 ignored issues
show
Bug introduced by
The method assertSame() does not seem to exist on object<RatingApiControllerTest>.

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...
41
    }
42
43 View Code Duplication
    public function testDetailedResponse()
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...
44
    {
45
        $response = $this->get('api/rating/foo/bar?detailed');
46
47
        $this->assertJson($response->getBody());
0 ignored issues
show
Bug introduced by
The method assertJson() does not seem to exist on object<RatingApiControllerTest>.

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...
48
49
        $result = json_decode($response->getBody());
50
        $this->assertTrue($result->success);
0 ignored issues
show
Bug introduced by
The method assertTrue() does not seem to exist on object<RatingApiControllerTest>.

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...
51
        $this->assertSame(3, $result->metrics->coverage);
0 ignored issues
show
Bug introduced by
The method assertSame() does not seem to exist on object<RatingApiControllerTest>.

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...
52
    }
53
}
54