コード例 #1
0
 public function testManualInit()
 {
     Zend::__unsetRegistry();
     try {
         $registry = Zend::initRegistry('classdoesnotexist');
         $this->fail('Expected exception, because we cannot initialize the registry using a non-existent class.');
     } catch (Zend_Exception $e) {
         $this->assertRegexp('/class.not.found/i', $e->getMessage());
     }
     try {
         $registry = Zend::initRegistry('Zend');
         $this->fail('Expected exception, because we can only initialize the registry using an instance of ' . 'Zend_Registry (or a subclass).');
     } catch (Zend_Exception $e) {
         $this->assertRegexp('/not.*instanceof.*Zend_Registry/i', $e->getMessage());
     }
     try {
         $registry = Zend::initRegistry(new Zend());
         $this->fail('Expected exception, because we can only initialize the registry using an instance of ' . 'Zend_Registry (or a subclass).');
     } catch (Zend_Exception $e) {
         $this->assertRegexp('/not.*instanceof.*Zend_Registry/i', $e->getMessage());
     }
 }