本文整理汇总了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]);
}
示例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);
}
}
示例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();
}
示例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();
}
示例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);
}
示例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);
}
示例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);
}
示例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();
}
示例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();
}
示例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);
}
示例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();
}
示例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();
}
示例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);
}
}
示例14: setup
public function setup()
{
parent::setup();
$this->analyzer = new Analyzer(new Parser());
$this->fileNameWithPath = __DIR__ . '/../Fixtures/summary.xml';
}
示例15: setUp
public function setUp()
{
parent::setup();
$this->marker = new Marker();
}