|
|
@@ -584,4 +584,34 @@ class Zend_Gdata_AppTest extends PHPUnit_Framework_TestCase
|
|
|
$feed = $this->service->newFeed();
|
|
|
$this->assertEquals($v, $feed->getMinorProtocolVersion());
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * When error handler is overridden to throw an ErrorException, the extension loader
|
|
|
+ * in Zend_Gdata will throw an ErrorException when the class doesn't exist in the
|
|
|
+ * first extension directory even if it exists in subsequent ones. This test
|
|
|
+ * enforces a fix that keeps this from happening
|
|
|
+ *
|
|
|
+ * @group ZF-12268
|
|
|
+ * @group ZF-7013
|
|
|
+ */
|
|
|
+ public function testLoadExtensionCausesFatalErrorWhenErrorHandlerIsOverridden()
|
|
|
+ {
|
|
|
+ // Override the error handler to throw an ErrorException
|
|
|
+ set_error_handler(create_function('$a, $b, $c, $d', 'throw new ErrorException($b, 0, $a, $c, $d);'), E_ALL);
|
|
|
+ try {
|
|
|
+ $eq = $this->service->newEventQuery();
|
|
|
+ restore_error_handler();
|
|
|
+ $this->assertType('Zend_Gdata_Calendar_EventQuery', $eq);
|
|
|
+ } catch ( Zend_Gdata_App_Exception $ex ) {
|
|
|
+ // If we catch this exception, it means the ErrorException resulting
|
|
|
+ // from the include_once E_NOTICE was caught in the right place,
|
|
|
+ // but the extension was not found in any directory
|
|
|
+ // (Expected since we didn't load the Calendar extension dir)
|
|
|
+ restore_error_handler();
|
|
|
+ $this->assertContains('EventQuery', $ex->getMessage());
|
|
|
+ } catch ( ErrorException $ex ) {
|
|
|
+ restore_error_handler();
|
|
|
+ $this->fail('Did not expect ErrorException');
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|