本文整理汇总了PHP中phpbb_database_test_case类的典型用法代码示例。如果您正苦于以下问题:PHP phpbb_database_test_case类的具体用法?PHP phpbb_database_test_case怎么用?PHP phpbb_database_test_case使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了phpbb_database_test_case类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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');
}
示例2: setup
public function setup()
{
// Need global $db, $user for delete_module function in acp_modules
global $phpbb_root_path, $phpEx, $skip_add_log, $db, $user, $phpbb_log;
parent::setup();
// Disable the logs
$skip_add_log = true;
$db = $this->db = $this->new_dbal();
$this->cache = new \phpbb\cache\service(new \phpbb\cache\driver\dummy(), new \phpbb\config\config(array()), $this->db, $phpbb_root_path, $phpEx);
$lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx);
$lang = new \phpbb\language\language($lang_loader);
$user = $this->user = new \phpbb\user($lang, '\phpbb\datetime');
$cache = new phpbb_mock_cache;
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
$auth = $this->getMock('\phpbb\auth\auth');
$phpbb_log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE);
$phpbb_extension_manager = new phpbb_mock_extension_manager($phpbb_root_path);
$module_manager = new \phpbb\module\module_manager($cache, $this->db, $phpbb_extension_manager, MODULES_TABLE, $phpbb_root_path, $phpEx);
$this->tool = new \phpbb\db\migration\tool\module($this->db, $this->cache, $this->user, $module_manager, $phpbb_root_path, $phpEx, 'phpbb_modules');
}
示例3: 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');
}
示例4: 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);
}
示例5: setup
public function setup()
{
parent::setup();
$this->db = $this->new_dbal();
$this->config_text = new \phpbb\config\db_text($this->db, 'phpbb_config_text');
$this->tool = new \phpbb\db\migration\tool\config_text($this->config_text);
}
示例6: 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);
}
示例7: 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);
}
示例8: setUp
protected function setUp()
{
parent::setUp();
global $config, $db;
$db = $this->db = $this->new_dbal();
$config = array('load_online_time' => 5);
}
示例9: 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');
}
示例10: 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');
}
示例11: 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();
}
示例12: 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_');
}
示例13: 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');
}
示例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: tearDown
protected function tearDown()
{
if ($this->table_exists) {
$this->tools->sql_table_drop('prefix_table_name');
}
parent::tearDown();
}