Skip to content

Commit

Permalink
fixes: key does not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
williamdes committed Jul 3, 2018
1 parent 042d762 commit 69484ae
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Search.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ public static function getByName(string $name, int $type = Search::ANY): string
}

throw new Exception("$name does not exist for this type of documentation !");
} else {
throw new Exception("$name does not exist !");
}
}

Expand Down
14 changes: 14 additions & 0 deletions tests/SearchTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,18 @@ public function testException(): void
Search::getByName("mysql_native_password_proxy_users", Search::MARIADB);
}

/**
* test get by name not found variable
*
* @expectedException Exception
* @expectedExceptionCode 0
* @expectedExceptionMessageRegExp /(.+) does not exist !/
*
* @return void
*/
public function testExceptionNoFound(): void
{
Search::getByName("acbdefghi0202", Search::MARIADB);
}

}

0 comments on commit 69484ae

Please sign in to comment.