assertEquals('Zend_Cache_Core', get_class($generated_frontend)); } public function testFactoryCorrectCallWithCustomBackend() { $generated_frontend = Zend_Cache::factory('Core', 'FooBarTest', array(), array(), false, false, true); $this->assertEquals('Zend_Cache_Core', get_class($generated_frontend)); } public function testFactoryCorrectCallWithCustomBackend2() { $generated_frontend = Zend_Cache::factory('Core', 'FooBarTestBackend', array(), array(), false, true, true); $this->assertEquals('Zend_Cache_Core', get_class($generated_frontend)); } public function testFactoryCorrectCallWithCustomFrontend() { $generated_frontend = Zend_Cache::factory('FooBarTest', 'File', array(), array(), false, false, true); $this->assertEquals('Zend_Cache_Frontend_FooBarTest', get_class($generated_frontend)); } public function testFactoryCorrectCallWithCustomFrontend2() { $generated_frontend = Zend_Cache::factory('FooBarTestFrontend', 'File', array(), array(), true, false, true); $this->assertEquals('FooBarTestFrontend', get_class($generated_frontend)); } public function testFactoryLoadsPlatformBackend() { try { $cache = Zend_Cache::factory('Core', 'Zend-Platform'); } catch (Zend_Cache_Exception $e) { $message = $e->getMessage(); if (strstr($message, 'Incorrect backend')) { $this->fail('Zend Platform is a valid backend'); } } } public function testBadFrontend() { try { Zend_Cache::factory('badFrontend', 'File'); } catch (Zend_Exception $e) { return; } $this->fail('Zend_Exception was expected but not thrown'); } public function testBadBackend() { try { Zend_Cache::factory('Output', 'badBackend'); } catch (Zend_Exception $e) { return; } $this->fail('Zend_Exception was expected but not thrown'); } /** * @group ZF-11988 */ public function testNamespacedFrontendClassAccepted() { try { Zend_Cache::factory('ZF11988\Frontend', 'File', array(), array(), true, false, false); $this->fail('Zend_Cache_Exception was expected but not thrown'); } catch ( Zend_Cache_Exception $e ) { $this->assertNotEquals('Invalid frontend name [ZF11988\Frontend]', $e->getMessage()); } } /** * @group ZF-11988 */ public function testNamespacedBackendClassAccepted() { try { Zend_Cache::factory('Output', 'ZF11988\Backend', array(), array(), false, true, false); $this->fail('Zend_Cache_Exception was expected but not thrown'); } catch ( Zend_Cache_Exception $e ) { $this->assertNotEquals('Invalid backend name [ZF11988\Backend]', $e->getMessage()); } } }