Code Duplication    Length = 13-15 lines in 4 locations

tests/YahooWeatherClientTests.php 4 locations

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