Permalink
Browse files

try/catch, not isError

  • Loading branch information...
1 parent de4b0f3 commit 4e29cbbffa3a135e8f35f24e1e88bda0241c6443 @CloCkWeRX CloCkWeRX committed Jan 10, 2012
Showing with 13 additions and 4 deletions.
  1. +13 −4 tests/HTTP_Download2Test.php
@@ -28,8 +28,12 @@ function testsetFile()
$h = new HTTP_Download2;
$h->setFile(dirname(__FILE__) . '/data.txt');
$this->assertEquals(realpath(dirname(__FILE__) . '/data.txt'), $h->file, '$h->file == "data.txt');
- $this->assertTrue(PEAR::isError($h->setFile('nonexistant', false)), '$h->setFile("nonexistant")');
- unset($h);
+ try {
+ $h->setFile('nonexistant', false); // '$h->setFile("nonexistant")'
+
+ $this->fail("Expected a HTTP_Download2_Exception");
+ } catch (HTTP_Download2_Exception $e) {
+ }
}
function testsetData()
@@ -47,8 +51,13 @@ function testsetResource()
$this->assertEquals($f, $h->handle, '$h->handle == $f');
fclose($f); $f = -1;
- $this->assertTrue(PEAR::isError($h->setResource($f)), '$h->setResource($f = -1)');
- unset($h);
+
+ try {
+ $h->setResource($f); //, '$h->setResource($f = -1)');
+
+ $this->fail("Expected a HTTP_Download2_Exception");
+ } catch (HTTP_Download2_Exception $e) {
+ }
}
function testsetGzip()

0 comments on commit 4e29cbb

Please sign in to comment.