当前位置: 首页>>代码示例>>PHP>>正文


PHP PHPUnit_Framework_TestCase::setup方法代码示例

本文整理汇总了PHP中PHPUnit_Framework_TestCase::setup方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPUnit_Framework_TestCase::setup方法的具体用法?PHP PHPUnit_Framework_TestCase::setup怎么用?PHP PHPUnit_Framework_TestCase::setup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PHPUnit_Framework_TestCase的用法示例。


在下文中一共展示了PHPUnit_Framework_TestCase::setup方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setup

 public function setup()
 {
     parent::setup();
     $storage = $this->getStorage();
     $this->service1 = new Lock\LockService(['storage' => $storage]);
     $this->service2 = new Lock\LockService(['storage' => $storage]);
 }
开发者ID:gielfeldt,项目名称:lock,代码行数:7,代码来源:LockTestBase.php

示例2: setup

 public function setup()
 {
     parent::setup();
     $pathDir = getcwd() . "/";
     $config = (include $pathDir . 'config/application.config.php');
     $this->serviceManager = new ServiceManager(new ServiceManagerConfig(isset($config['service_manager']) ? $config['service_manager'] : array()));
     $this->serviceManager->setService('ApplicationConfig', $config);
     $this->serviceManager->setFactory('ServiceListener', 'Zend\\Mvc\\Service\\ServiceListenerFactory');
     $moduleManager = $this->serviceManager->get('ModuleManager');
     $moduleManager->loadModules();
     $this->routes = array();
     $this->modules = $moduleManager->getModules();
     foreach ($this->filterModules() as $m) {
         $moduleConfig = (include $pathDir . 'module/' . ucfirst($m) . '/config/module.config.php');
         if (isset($moduleConfig['router'])) {
             foreach ($moduleConfig['router']['routes'] as $key => $name) {
                 $this->routes[$key] = $name;
             }
         }
     }
     $this->serviceManager->setAllowOverride(true);
     $this->application = $this->serviceManager->get('Application');
     $this->event = new MvcEvent();
     $this->event->setTarget($this->application);
     $this->event->setApplication($this->application)->setRequest($this->application->getRequest())->setResponse($this->application->getResponse())->setRouter($this->serviceManager->get('Router'));
     $this->em = $this->serviceManager->get('Doctrine\\ORM\\EntityManager');
     foreach ($this->filterModules() as $m) {
         $this->createDatabase($m);
     }
 }
开发者ID:argentinaluiz,项目名称:Learning-ZF2,代码行数:30,代码来源:TestCase.php

示例3: setup

 public function setup()
 {
     parent::setup();
     $this->command = $this->getMockBuilder('PHPCI\\Command\\CreateAdminCommand')->setConstructorArgs([$this->getMock('PHPCI\\Store\\UserStore')])->setMethods(['reloadConfig'])->getMock();
     $this->dialog = $this->getMockBuilder('Symfony\\Component\\Console\\Helper\\DialogHelper')->setMethods(['ask', 'askAndValidate', 'askHiddenResponse'])->getMock();
     $this->application = new Application();
 }
开发者ID:stefanius,项目名称:phpci-box,代码行数:7,代码来源:CreateAdminCommandTest.php

示例4: setup

 public function setup()
 {
     parent::setup();
     $config = (include 'config/application.config.php');
     $config['module_listener_options']['config_static_paths'] = array(getcwd() . '/config/test.config.php');
     if (file_exists(__DIR__ . '/config/test.config.php')) {
         $moduleConfig = (include __DIR__ . '/config/test.config.php');
         array_unshift($config['module_listener_options']['config_static_paths'], $moduleConfig);
     }
     $this->serviceManager = new ServiceManager(new ServiceManagerConfig(isset($config['service_manager']) ? $config['service_manager'] : array()));
     $this->serviceManager->setService('ApplicationConfig', $config);
     $this->serviceManager->setFactory('ServiceListener', 'Zend\\Mvc\\Service\\ServiceListenerFactory');
     $moduleManager = $this->serviceManager->get('ModuleManager');
     $moduleManager->loadModules();
     $this->routes = array();
     foreach ($moduleManager->getModules() as $m) {
         $moduleConfig = (include __DIR__ . '/../../../../' . ucfirst($m) . '/config/module.config.php');
         if (isset($moduleConfig['router'])) {
             foreach ($moduleConfig['router']['routes'] as $key => $name) {
                 $this->routes[$key] = $name;
             }
         }
     }
     $this->serviceManager->setAllowOverride(true);
     $this->application = $this->serviceManager->get('Application');
     $this->event = new MvcEvent();
     $this->event->setTarget($this->application);
     $this->event->setApplication($this->application)->setRequest($this->application->getRequest())->setResponse($this->application->getResponse())->setRouter($this->serviceManager->get('Router'));
     $this->createDatabase();
 }
开发者ID:alfredocoj,项目名称:blogzf2tutorial,代码行数:30,代码来源:TestCase.php

示例5: setUp

 public function setUp()
 {
     parent::setup();
     $this->id = 'xxxxxx';
     $this->label = 'my_label';
     $this->value = 100;
     $this->conversion = new Conversion($this->id, $this->label, $this->value);
 }
开发者ID:Grome13,项目名称:GoogleBundle,代码行数:8,代码来源:ConversionTest.php

示例6: setUp

 public function setUp()
 {
     parent::setup();
     // Create a new client, set it to use batch mode, but do not authenticate
     $this->client = new Google_Client();
     $this->client->setApplicationName("Google Apps Groups Controller Test");
     $this->client->setUseBatch(true);
 }
开发者ID:westkingdom,项目名称:hierarchical-group-email,代码行数:8,代码来源:GoogleAppsGroupControllerTest.php

示例7: setUp

 public function setUp()
 {
     parent::setup();
     $this->category = 'Test category';
     $this->action = 'Test action';
     $this->label = 'Test label';
     $this->value = 'Test value';
     $this->event = new Event($this->category, $this->action);
 }
开发者ID:netconstructor,项目名称:GoogleBundle,代码行数:9,代码来源:EventTest.php

示例8: setup

 public function setup()
 {
     $em = $this->getEntityManager();
     $tool = new SchemaTool($em);
     //busca a informação de todas as entidades
     $classes = $em->getMetadataFactory()->getAllMetadata();
     // cria a base de dados para os testes
     $tool->createSchema($classes);
     parent::setup();
 }
开发者ID:eminetto,项目名称:CursoDoctrine,代码行数:10,代码来源:TestCase.php

示例9: setup

 public function setup()
 {
     parent::setup();
     $this->_view = Solar::factory('Solar_View');
     $this->_name = substr(get_class($this), 18, -4);
     $this->_name[0] = strtolower($this->_name[0]);
     // retain and reset the request environment
     $this->_request = Solar_Registry::get('request');
     $this->_request->reset();
 }
开发者ID:btweedy,项目名称:foresmo,代码行数:10,代码来源:HelperTestCase.php

示例10: setUp

 public function setUp()
 {
     parent::setup();
     $this->validApiUserName = 'validApiUser';
     $this->validApiPassword = 'validApiPassword';
     $this->validBaseUrl = 'https://valid.base.url/';
     $this->validModule = 'validmodule';
     $this->validAction = 'validaction';
     $this->validFormat = SendGridWebApiAbstract::SENDGRID_RESPONSE_FORMAT_JSON;
     $this->validHttpResponse = new Response(200);
 }
开发者ID:idimensionz,项目名称:sendgrid-webapi,代码行数:11,代码来源:AbstractTestBase.php

示例11: setup

 public function setup()
 {
     parent::setup();
     $projectMock = $this->getMock('PHPCI\\Model\\Project');
     $projectStoreMock = $this->getMockBuilder('PHPCI\\Store\\ProjectStore')->getMock();
     $projectStoreMock->method('getById')->will($this->returnValueMap(array(array(1, 'read', $projectMock), array(2, 'read', null))));
     $buildServiceMock = $this->getMockBuilder('PHPCI\\Service\\BuildService')->disableOriginalConstructor()->getMock();
     $buildServiceMock->method('createBuild')->withConsecutive(array($projectMock, null, null, null, null, null), array($projectMock, '92c8c6e', null, null, null, null), array($projectMock, null, 'master', null, null, null));
     $this->command = $this->getMockBuilder('PHPCI\\Command\\CreateBuildCommand')->setConstructorArgs(array($projectStoreMock, $buildServiceMock))->setMethods(array('reloadConfig'))->getMock();
     $this->application = new Application();
 }
开发者ID:nelsonyang0710,项目名称:PHPCI,代码行数:11,代码来源:CreateBuildCommandTest.php

示例12: setup

 /**
  * Faz o setup dos testes. Executado antes de cada teste
  * @return void
  */
 public function setup()
 {
     $env = getenv('ENV');
     //o jenkins tem configurações especiais
     if (!$env || $env != 'jenkins') {
         putenv("ENV=testing");
         $env = 'testing';
     }
     putenv('PROJECT_ROOT=' . __DIR__ . '/../../../../../');
     parent::setup();
     //arquivo de configuração da aplicação
     $config = (include __DIR__ . '/../../../../../config/tests.config.php');
     $config['module_listener_options']['config_static_paths'] = array();
     //cria um novo ServiceManager
     $this->serviceManager = new ServiceManager(new ServiceManagerConfig(isset($config['service_manager']) ? $config['service_manager'] : array()));
     //configura os serviços básicos no ServiceManager
     $this->serviceManager->setService('ApplicationConfig', $config);
     $this->serviceManager->setFactory('ServiceListener', 'Zend\\Mvc\\Service\\ServiceListenerFactory');
     //verifica se os módulos possuem rotas configuradas e carrega elas para serem usadas pelo ControllerTestCase
     $moduleManager = $this->serviceManager->get('ModuleManager');
     $moduleManager->loadModules();
     $this->routes = array();
     $testConfig = false;
     //carrega as rotas dos módulos
     foreach ($moduleManager->getLoadedModules() as $m) {
         $moduleConfig = $m->getConfig();
         $this->getModuleRoutes($moduleConfig);
         $moduleName = explode('\\', get_class($m));
         $moduleName = $moduleName[0];
         //verifica se existe um arquivo de configuração específico no módulo para testes
         if (file_exists(getcwd() . '/module/' . ucfirst($moduleName) . '/config/test.config.php')) {
             $testConfig = (include getcwd() . '/module/' . ucfirst($moduleName) . '/config/test.config.php');
             array_unshift($config['module_listener_options']['config_static_paths'], $testConfig[$env]);
         }
     }
     if (!$testConfig) {
         $config['module_listener_options']['config_static_paths'] = array(getcwd() . '/config/tests.config.php');
     }
     $this->config = (include $config['module_listener_options']['config_static_paths'][0]);
     $this->serviceManager->setAllowOverride(true);
     //instancia a aplicação e configura os eventos e rotas
     $this->application = $this->serviceManager->get('Application');
     $this->event = new MvcEvent();
     $this->event->setTarget($this->application);
     $this->event->setApplication($this->application)->setRequest($this->application->getRequest())->setResponse($this->application->getResponse())->setRouter($this->serviceManager->get('Router'));
     $this->entityManager = $this->getEntityManager();
     $this->dropDatabase();
     $this->createDatabase();
 }
开发者ID:evertonteotonio,项目名称:erpphp,代码行数:53,代码来源:TestCase.php

示例13: setup

 public function setup()
 {
     parent::setup();
     // where is our development maven repository?
     $this->_projectDir = realpath(__DIR__ . "/../../../..");
     $name = $this->getName();
     $prefix = "testGradleWrapper_";
     if (substr($name, 0, strlen($prefix)) == $prefix) {
         $name = substr($name, strlen($prefix));
         $p = strpos($name, "_AndroidPlugin_");
         $wrapperVersion = substr($name, 0, $p);
         $wrapperVersion = str_replace("_", ".", $wrapperVersion);
         $pluginVersion = substr($name, $p + strlen("_AndroidPlugin_"));
         $pluginVersion = str_replace("_", ".", $pluginVersion);
         $this->tryGradle($wrapperVersion, $pluginVersion);
     }
 }
开发者ID:picmonkey,项目名称:testfairy-gradle-plugin,代码行数:17,代码来源:GradleSupportMatrixTest.php

示例14: setup

 public function setup()
 {
     parent::setup();
     $this->analyzer = new Analyzer(new Parser());
     $this->fileNameWithPath = __DIR__ . '/../Fixtures/summary.xml';
 }
开发者ID:geshan,项目名称:pdepend-analyzer,代码行数:6,代码来源:AnalyzerTest.php

示例15: setUp

 public function setUp()
 {
     parent::setup();
     $this->marker = new Marker();
 }
开发者ID:Grome13,项目名称:GoogleBundle,代码行数:5,代码来源:MarkerTest.php


注:本文中的PHPUnit_Framework_TestCase::setup方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。