Skip to content

Commit

Permalink
Fix #18
Browse files Browse the repository at this point in the history
  • Loading branch information
dfridrich committed Nov 20, 2017
1 parent 27d657a commit c436cf9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/Ares.php
Expand Up @@ -127,6 +127,10 @@ public function findByIdentificationNumber($id)
$id = Lib::toInteger($id);
$this->ensureIdIsInteger($id);

if (empty($id)) {
throw new AresException('IČ firmy musí být zadáno.');
}

$cachedFileName = $id.'_'.date($this->cacheStrategy).'.php';
$cachedFile = $this->cacheDir.'/bas_'.$cachedFileName;
$cachedRawFile = $this->cacheDir.'/bas_raw_'.$cachedFileName;
Expand Down
10 changes: 9 additions & 1 deletion tests/AresTest.php
Expand Up @@ -22,7 +22,7 @@ public function testFindByIdentificationNumber()
$record = $this->ares->findByIdentificationNumber(73263753);
$this->assertSame('Dennis Fridrich', $record->getCompanyName());
$this->assertSame('CZ8508095453', $record->getTaxId());
$this->assertSame(73263753, $record->getCompanyId());
$this->assertSame('73263753', $record->getCompanyId());
$this->assertEmpty($record->getStreet());
$this->assertSame('15', $record->getStreetHouseNumber());
$this->assertEmpty($record->getStreetOrientationNumber());
Expand All @@ -44,6 +44,14 @@ public function testFindByIdentificationNumberException()
$this->ares->findByIdentificationNumber('A1234');
}

/**
* @expectedException \Defr\Ares\AresException
*/
public function testFindByEmptyStringException()
{
$this->ares->findByIdentificationNumber('');
}

public function testGetCompanyPeople()
{
if ($this->isTravis()) {
Expand Down

0 comments on commit c436cf9

Please sign in to comment.