Code Duplication    Length = 13-15 lines in 4 locations

tests/YahooWeatherClientTests.php 4 locations

@@ 20-32 (lines=13) @@
17
class YahooWeatherClientTests extends TestCase
18
{
19
    /** @test */
20
    public function testCallApiWoeidException()
21
    {
22
        $service = new YahooWeatherAPI();
23
24
        $this->expectException(\Exception::class);
25
26
        try {
27
            $response = $service->callApiWoeid(null);
28
        } catch (\Exception $e) {
29
            throw $e;
30
        }
31
    }
32
33
    /** @test */
34
    public function testCallApiCityNameException()
35
    {
@@ 34-46 (lines=13) @@
31
    }
32
33
    /** @test */
34
    public function testCallApiCityNameException()
35
    {
36
        $service = new YahooWeatherAPI();
37
38
        $this->expectException(\Exception::class);
39
40
        try {
41
            $response = $service->callApiCityName(null);
42
        } catch (\Exception $e) {
43
            throw $e;
44
        }
45
    }
46
47
    /** @test */
48
    public function testCallApiTestException()
49
    {
@@ 48-60 (lines=13) @@
45
    }
46
47
    /** @test */
48
    public function testCallApiTestException()
49
    {
50
        $service = new YahooWeatherAPI();
51
52
        $this->expectException(\Exception::class);
53
54
        try {
55
            $response = $service->callApi(null);
56
        } catch (\Exception $e) {
57
            throw $e;
58
        }
59
    }
60
61
    /** @test */
62
    public function testCallApiLastRes()
63
    {
@@ 62-76 (lines=15) @@
59
    }
60
61
    /** @test */
62
    public function testCallApiLastRes()
63
    {
64
        $errYql = 'https://query.yahooapis.com/v1/public/yql?q=from%20weather.forecast%20where%20woeid%20in%20(select%20woeid%20from%20geo.places(1)%20where%20text=%22Taipei%22)&format=json&env=store://datatables.org/alltableswithkeys';
65
66
        $service = new YahooWeatherAPI();
67
68
        $this->expectException(\Exception::class);
69
70
        try {
71
            $response = $service->callApi($errYql);
72
        } catch (\Exception $e) {
73
            throw $e;
74
        }
75
    }
76
77
    /** @test */
78
    public function setClientTest()
79
    {