Skip to content

Commit

Permalink
test address with flat
Browse files Browse the repository at this point in the history
  • Loading branch information
glendemon committed May 18, 2016
1 parent 5bd4098 commit 05cecb0
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/DadataSuggestionsServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,29 @@ public function testSuggestAddressSimple()
}
}

public function testSuggestAddressFlat()
{
$service = $this->getService();
$response = $service->suggestAddress('мск балтийская 6к1 5');
$this->assertNotEmpty($response);
$this->assertInstanceOf(\DadataSuggestions\Response::class, $response);
$this->assertNotEmpty($response->getSuggestions());
$this->assertInternalType('array', $response->getSuggestions());
foreach ($response->getSuggestions() as $suggestion) {
$this->assertEquals('г Москва, ул Балтийская, д 6 к 1, кв 5', $suggestion->getValue());
$this->assertEquals('г Москва, ул Балтийская, д 6 к 1, кв 5', $suggestion->getUnrestrictedValue());
/** @var \DadataSuggestions\Data\Address $data */
$data = $suggestion->getData();
$this->assertInstanceOf(\DadataSuggestions\Data\Address::class, $data);
$this->assertEquals('Россия', $data->country);
$this->assertEquals('Москва', $data->city);
$this->assertEquals('ул Балтийская', $data->street_with_type);
$this->assertEquals('6', $data->house);
$this->assertEquals('1', $data->block);
$this->assertEquals('5', $data->flat);
}
}

/**
* @return \DadataSuggestions\DadataSuggestionsService
*/
Expand Down

0 comments on commit 05cecb0

Please sign in to comment.