Code Duplication    Length = 13-15 lines in 4 locations

tests/YahooWeatherClientTests.php 4 locations

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