diff options
author | mattab <matthieu.aubry@gmail.com> | 2015-06-16 08:33:52 +0300 |
---|---|---|
committer | mattab <matthieu.aubry@gmail.com> | 2015-06-16 08:33:52 +0300 |
commit | 6772518062f003e64d5420d985bd8d75ff2fd3d3 (patch) | |
tree | b041bfed92e7eb06ff2c8f778fdaf00973efa085 /tests/PHPUnit/Framework/Fixture.php | |
parent | 85a936e7c6b0dde8b4aa4324f31a7a4d1390ec28 (diff) |
Add sanity check and assert in tests, to make trouble shooting easier
Diffstat (limited to 'tests/PHPUnit/Framework/Fixture.php')
-rw-r--r-- | tests/PHPUnit/Framework/Fixture.php | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/PHPUnit/Framework/Fixture.php b/tests/PHPUnit/Framework/Fixture.php index 0cbd4e9394..f60a43e0c8 100644 --- a/tests/PHPUnit/Framework/Fixture.php +++ b/tests/PHPUnit/Framework/Fixture.php @@ -716,9 +716,16 @@ class Fixture extends \PHPUnit_Framework_Assert $outfileName = $deflatedOut . '.gz'; if (file_exists($deflatedOut)) { + $filesize = filesize($deflatedOut); + if($filesize == 0) { + throw new Exception("The file $deflatedOut is empty. Suggestion: delete it and try again."); + } + + // Valid geoip db found return; } + Log::warning("Geoip database $outfileName is not found. Downloading from $url..."); $dump = fopen($url, 'rb'); $outfile = fopen($outfileName, 'wb'); if(!$outfile) { |