Conditions | 1 |
Paths | 1 |
Total Lines | 34 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
55 | public function testSearch(): void |
||
56 | { |
||
57 | $rawResponse = <<<'EOD' |
||
58 | { |
||
59 | "cities" : [ { |
||
60 | "id" : "5357527", |
||
61 | "name" : "Hollywood", |
||
62 | "stateCode" : "CA", |
||
63 | "state" : "California", |
||
64 | "coords" : { |
||
65 | "long" : -118.3267434, |
||
66 | "lat" : 34.0983425 |
||
67 | }, |
||
68 | "country" : { |
||
69 | "code" : "US", |
||
70 | "name" : "United States" |
||
71 | } |
||
72 | } ], |
||
73 | "total" : 1, |
||
74 | "page" : 1, |
||
75 | "itemsPerPage" : 20 |
||
76 | } |
||
77 | EOD; |
||
78 | |||
79 | $this->connection->call('search/cities', ['p' => 1, 'name' => 'Hollywood']) |
||
80 | ->willReturn(json_decode($rawResponse, true)) |
||
81 | ; |
||
82 | |||
83 | $service = new CityService($this->connection->reveal()); |
||
84 | $result = $service->search(CitySearchBuilder::create() |
||
85 | ->withName('Hollywood')); |
||
86 | |||
87 | static::assertCount(1, $result->getResult()); |
||
88 | } |
||
89 | } |
||
90 |