Преглед на файлове

ZF-11184
Fixed unit test to include setExpectedException assertion


git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@23974 44c647ce-9c0f-0410-b52a-842ac1e357ba

ralph преди 14 години
родител
ревизия
e613763a83
променени са 1 файла, в които са добавени 8 реда и са изтрити 15 реда
  1. 8 15
      tests/Zend/Feed/ReaderTest.php

+ 8 - 15
tests/Zend/Feed/ReaderTest.php

@@ -325,22 +325,15 @@ class Zend_Feed_ReaderTest extends PHPUnit_Framework_TestCase
      */
     public function testImportingUriWithEmptyResponseBodyTriggersException()
     {
-        try
-        {
-            $currClient = Zend_Feed_Reader::getHttpClient();
-            $testAdapter = new Zend_Http_Client_Adapter_Test();
-            $testAdapter->setResponse(new Zend_Http_Response(200,array(),''));
-            Zend_Feed_Reader::setHttpClient(new Zend_Http_Client(null, array(
-                'adapter'=>$testAdapter
-            )));
-        } catch(Exception $e) {
-            $this->fail($e->getMessage());
-        }
+        $currClient = Zend_Feed_Reader::getHttpClient();
+        $testAdapter = new Zend_Http_Client_Adapter_Test();
+        $testAdapter->setResponse(new Zend_Http_Response(200,array(),''));
+        Zend_Feed_Reader::setHttpClient(new Zend_Http_Client(null, array(
+            'adapter'=>$testAdapter
+        )));
         
-        try {
-            $result = Zend_Feed_Reader::import('http://www.example.com');
-            $this->fail('Expected exception Zend_Feed_Exception on empty response body');
-        } catch (Zend_Feed_Exception $e) {}        
+        $this->setExpectedException('Zend_Feed_Exception', 'Feed failed to load');
+        $result = Zend_Feed_Reader::import('http://www.example.com');
     }
 
     protected function _getTempDirectory()