@@ 9-47 (lines=39) @@ | ||
6 | ||
7 | use Marek\OpenWeatherMap\Http\Client\SymfonyHttpClient; |
|
8 | ||
9 | describe(SymfonyHttpClient::class, function () { |
|
10 | beforeEach(function () { |
|
11 | $this->data = '{"coord":{"lon":-0.13,"lat":51.51},"weather":[{"id":300,"main":"Drizzle","description":"light intensity drizzle","icon":"09d"}],"base":"stations","main":{"temp":280.32,"pressure":1012,"humidity":81,"temp_min":279.15,"temp_max":281.15},"visibility":10000,"wind":{"speed":4.1,"deg":80},"clouds":{"all":90},"dt":1485789600,"sys":{"type":1,"id":5091,"message":0.0103,"country":"GB","sunrise":1485762037,"sunset":1485794875},"id":2643743,"name":"London","cod":200}'; |
|
12 | $this->decoded = json_decode($this->data, true, 512, JSON_THROW_ON_ERROR); |
|
13 | $this->response = new JsonResponse($this->data, 300); |
|
14 | }); |
|
15 | ||
16 | describe('->getStatusCode()', function () { |
|
17 | it('expects that it will return proper http status code', function () { |
|
18 | expect($this->response->getStatusCode())->toBe(200); |
|
19 | }); |
|
20 | }); |
|
21 | ||
22 | describe('->getData()', function () { |
|
23 | it('expects that', function () { |
|
24 | expect($this->response->getData())->toBe($this->decoded); |
|
25 | }); |
|
26 | }); |
|
27 | ||
28 | describe('->isOk()', function () { |
|
29 | it('expects that', function () { |
|
30 | expect($this->response->isOk())->toBe(true); |
|
31 | }); |
|
32 | }); |
|
33 | ||
34 | describe('->isAuthorized()', function () { |
|
35 | it('expects that', function () { |
|
36 | expect($this->response->isAuthorized())->toBe(true); |
|
37 | }); |
|
38 | }); |
|
39 | ||
40 | describe('->getMessage()', function () { |
|
41 | it('expects that', function () { |
|
42 | expect($this->response->getMessage())->toBe(''); |
|
43 | }); |
|
44 | }); |
|
45 | }); |
|
46 |
@@ 9-47 (lines=39) @@ | ||
6 | ||
7 | use Marek\OpenWeatherMap\Http\Response\JsonResponse; |
|
8 | ||
9 | describe(JsonResponse::class, function () { |
|
10 | beforeEach(function () { |
|
11 | $this->data = '{"coord":{"lon":-0.13,"lat":51.51},"weather":[{"id":300,"main":"Drizzle","description":"light intensity drizzle","icon":"09d"}],"base":"stations","main":{"temp":280.32,"pressure":1012,"humidity":81,"temp_min":279.15,"temp_max":281.15},"visibility":10000,"wind":{"speed":4.1,"deg":80},"clouds":{"all":90},"dt":1485789600,"sys":{"type":1,"id":5091,"message":0.0103,"country":"GB","sunrise":1485762037,"sunset":1485794875},"id":2643743,"name":"London","cod":200}'; |
|
12 | $this->decoded = json_decode($this->data, true, 512, JSON_THROW_ON_ERROR); |
|
13 | $this->response = new JsonResponse($this->data, 300); |
|
14 | }); |
|
15 | ||
16 | describe('->getStatusCode()', function () { |
|
17 | it('expects that it will return proper http status code', function () { |
|
18 | expect($this->response->getStatusCode())->toBe(200); |
|
19 | }); |
|
20 | }); |
|
21 | ||
22 | describe('->getData()', function () { |
|
23 | it('expects that', function () { |
|
24 | expect($this->response->getData())->toBe($this->decoded); |
|
25 | }); |
|
26 | }); |
|
27 | ||
28 | describe('->isOk()', function () { |
|
29 | it('expects that', function () { |
|
30 | expect($this->response->isOk())->toBe(true); |
|
31 | }); |
|
32 | }); |
|
33 | ||
34 | describe('->isAuthorized()', function () { |
|
35 | it('expects that', function () { |
|
36 | expect($this->response->isAuthorized())->toBe(true); |
|
37 | }); |
|
38 | }); |
|
39 | ||
40 | describe('->getMessage()', function () { |
|
41 | it('expects that', function () { |
|
42 | expect($this->response->getMessage())->toBe(''); |
|
43 | }); |
|
44 | }); |
|
45 | }); |
|
46 |