Code Duplication    Length = 13-15 lines in 4 locations

tests/YahooWeatherClientTests.php 4 locations

@@ 21-33 (lines=13) @@
18
class YahooWeatherClientTests extends TestCase
19
{
20
    /** @test */
21
    public function testCallApiWoeidException()
22
    {
23
        $service = new YahooWeatherAPI();
24
25
        $this->expectException(\Exception::class);
26
27
        try {
28
            $response = $service->callApiWoeid(null);
29
        } catch (\Exception $e) {
30
            throw $e;
31
        }
32
    }
33
34
    /** @test */
35
    public function testCallApiCityNameException()
36
    {
@@ 35-47 (lines=13) @@
32
    }
33
34
    /** @test */
35
    public function testCallApiCityNameException()
36
    {
37
        $service = new YahooWeatherAPI();
38
39
        $this->expectException(\Exception::class);
40
41
        try {
42
            $response = $service->callApiCityName(null);
43
        } catch (\Exception $e) {
44
            throw $e;
45
        }
46
    }
47
48
    /** @test */
49
    public function testCallApiTestException()
50
    {
@@ 49-61 (lines=13) @@
46
    }
47
48
    /** @test */
49
    public function testCallApiTestException()
50
    {
51
        $service = new YahooWeatherAPI();
52
53
        $this->expectException(\Exception::class);
54
55
        try {
56
            $response = $service->callApi(null);
57
        } catch (\Exception $e) {
58
            throw $e;
59
        }
60
    }
61
62
    /** @test */
63
    public function testCallApiLastRes()
64
    {
@@ 63-77 (lines=15) @@
60
    }
61
62
    /** @test */
63
    public function testCallApiLastRes()
64
    {
65
        $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';
66
67
        $service = new YahooWeatherAPI();
68
69
        $this->expectException(\Exception::class);
70
71
        try {
72
            $response = $service->callApi($errYql);
73
        } catch (\Exception $e) {
74
            throw $e;
75
        }
76
    }
77
78
    /** @test */
79
    public function setClientTest()
80
    {