Test Setup Failed
Branch master (97a7ce)
by Anton
02:01
created

WeatherTest::testGetWeatherErrorOther()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 6
nc 1
nop 0
dl 0
loc 12
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace EVB\Weather;
4
5
use Anax\DI\DIFactoryConfig;
0 ignored issues
show
Bug introduced by
The type Anax\DI\DIFactoryConfig was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use PHPUnit\Framework\TestCase;
7
8
/**
9
 * Test Weather for Weather.
10
 */
11
class WeatherTest extends TestCase
12
{
13
    /**
14
     * Test getWeather() method.
15
     * No errors.
16
     */
17
    public function testGetWeather()
18
    {
19
        $mockMultiCurl = new MockMultiCurl([[]]);
20
21
        $sut = new Weather("baseurl", $mockMultiCurl);
22
23
        $result = $sut->getWeather("test", "test");
24
25
        $this->assertInternalType("array", $result);
0 ignored issues
show
Deprecated Code introduced by
The function PHPUnit\Framework\Assert::assertInternalType() has been deprecated: https://github.com/sebastianbergmann/phpunit/issues/3369 ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

25
        /** @scrutinizer ignore-deprecated */ $this->assertInternalType("array", $result);

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
26
    }
27
28
    /**
29
     * Test getWeather() method.
30
     * Has error 400.
31
     */
32
    public function testGetWeatherError()
33
    {
34
        $mockMultiCurl = new MockMultiCurl([[
35
            "error" => "test",
36
            "code" => 400
37
        ]]);
38
39
        $sut = new Weather("baseurl", $mockMultiCurl);
40
41
        $result = $sut->getWeather("test", "test");
42
43
        $this->assertInternalType("string", $result);
0 ignored issues
show
Deprecated Code introduced by
The function PHPUnit\Framework\Assert::assertInternalType() has been deprecated: https://github.com/sebastianbergmann/phpunit/issues/3369 ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

43
        /** @scrutinizer ignore-deprecated */ $this->assertInternalType("string", $result);

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
44
    }
45
46
    /**
47
     * Test getWeather() method.
48
     * Has error, code != 400.
49
     */
50
    public function testGetWeatherErrorOther()
51
    {
52
        $mockMultiCurl = new MockMultiCurl([[
53
            "error" => "test",
54
            "code" => 404
55
        ]]);
56
57
        $sut = new Weather("baseurl", $mockMultiCurl);
58
59
        $result = $sut->getWeather("test", "test");
60
61
        $this->assertInternalType("string", $result);
0 ignored issues
show
Deprecated Code introduced by
The function PHPUnit\Framework\Assert::assertInternalType() has been deprecated: https://github.com/sebastianbergmann/phpunit/issues/3369 ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

61
        /** @scrutinizer ignore-deprecated */ $this->assertInternalType("string", $result);

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
62
    }
63
}
64