/** * @group ZF2-38 */ public function testContinueResourceExecutingByModulesResource() { define('APPLICATION_PATH_ZF2_38', __DIR__); $application = new Application\Application('testing', __DIR__ . '/TestAsset/Zf2-38.ini'); $application->bootstrap(); $broker = $application->getBootstrap()->getBroker(); $modulesInitTitme = $broker->load('zf38modules')->getInitTime(); $zf38InitTitme = $broker->load('zf38')->getInitTime(); $this->assertFalse($modulesInitTitme > $zf38InitTitme, 'Modules execute resources before end of their bootstraps'); }
/** * @group ZF-6618 */ public function testCanExecuteBoostrapResourceViaApplicationInstanceBootstrapMethod() { $application = new Application\Application('testing', array('bootstrap' => array('path' => __DIR__ . '/TestAsset/ZfAppBootstrap.php', 'class' => 'ZendTest\\Application\\TestAsset\\ZfAppBootstrap'))); $application->bootstrap('foo'); $this->assertEquals(1, $application->getBootstrap()->fooExecuted); $this->assertEquals(0, $application->getBootstrap()->barExecuted); }
<?php ini_set('display_errors', 1); // Define the application path defined('APPLICATION_PATH') || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application')); define('DOCTRINE_PATH', realpath(dirname(__FILE__) . '/../lib/doctrine2/lib')); define('ZEND_PATH', realpath(dirname(__FILE__) . '/../lib/zf2/library')); define('BBM_PATH', realpath(dirname(__FILE__) . '/../')); define('PROXYDIR', realpath(dirname(__FILE__) . '/../tools/generatedProxies')); // Define application environment defined('APPLICATION_ENV') || define('APPLICATION_ENV', getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'development'); set_include_path(implode(PATH_SEPARATOR, array(realpath(APPLICATION_PATH), ZEND_PATH, BBM_PATH, DOCTRINE_PATH, DOCTRINE_PATH . '/vendor/doctrine-common/lib', DOCTRINE_PATH . '/vendor/doctrine-dbal/lib', DOCTRINE_PATH . '/vendor/', get_include_path()))); require_once 'Zend/Application/Application.php'; use Zend\Application\Application; $application = new Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini'); $application->bootstrap()->run();