本文整理汇总了PHP中phpbb_database_test_case::setUp方法的典型用法代码示例。如果您正苦于以下问题:PHP phpbb_database_test_case::setUp方法的具体用法?PHP phpbb_database_test_case::setUp怎么用?PHP phpbb_database_test_case::setUp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类phpbb_database_test_case
的用法示例。
在下文中一共展示了phpbb_database_test_case::setUp方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
public function setUp()
{
parent::setUp();
$this->db = $this->new_dbal();
$this->buffer = new \phpbb\db\sql_insert_buffer($this->db, 'phpbb_config', 2);
$this->assert_config_count(2);
}
示例2: setUp
public function setUp()
{
global $config, $phpbb_root_path, $phpEx;
parent::setUp();
$this->auth = new \phpbb\auth\auth();
$this->config = new \phpbb\config\config(array('upload_path' => '', 'img_create_thumbnail' => true));
$config = $this->config;
$this->db = $this->new_dbal();
$this->cache = new \phpbb\cache\service(new \phpbb\cache\driver\dummy(), $this->config, $this->db, $phpbb_root_path, $phpEx);
$this->request = $this->getMock('\\phpbb\\request\\request');
$this->filesystem = new \phpbb\filesystem\filesystem();
$this->language = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx));
$this->php_ini = new \bantu\IniGetWrapper\IniGetWrapper();
$guessers = array(new \Symfony\Component\HttpFoundation\File\MimeType\FileinfoMimeTypeGuesser(), new \Symfony\Component\HttpFoundation\File\MimeType\FileBinaryMimeTypeGuesser(), new \phpbb\mimetype\content_guesser(), new \phpbb\mimetype\extension_guesser());
$guessers[2]->set_priority(-2);
$guessers[3]->set_priority(-2);
$this->mimetype_guesser = new \phpbb\mimetype\guesser($guessers);
$this->plupload = new \phpbb\plupload\plupload($phpbb_root_path, $this->config, $this->request, new \phpbb\user($this->language, '\\phpbb\\datetime'), $this->php_ini, $this->mimetype_guesser);
$factory_mock = $this->getMockBuilder('\\phpbb\\files\\factory')->disableOriginalConstructor()->getMock();
$factory_mock->expects($this->any())->method('get')->willReturn(new \phpbb\files\filespec($this->filesystem, $this->language, $this->php_ini, new \FastImageSize\FastImageSize(), $this->phpbb_root_path, $this->mimetype_guesser));
$this->container = new phpbb_mock_container_builder($phpbb_root_path, $phpEx);
$this->container->set('files.filespec', new \phpbb\files\filespec($this->filesystem, $this->language, $this->php_ini, new \FastImageSize\FastImageSize(), $phpbb_root_path, new \phpbb\mimetype\guesser(array('mimetype.extension_guesser' => new \phpbb\mimetype\extension_guesser()))));
$this->container->set('files.types.form', new \phpbb\files\types\form($factory_mock, $this->language, $this->php_ini, $this->plupload, $this->request));
$this->container->set('files.types.local', new \phpbb\files\types\local($factory_mock, $this->language, $this->php_ini, $this->request));
$this->factory = new \phpbb\files\factory($this->container);
$this->files_upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path);
$this->phpbb_dispatcher = new phpbb_mock_event_dispatcher();
$this->user = new \phpbb\user($this->language, '\\phpbb\\datetime');
$this->upload = new \phpbb\attachment\upload($this->auth, $this->cache, $this->config, $this->files_upload, $this->language, $this->mimetype_guesser, $this->phpbb_dispatcher, $this->plupload, $this->user, $this->phpbb_root_path);
}
示例3: setUp
protected function setUp()
{
parent::setUp();
$this->db = $this->new_dbal();
$this->user = new phpbb_mock_user();
$this->helper = new phpbb_functions_validate_data_helper($this);
}
示例4: setUp
public function setUp()
{
parent::setUp();
$this->cache = new phpbb_mock_cache();
$this->db = $this->new_dbal();
$this->config = new \phpbb\config\db($this->db, $this->cache, 'phpbb_config');
}
示例5: setUp
protected function setUp()
{
parent::setUp();
global $config, $db;
$db = $this->db = $this->new_dbal();
$config = array('load_online_time' => 5);
}
示例6: setUp
protected function setUp()
{
parent::setUp();
global $phpbb_root_path, $phpEx;
global $db, $config, $user, $auth, $cache, $phpbb_container;
$db = $this->db = $this->new_dbal();
$config = $this->config = new \phpbb\config\config(array());
$user = $this->user = new \phpbb\user('\\phpbb\\datetime');
$this->user_loader = new \phpbb\user_loader($this->db, $phpbb_root_path, $phpEx, 'phpbb_users');
$auth = $this->auth = new \phpbb_mock_notifications_auth();
$cache = $this->cache = new \phpbb\cache\service(new \phpbb\cache\driver\null(), $this->config, $this->db, $phpbb_root_path, $phpEx);
$this->phpbb_dispatcher = new \phpbb_mock_event_dispatcher();
$phpbb_container = $this->container = new \phpbb_mock_container_builder();
$this->notifications = new \phpbb_notification_manager_helper(array(), array(), $this->container, $this->user_loader, $this->config, $this->phpbb_dispatcher, $this->db, $this->cache, $this->user, $phpbb_root_path, $phpEx, 'phpbb_notification_types', 'phpbb_notifications', 'phpbb_user_notifications');
$phpbb_container->set('notification_manager', $this->notifications);
$this->notifications->setDependencies($this->auth, $this->config);
$types = array();
foreach ($this->get_notification_types() as $type) {
$type_parts = explode('.', $type);
$class = $this->build_type('\\gn36\\versionchecknotifier\\notification\\' . array_pop($type_parts));
$types[$type] = $class;
$this->container->set($type, $class);
}
$this->notifications->set_var('notification_types', $types);
$this->db->sql_query('DELETE FROM phpbb_notification_types');
$this->db->sql_query('DELETE FROM phpbb_notifications');
$this->db->sql_query('DELETE FROM phpbb_user_notifications');
}
示例7: setUp
/**
* Setup test environment
*/
public function setUp()
{
parent::setUp();
global $phpbb_dispatcher;
$this->db = $this->new_dbal();
$this->phpbb_container = new \phpbb_mock_container_builder();
$this->config = new \phpbb\config\config(array('notification_pull_time' => 60));
// TBD
$auth = $this->getMock('\\phpbb\\auth\\auth');
$cache = new \phpbb\cache\service(new \phpbb\cache\driver\null(), $this->config, $this->db, $phpbb_root_path, $phpEx);
$user_loader = new \phpbb\user_loader($this->db, $phpbb_root_path, $phpEx, USERS_TABLE);
// Event dispatcher
$phpbb_dispatcher = new \phpbb_mock_event_dispatcher();
// Notification Types
$notification_types = array('pm');
$notification_types_array = array();
foreach ($notification_types as $type) {
$class_name = '\\phpbb\\notification\\type\\' . $type;
$class = new $class_name($user_loader, $this->db, $cache->get_driver(), $user, $auth, $this->config, $phpbb_root_path, $phpEx, NOTIFICATION_TYPES_TABLE, NOTIFICATIONS_TABLE, USER_NOTIFICATIONS_TABLE);
$this->phpbb_container->set('notification.type.' . $type, $class);
$notification_types_array['notification.type.' . $type] = $class;
}
// Notification Manager
$this->phpbb_notifications = new \phpbb\notification\manager($notification_types_array, array(), $this->phpbb_container, $user_loader, $this->config, $phpbb_dispatcher, $this->db, $cache, $user, $phpbb_root_path, $phpEx, NOTIFICATION_TYPES_TABLE, NOTIFICATIONS_TABLE, USER_NOTIFICATIONS_TABLE);
}
示例8: setUp
/**
* Setup test environment
*/
public function setUp()
{
parent::setUp();
global $config, $phpbb_dispatcher, $user, $cache;
$this->db = $this->new_dbal();
$config = $this->config = new \phpbb\config\config(array());
$phpbb_dispatcher = $this->dispatcher = new \phpbb_mock_event_dispatcher();
$this->template = $this->getMockBuilder('\\phpbb\\template\\template')->getMock();
$this->user = $this->getMock('\\phpbb\\user', array(), array('\\phpbb\\datetime'));
$this->user->optionset('viewcensors', false);
$this->user->style['style_path'] = 'prosilver';
$this->user->method('lang')->will($this->returnArgument(0));
$user = $this->user;
$this->auth = $this->getMock('\\phpbb\\auth\\auth');
$this->controller_helper = $this->getMockBuilder('\\phpbb\\controller\\helper')->disableOriginalConstructor()->getMock();
// Define some controller_helper stuff
$this->controller_helper->method('route')->will($this->returnArgument(0));
$controller_helper = $this->controller_helper;
$cache = $this->cache = new \phpbb\cache\service(new \phpbb\cache\driver\null(), $this->config, $this->db, $phpbb_root_path, $phpEx);
$this->pagination = $this->getMockBuilder('\\phpbb\\pagination')->disableOriginalConstructor()->getMock();
//$this->user_loader = new \phpbb\user_loader($this->db, __DIR__ . '/../../../', 'php', 'phpbb_users');
$this->user_loader = $this->getMockBuilder('\\phpbb\\user_loader')->disableOriginalConstructor()->getMock();
$this->user_loader->method('get_username')->will($this->returnArgument(0));
$this->request = $this->getMock('\\phpbb\\request\\request');
}
示例9: setUp
protected function setUp()
{
parent::setUp();
global $phpbb_root_path, $phpEx;
$this->db = $this->new_dbal();
$this->migration = new \phpbb\db\migration\data\v310\notification_options_reconvert(new \phpbb\config\config(array()), $this->db, new \phpbb\db\tools($this->db), $phpbb_root_path, $phpEx, 'phpbb_');
}
示例10: setUp
public function setUp()
{
parent::setUp();
//$this->db = $this->new_dbal();
$this->cache = $this->getMockBuilder('\\phpbb\\cache\\service')->disableOriginalConstructor()->getMock();
$this->log = $this->getMockBuilder('\\phpbb\\log\\log')->disableOriginalConstructor()->getMock();
}
示例11: setUp
protected function setUp()
{
parent::setUp();
global $cache, $config, $db, $phpbb_container, $phpbb_dispatcher, $user, $phpbb_root_path, $phpEx;
$this->db = $db = $this->new_dbal();
$lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx);
$lang = new \phpbb\language\language($lang_loader);
$user = new \phpbb\user($lang, '\\phpbb\\datetime');
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
$phpbb_container = new phpbb_mock_container_builder();
$config = new \phpbb\config\config(array('auth_method' => 'oauth', 'auth_oauth_google_key' => 'foo', 'auth_oauth_google_secret' => 'bar'));
$cache = new \phpbb\cache\driver\dummy();
$request = new phpbb_mock_request();
$notification_manager = new phpbb_mock_notification_manager();
$provider_collection = new \phpbb\auth\provider_collection($phpbb_container, $config);
$oauth_provider_google = new \phpbb\auth\provider\oauth\service\google($config, $request);
$oauth_provider_collection = new \phpbb\di\service_collection($phpbb_container);
$oauth_provider_collection->offsetSet('auth.provider.oauth.service.google', $oauth_provider_google);
$driver_helper = new \phpbb\passwords\driver\helper($config);
$passwords_drivers = array('passwords.driver.bcrypt_2y' => new \phpbb\passwords\driver\bcrypt_2y($config, $driver_helper), 'passwords.driver.bcrypt' => new \phpbb\passwords\driver\bcrypt($config, $driver_helper), 'passwords.driver.salted_md5' => new \phpbb\passwords\driver\salted_md5($config, $driver_helper), 'passwords.driver.phpass' => new \phpbb\passwords\driver\phpass($config, $driver_helper));
$passwords_helper = new \phpbb\passwords\helper();
// Set up passwords manager
$passwords_manager = new \phpbb\passwords\manager($config, $passwords_drivers, $passwords_helper, array_keys($passwords_drivers));
$oauth_provider = new \phpbb\auth\provider\oauth\oauth($db, $config, $passwords_manager, $request, $user, 'phpbb_oauth_tokens', 'phpbb_oauth_accounts', $oauth_provider_collection, 'phpbb_users', $phpbb_container, $this->phpbb_root_path, $this->php_ext);
$provider_collection->offsetSet('auth.provider.oauth', $oauth_provider);
$phpbb_container->set('auth.provider.oauth', $oauth_provider);
$phpbb_container->set('auth.provider.oauth.service.google', $oauth_provider_google);
$phpbb_container->set('auth.provider_collection', $provider_collection);
$phpbb_container->set('notification_manager', $notification_manager);
}
示例12: setUp
protected function setUp()
{
parent::setUp();
$this->cache = new phpbb_mock_cache();
$this->config = new \phpbb\config\config(array('version' => '3.1.0'));
$this->db = $this->new_dbal();
$factory = new \phpbb\db\tools\factory();
$this->db_tools = $factory->get($this->db);
$this->phpbb_root_path = dirname(__FILE__) . '/';
$this->phpEx = 'php';
$this->table_prefix = 'phpbb_';
$container = new phpbb_mock_container_builder();
$cache_path = $this->phpbb_root_path . 'cache/twig';
$context = new \phpbb\template\context();
$loader = new \phpbb\template\twig\loader(new \phpbb\filesystem\filesystem(), '');
$filesystem = new \phpbb\filesystem\filesystem();
$phpbb_path_helper = new \phpbb\path_helper(new \phpbb\symfony_request(new phpbb_mock_request()), $filesystem, $this->getMock('\\phpbb\\request\\request'), $this->phpbb_root_path, $this->phpEx);
$twig = new \phpbb\template\twig\environment($this->config, $filesystem, $phpbb_path_helper, $cache_path, null, $loader, array('cache' => false, 'debug' => false, 'auto_reload' => true, 'autoescape' => false));
$container = new phpbb_mock_container_builder();
$this->migrator = new \phpbb\db\migrator($container, $this->config, $this->db, $this->db_tools, 'phpbb_migrations', $this->phpbb_root_path, 'php', $this->table_prefix, array(), new \phpbb\db\migration\helper());
$container->set('migrator', $this->migrator);
$this->extension_manager = new \phpbb\extension\manager($container, $this->db, $this->config, new \phpbb\filesystem\filesystem(), 'phpbb_ext', $this->phpbb_root_path, $this->phpEx, $this->cache);
global $phpbb_root_path;
$lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $this->phpEx);
$lang_loader->set_extension_manager($this->extension_manager);
$lang = new \phpbb\language\language($lang_loader);
$this->user = new \phpbb\user($lang, '\\phpbb\\datetime');
$this->template = new phpbb\template\twig\twig($phpbb_path_helper, $this->config, $context, $twig, $cache_path, $this->user, array(new \phpbb\template\twig\extension($context, $this->user)));
$twig->setLexer(new \phpbb\template\twig\lexer($twig));
}
示例13: setUp
protected function setUp()
{
parent::setUp();
global $phpbb_root_path, $phpEx;
include_once __DIR__ . '/ext/test/notification/type/test.' . $phpEx;
global $db, $config, $user, $auth, $cache, $phpbb_container;
$db = $this->db = $this->new_dbal();
$config = $this->config = new \phpbb\config\config(array('allow_privmsg' => true, 'allow_bookmarks' => true, 'allow_topic_notify' => true, 'allow_forum_notify' => true));
$lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx);
$lang = new \phpbb\language\language($lang_loader);
$user = new \phpbb\user($lang, '\\phpbb\\datetime');
$this->user = $user;
$this->user_loader = new \phpbb\user_loader($this->db, $phpbb_root_path, $phpEx, 'phpbb_users');
$auth = $this->auth = new phpbb_mock_notifications_auth();
$cache = $this->cache = new \phpbb\cache\service(new \phpbb\cache\driver\dummy(), $this->config, $this->db, $phpbb_root_path, $phpEx);
$this->phpbb_dispatcher = new phpbb_mock_event_dispatcher();
$phpbb_container = $this->container = new phpbb_mock_container_builder();
$this->notifications = new phpbb_notification_manager_helper(array(), array(), $this->container, $this->user_loader, $this->config, $this->phpbb_dispatcher, $this->db, $this->cache, $this->user, $phpbb_root_path, $phpEx, 'phpbb_notification_types', 'phpbb_notifications', 'phpbb_user_notifications');
$phpbb_container->set('notification_manager', $this->notifications);
$this->notifications->setDependencies($this->auth, $this->config);
$types = array();
foreach ($this->get_notification_types() as $type) {
$type_parts = explode('.', $type);
$class = $this->build_type('phpbb\\notification\\type\\' . array_pop($type_parts));
$types[$type] = $class;
$this->container->set($type, $class);
}
$this->notifications->set_var('notification_types', $types);
$this->db->sql_query('DELETE FROM phpbb_notification_types');
$this->db->sql_query('DELETE FROM phpbb_notifications');
$this->db->sql_query('DELETE FROM phpbb_user_notifications');
}
示例14: setUp
public function setUp()
{
global $auth, $db, $cache, $config, $user, $phpbb_dispatcher, $phpbb_container, $phpbb_root_path, $phpEx;
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
$phpbb_container = new phpbb_mock_container_builder();
$phpbb_container->set('cache.driver', new phpbb_mock_cache());
$phpbb_container->set('notification_manager', new phpbb_mock_notification_manager());
$auth = $this->getMock('\\phpbb\\auth\\auth');
$cache = $phpbb_container->get('cache.driver');
$config = $this->config = new \phpbb\config\config(array('board_timezone' => 'UTC', 'default_lang' => 'en', 'email_enable' => false, 'min_name_chars' => 3, 'max_name_chars' => 10, 'min_pass_chars' => 3, 'max_pass_chars' => 10, 'pass_complex' => 'PASS_TYPE_ANY'));
$db = $this->db = $this->new_dbal();
$this->language = $this->getMockBuilder('\\phpbb\\language\\language')->disableOriginalConstructor()->getMock();
$this->language->expects($this->any())->method('lang')->will($this->returnArgument(0));
$user = $this->user = $this->getMock('\\phpbb\\user', array(), array($this->language, '\\phpbb\\datetime'));
$this->user_loader = new \phpbb\user_loader($db, $phpbb_root_path, $phpEx, USERS_TABLE);
$driver_helper = new \phpbb\passwords\driver\helper($this->config);
$passwords_drivers = array('passwords.driver.bcrypt_2y' => new \phpbb\passwords\driver\bcrypt_2y($this->config, $driver_helper), 'passwords.driver.bcrypt' => new \phpbb\passwords\driver\bcrypt($this->config, $driver_helper), 'passwords.driver.salted_md5' => new \phpbb\passwords\driver\salted_md5($this->config, $driver_helper), 'passwords.driver.phpass' => new \phpbb\passwords\driver\phpass($this->config, $driver_helper));
$passwords_helper = new \phpbb\passwords\helper();
$this->passwords_manager = new \phpbb\passwords\manager($this->config, $passwords_drivers, $passwords_helper, array_keys($passwords_drivers));
$this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $phpEx;
$this->log = $this->getMockBuilder('\\phpbb\\log\\log')->disableOriginalConstructor()->getMock();
$phpbb_container->set('auth.provider.db', new phpbb_mock_auth_provider());
$provider_collection = new \phpbb\auth\provider_collection($phpbb_container, $config);
$provider_collection->add('auth.provider.db');
$phpbb_container->set('auth.provider_collection', $provider_collection);
parent::setUp();
}
示例15: setUp
/**
* Setup test environment
*/
public function setUp()
{
parent::setUp();
global $phpbb_dispatcher;
$this->db = $this->new_dbal();
$this->phpbb_container = new \phpbb_mock_container_builder();
$this->config = new \phpbb\config\config(array('notification_pull_time' => 60));
// TBD
$auth = $this->getMock('\\phpbb\\auth\\auth');
$cache = new \phpbb\cache\service(new \phpbb\cache\driver\null(), $this->config, $this->db, $phpbb_root_path, $phpEx);
$user_loader = new \phpbb\user_loader($this->db, $phpbb_root_path, $phpEx, USERS_TABLE);
// Event dispatcher
$phpbb_dispatcher = new \phpbb_mock_event_dispatcher();
// Notification Types
$notification_types = array('pm');
$notification_types_array = array();
foreach ($notification_types as $type) {
$class_name = '\\phpbb\\notification\\type\\' . $type;
$class = new $class_name($user_loader, $this->db, $cache->get_driver(), $user, $auth, $this->config, $phpbb_root_path, $phpEx, NOTIFICATION_TYPES_TABLE, NOTIFICATIONS_TABLE, USER_NOTIFICATIONS_TABLE);
$this->phpbb_container->set('notification.type.' . $type, $class);
$notification_types_array['notification.type.' . $type] = $class;
}
// Notification Manager
$this->phpbb_notifications = new \phpbb\notification\manager($notification_types_array, array(), $this->phpbb_container, $user_loader, $this->config, $phpbb_dispatcher, $this->db, $cache, $user, $phpbb_root_path, $phpEx, NOTIFICATION_TYPES_TABLE, NOTIFICATIONS_TABLE, USER_NOTIFICATIONS_TABLE);
$user = new \phpbb_mock_user();
$user->optionset('viewcensors', false);
$user->style['style_path'] = 'prosilver';
$this->user = $this->getMock('\\phpbb\\user', array(), array('\\phpbb\\datetime'));
$this->template = $this->getMockBuilder('\\phpbb\\template\\template')->getMock();
$phpbb_container = new \phpbb_mock_container_builder();
$phpbb_container->set('path_helper', $phpbb_path_helper);
$this->controller_helper = $this->getMockBuilder('\\phpbb\\controller\\helper')->disableOriginalConstructor()->getMock();
$this->request = $this->getMock('\\phpbb\\request\\request');
}