/** * @group ZF-8193 */ public function testWhenApplicationObjectUsedAsBootstrapTestCaseShouldExecuteBootstrapRunMethod() { $application = new Application\Application('testing', array('resources' => array('frontcontroller' => array('controllerDirectory' => __DIR__ . '/_files/application/controllers')))); $this->testCase->bootstrap = $application; $this->testCase->bootstrap(); $this->testCase->dispatch('/'); $front = $application->getBootstrap()->getResource('frontcontroller'); $boot = $front->getParam('bootstrap'); $type = is_object($boot) ? get_class($boot) : gettype($boot); $this->assertTrue($boot === $this->testCase->bootstrap->getBootstrap(), $type); }
/** * @group ZF-11425 */ public function testPassingStringYmlConfigPathOptionToConstructorShouldLoadOptionsAsYaml() { $application = new Application\Application('testing', __DIR__ . '/TestAsset/appconfig.yml'); $this->assertTrue($application->hasOption('foo')); }
/** * @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'); }
<?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();
public function testOptionsCanHandleMuiltipleConigFiles() { $application = new Application\Application('testing', array('config' => array(__DIR__ . '/TestAsset/Zf-6719-1.ini', __DIR__ . '/TestAsset/Zf-6719-2.ini'))); $this->assertEquals('baz', $application->getOption('foo')); }
/** * @group ZF-10898 */ public function testPassingArrayOptionsWithConfigKeyDistfileShouldLoadOptions() { $application = new Application\Application('testing', array('bar' => 'baz', 'config' => dirname(__FILE__) . '/_files/appconfig.ini.dist')); $this->assertTrue($application->hasOption('foo')); $this->assertTrue($application->hasOption('bar')); }