示例#1
0
 public function qsBootstrap()
 {
     $this->application->bootstrap();
     $bootstrap = $this->application->getBootstrap();
     $frontController = $bootstrap->getResource('FrontController');
     $frontController->setParam('bootstrap', $bootstrap);
     $configApplication = $this->application->bootstrap('config');
     $requestConfig = $configApplication->getOption('request');
     $this->requestParameterName = $requestConfig['parameter'];
 }
示例#2
0
 public function _before(\Codeception\TestCase $test)
 {
     $this->bootstrap = new \Zend_Application($this->config['env'], getcwd() . DIRECTORY_SEPARATOR . $this->config['config']);
     $this->bootstrap->bootstrap();
     $this->client->setBootstrap($this->bootstrap);
     $db = $this->bootstrap->getBootstrap()->getResource('db');
     if ($db instanceof \Zend_Db_Adapter_Abstract) {
         $this->db = $db;
         $this->db->getProfiler()->setEnabled(true);
         $this->db->getProfiler()->clear();
     }
 }
示例#3
0
 public function setUp()
 {
     $application = new Zend_Application('testing', APPLICATION_PATH . '/configs/application.ini');
     $bootstrap = $application->bootstrap()->getBootstrap();
     $this->em = $bootstrap->getResource('entityManager');
     parent::setUp();
 }
示例#4
0
 public function testBootstrap()
 {
     $application = new Zend_Application('tests', dirname(__FILE__) . '/application.ini');
     $rediska = $application->bootstrap()->getBootstrap()->getResource('rediska');
     $this->assertType('Rediska', $rediska);
     $this->assertEquals('Rediska_Test_', $rediska->getOption('namespace'));
 }
示例#5
0
 public function testBootstrap()
 {
     $application = new Zend_Application('tests', REDISKA_TESTS_PATH . '/Test/Zend/Application/application.ini');
     $rediska = $application->bootstrap()->getBootstrap()->getResource('rediska');
     $this->assertType('Rediska', $rediska);
     $this->assertEquals('Rediska_Test_', $rediska->getOption('namespace'));
 }
示例#6
0
 /**
  * Prepares the environment before running ALL tests.
  */
 public static function setUpBeforeClass()
 {
     // Inicializa o ZF
     $inifile = getenv('TRAVIS') !== false ? 'application.travis.ini' : 'application.ini';
     $bootstrap = new Zend_Application('testing', TEST_ROOT . '/assets/application/configs/' . $inifile);
     $bootstrap->bootstrap();
 }
示例#7
0
 /**
  * Overwrite standard setUp method, no database connection needed.  Will
  * create a file listing of class files instead.
  *
  * @return void
  */
 public function setUp()
 {
     require_once 'Zend/Application.php';
     set_include_path('../modules' . PATH_SEPARATOR . get_include_path());
     // Do test environment initializiation.
     $application = new Zend_Application(APPLICATION_ENV, array("config" => array(APPLICATION_PATH . '/application/configs/application.ini', APPLICATION_PATH . '/tests/config.ini')));
     $application->bootstrap();
 }
示例#8
0
 public function testNewInstance()
 {
     $application = new Zend_Application('tests', dirname(__FILE__) . '/application4.ini');
     $application->bootstrap()->getBootstrap()->getResource('session');
     $rediska = Zend_Session::getSaveHandler()->getRediska();
     $this->assertEquals('default', $rediska->getOption('name'));
     $this->assertEquals(array(), Rediska_Manager::getAll());
 }
示例#9
0
 public function testCleanWithNoIdsToClean()
 {
     $application = new Zend_Application('tests', dirname(__FILE__) . '/application5.ini');
     /* @var Zend_Cache_Manager $manager */
     $manager = $application->bootstrap()->getBootstrap()->getResource('cachemanager');
     $actual = $manager->getCache('test')->clean(Zend_Cache::CLEANING_MODE_ALL);
     $this->assertFalse($actual);
 }
示例#10
0
 protected function setUp()
 {
     parent::setUp();
     $app = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . "/configs/application.ini");
     $app->bootstrap('translate');
     $this->translate = $app->getBootstrap()->getResource('translate');
     $this->translate->setLocale(new Zend_Locale('vi_VN'));
 }
示例#11
0
 public function _before(\Codeception\TestCase $test)
 {
     // Create application, bootstrap, and run
     $this->bootstrap = new \Engine_Application(array('environment' => APPLICATION_ENV, 'bootstrap' => array('path' => APPLICATION_PATH_COR . DS . 'modules' . DS . APPLICATION_NAME . DS . 'Bootstrap.php', 'class' => ucfirst(APPLICATION_NAME) . '_Bootstrap'), 'autoloaderNamespaces' => array('Zend' => APPLICATION_PATH_LIB . DS . 'Zend', 'Engine' => APPLICATION_PATH_LIB . DS . 'Engine', 'Facebook' => APPLICATION_PATH_LIB . DS . 'Facebook', 'Bootstrap' => APPLICATION_PATH_BTS, 'Plugin' => APPLICATION_PATH_PLU, 'Widget' => APPLICATION_PATH_WID)));
     \Zend_Session::$_unitTestEnabled = true;
     \Engine_Application::setInstance($this->bootstrap);
     \Engine_Api::getInstance()->setApplication($this->bootstrap);
     $this->bootstrap->bootstrap();
     $this->client->setBootstrap($this->bootstrap);
 }
示例#12
0
 public function testNewInstance()
 {
     $application = new Zend_Application('tests', dirname(__FILE__) . '/application4.ini');
     $manager = $application->bootstrap()->getBootstrap()->getResource('cachemanager');
     $manager->getCache('test')->save('1', 'test');
     $rediska = new Rediska(array('redisVersion' => '2.0', 'addToManager' => false));
     $one = $rediska->get('test');
     $this->assertEquals('1', $one[0]);
     $this->assertEquals(array(), Rediska_Manager::getAll());
 }
示例#13
0
 public function testNewInstance()
 {
     $application = new Zend_Application('tests', dirname(__FILE__) . '/application4.ini');
     $log = $application->bootstrap()->getBootstrap()->getResource('log');
     $log->err('123');
     $log->info('123');
     $rediska = new Rediska(array('redisVersion' => '2.0', 'addToManager' => false));
     $count = $rediska->getListLength('log');
     $this->assertEquals(2, $count);
     $this->assertEquals(array(), Rediska_Manager::getAll());
 }
示例#14
0
 public function testDefaultAndAnother()
 {
     $application = new Zend_Application('tests', dirname(__FILE__) . '/application4.ini');
     $application->bootstrap()->getBootstrap()->getResource('rediska');
     $default = Rediska_Manager::get('default');
     $this->assertEquals('defaultInstance', $default->getOption('namespace'));
     $another = Rediska_Manager::get('another');
     $this->assertEquals('anotherInstance', $another->getOption('namespace'));
     $this->assertEquals(2, count(Rediska_Manager::getAll()));
     $this->assertEquals($default, Zend_Registry::get('rediska'));
 }
示例#15
0
 public static function bootstrap()
 {
     // Define path to application directory
     defined('APPLICATION_PATH') || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
     // Define application environment
     defined('APPLICATION_ENV') || define('APPLICATION_ENV', getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'testing');
     !defined('UPLOAD_PATH') ? define('UPLOAD_PATH', realpath(dirname(__FILE__) . '/../public/upload')) : null;
     defined('HTTP_PATH') || define('HTTP_PATH', realpath(dirname(__FILE__)) . '/../public');
     require_once 'Zend/Application.php';
     $application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini');
     $application->bootstrap();
 }
示例#16
0
文件: ZF1.php 项目: gargallo/tfs-test
 public function _before(\Codeception\TestCase $test)
 {
     \Zend_Session::$_unitTestEnabled = true;
     $this->bootstrap = new \Zend_Application($this->config['env'], Configuration::projectDir() . $this->config['config']);
     $this->bootstrap->bootstrap();
     $this->client->setBootstrap($this->bootstrap);
     $db = $this->bootstrap->getBootstrap()->getResource('db');
     if ($db instanceof \Zend_Db_Adapter_Abstract) {
         $this->db = $db;
         $this->db->getProfiler()->setEnabled(true);
         $this->db->getProfiler()->clear();
     }
 }
示例#17
0
 /**
  * Init Application
  */
 public static function appInit()
 {
     $config = APPLICATION_PATH . '/configs/application.yaml';
     $result = new Core_Config_Yaml($config, APPLICATION_ENV);
     $result = $result->toArray();
     // Create application, bootstrap, and run
     $application = new Zend_Application(APPLICATION_ENV, $result);
     //        $application->bootstrap();
     //        $application->bootstrap('Frontcontroller');
     $application->bootstrap();
     $acl = new Core_Controller_Plugin_Acl();
     $acl->getAcl();
     self::migrationUp();
 }
示例#18
0
 public function setUp()
 {
     parent::setUp();
     $config = new \Zend_Config_Ini(APPLICATION_PATH . '/configs/application.ini', null, true);
     $system_ini = new \Zend_Config_Ini('/var/yujiaqu.ini');
     $config->merge($system_ini);
     $application = new Zend_Application(APPLICATION_ENV, $config->get(APPLICATION_ENV));
     $application->bootstrap();
     $this->_bootstrap = $application->getBootstrap();
     // manually init Zend_Controller_Front, otherwise, it is not inited in testing environment
     $this->_bootstrap->getResource('FrontController')->setParam('bootstrap', $this->_bootstrap);
     $this->_angel_bootstrap = $this->_bootstrap->getResource('modules')->offsetGet('angel');
     $this->_container = $this->_bootstrap->getResource('serviceContainer');
     $this->_documentManager = $this->_angel_bootstrap->getResource('mongoDocumentManager');
     $this->_logger = $this->_bootstrap->getResource('logger');
 }
示例#19
0
文件: ZF1.php 项目: corcre/elabftw
 public function _before(TestCase $test)
 {
     \Zend_Session::$_unitTestEnabled = true;
     try {
         $this->bootstrap = new \Zend_Application($this->config['env'], Configuration::projectDir() . $this->config['config']);
     } catch (\Exception $e) {
         throw new ModuleException(__CLASS__, $e->getMessage());
     }
     $this->bootstrap->bootstrap();
     $this->client->setBootstrap($this->bootstrap);
     $db = $this->bootstrap->getBootstrap()->getResource('db');
     if ($db instanceof \Zend_Db_Adapter_Abstract) {
         $this->db = $db;
         $this->db->getProfiler()->setEnabled(true);
         $this->db->getProfiler()->clear();
     }
 }
示例#20
0
function main()
{
    // Ensure library/ is on include_path
    set_include_path(implode(PATH_SEPARATOR, array(
        realpath(APPLICATION_PATH . '/../library'),
        get_include_path(),
    )));

    // Create application, bootstrap, and run
    $application = new Zend_Application(
        APPLICATION_ENV,
        APPLICATION_PATH . '/configs/application.ini'
    );

    $application->bootstrap()
                ->run();
}
 protected function setUp()
 {
     // get the config
     $application = new Zend_Application('development', APPLICATION_PATH . '/config/store.ini');
     $application->bootstrap('ZendSearch');
     // mock Zend_Search
     $indexEngine = new Zend_Search_Stub();
     $this->_indexer = new Storefront_Service_ProductIndexer();
     $this->_indexer->setIndexingEngine($indexEngine);
     // mock product
     $item = $this->getMock('Storefront_Resource_Product_Item_Interface');
     $item->productId = 1;
     $item->name = 'test1';
     $item->description = 'description';
     $item->expects($this->once())->method('getPrice')->will($this->returnValue('10.99'));
     // create a document for indexing
     $this->_document = new Storefront_Model_Document_Product($item, 'category1,category2');
 }
示例#22
0
function main()
{
    $key = 'app_performance';
    $config = apc_fetch($key, $success);
    if (!$success) {
        $config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/application.ini', APPLICATION_ENV);
        $config = $config->toArray();
        apc_store($key, $config);
    }
    $cachefile = APPLICATION_PATH . '/../data/cache/plugins.php';
    if (file_exists($cachefile)) {
        include_once $cachefile;
    }
    Zend_Loader_PluginLoader::setIncludeFileCache($cachefile);
    // Create application, bootstrap, and run
    $application = new Zend_Application(APPLICATION_ENV, $config);
    $application->bootstrap()->run();
}
 /**
  * Verarbeitet einen Aufruf der Homepage über Zend MVC
  * @return Dragon_Application_Application
  */
 public function dispatch()
 {
     $application = new Zend_Application(APPLICATION_ENV, DRAGONJSONSERVER_PATH . '/config/dragonx/homepage/application.ini');
     if (Zend_Registry::isRegistered('Dragon_Repository_Registry')) {
         $frontController = Zend_Controller_Front::getInstance();
         foreach (Zend_Registry::get('Dragon_Repository_Registry')->getRepositories() as $repositoryname => $directorypath) {
             $administrationpath = $directorypath . '/modules/administration/controllers';
             if (is_dir($administrationpath)) {
                 $frontController->addControllerDirectory($administrationpath, $repositoryname . '_administration');
             }
             $homepagepath = $directorypath . '/modules/homepage/controllers';
             if (is_dir($homepagepath)) {
                 $frontController->addControllerDirectory($homepagepath, $repositoryname . '_homepage');
             }
         }
     }
     $application->bootstrap()->run();
     return $this;
 }
示例#24
0
 /**
  * Setup.
  */
 protected function setUp()
 {
     $this->applicationPath = STUFF_PATH . '/zf/application';
     if (!defined('APPLICATION_PATH')) {
         define('APPLICATION_PATH', $this->applicationPath);
     }
     $this->applicationLogs = STUFF_PATH . '/../../../tmp/logs';
     if (!defined('APPLICATION_LOGS')) {
         define('APPLICATION_LOGS', $this->applicationLogs);
     }
     if (!defined('APPLICATION_LOG_PREFIX')) {
         define('APPLICATION_LOG_PREFIX', 'tbs');
     }
     if (!defined('APPLICATION_ENV')) {
         define('APPLICATION_ENV', $this->applicationEnv);
     }
     $application = new \Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini');
     $application->bootstrap();
 }
 public function onRequest(GetResponseEvent $event)
 {
     if (HttpKernel::MASTER_REQUEST != $event->getRequestType()) {
         // don't do anything if it's not the master request
         return;
     }
     $request = $event->getRequest();
     $pos = strpos($request->server->get('REQUEST_URI'), '_profiler');
     // don't call Zend Application for profiler.
     if (false === $pos) {
         // init adodb
         require_once __DIR__ . '/../../../../db_connect.php';
         // Fill zend application options
         $config = $this->container->getParameterBag()->all();
         $application = new \Zend_Application(APPLICATION_ENV);
         $application->setOptions($config);
         $application->bootstrap();
         \Zend_Registry::set('zend_application', $application);
     }
 }
示例#26
0
	protected function setUp(){
		$application = new Zend_Application(
            APPLICATION_ENV,
            APPLICATION_PATH . '/configs/application.ini'
        );
        $application->bootstrap();
		$this->_em = Zend_Registry::get('em');
		 // Retrieve the Doctrine 2 entity manager
   
   		// Instantiate the schema tool
   		$tool = new Doctrine\ORM\Tools\SchemaTool($this->_em);
    	// Retrieve all of the mapping metadata
    	$classes = $this->_em->getMetadataFactory()->getAllMetadata();
    	// Delete the existing test database schema
    	$tool->dropSchema($classes);

	    // Create the test database schema
	    $tool->createSchema($classes);
			
	    parent::setUp();
	}
示例#27
0
 public static function suite()
 {
     // Define path to application directory
     defined('APPLICATION_PATH') || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
     // Define application environment
     defined('APPLICATION_ENV') || define('APPLICATION_ENV', getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'testing');
     // Ensure library/ is on include_path
     //        set_include_path(implode(PATH_SEPARATOR, array(
     //            realpath(APPLICATION_PATH . '/../library'),
     //            get_include_path(),
     //        )));
     /** Zend_Application */
     require_once 'Zend/Application.php';
     // Create application, bootstrap, and run
     $application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini');
     $application->bootstrap();
     //->run();
     require_once 'Zinc/AllTests.php';
     $suite = new PHPUnit_Framework_TestSuite('Zinc App');
     $suite->addTest(Zinc_AllTests::suite());
     return $suite;
 }
示例#28
0
 public function create($username = '', $password = '')
 {
     $username = trim(strtolower($username));
     $password = trim(strtolower($password));
     if (!$username || !$password) {
         $this->_registry->getResponse()->appendContent("Podaj nazwe konta i haslo.");
         return;
     }
     // Define path to application directory
     defined('APPLICATION_PATH') || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
     // Define application environment
     defined('APPLICATION_ENV') || define('APPLICATION_ENV', getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'development');
     // Ensure library/ is on include_path
     set_include_path(implode(PATH_SEPARATOR, array(realpath(APPLICATION_PATH . '/../library'), get_include_path())));
     /** Zend_Application */
     require_once 'Zend/Application.php';
     // Create application, bootstrap, and run
     $application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini');
     $application->bootstrap('db');
     $User = new Application_Model_DbTable_UzytkownicyWww();
     $salt = My_Salt::getSalt3();
     $dane = array('login_pre' => $username, 'haslo_pre' => sha1($salt . $salt . $password), 'salt' => $salt);
     $User->createRow($dane)->save();
 }
示例#29
0
<?php

// Define path to application directory
defined('APPLICATION_PATH') || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
// Define application environment
defined('APPLICATION_ENV') || define('APPLICATION_ENV', getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production');
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(realpath(APPLICATION_PATH . '/../library'), realpath(APPLICATION_PATH . '/../vendor/zendframework/zendframework1/library'), get_include_path())));
require_once realpath(APPLICATION_PATH . '/../vendor/autoload.php');
/** Zend_Application */
require_once 'Zend/Application.php';
// Create application, bootstrap, and run
$application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini');
$application->bootstrap()->run();
示例#30
-1
 /**
  * bootstrap application
  */
 public function appBootstrap()
 {
     $this->_application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini');
     $this->_application->bootstrap();
     /*
      * Fix for ZF-8193
      * http://framework.zend.com/issues/browse/ZF-8193
      * Zend_Controller_Action->getInvokeArg('bootstrap') doesn't work
      * under the unit testing environment.
      */
     $front = Zend_Controller_Front::getInstance();
     if ($front->getParam('bootstrap') === null) {
         $front->setParam('bootstrap', $this->_application->getBootstrap());
     }
 }