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); }
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); }
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); }
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'); }
protected function setUp() { parent::setUp(); global $config, $db; $db = $this->db = $this->new_dbal(); $config = array('load_online_time' => 5); }
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'); }
/** * 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); }
/** * 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'); }
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_'); }
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(); }
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); }
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)); }
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'); }
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(); }
/** * 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'); }
protected function setUp() { parent::setUp(); global $phpbb_root_path, $phpEx; $this->db = $this->new_dbal(); $factory = new \phpbb\db\tools\factory(); $this->migration = new \phpbb\db\migration\data\v310\timezone(new \phpbb\config\config(array()), $this->db, $factory->get($this->db), $phpbb_root_path, $phpEx, 'phpbb_'); }
protected function setUp() { global $db; parent::setUp(); $this->cache = new phpbb_cache_memory(); $db = $this->new_dbal(); $this->db = $db; }
public function setUp() { parent::setUp(); global $auth, $cache, $config, $db, $phpbb_container, $phpbb_dispatcher, $user, $request, $phpEx, $phpbb_root_path, $user_loader; // Database $this->db = $this->new_dbal(); $db = $this->db; // Auth $auth = $this->getMock('\\phpbb\\auth\\auth'); $auth->expects($this->any())->method('acl_get')->with($this->stringContains('_'), $this->anything())->will($this->returnValueMap(array(array('f_noapprove', 1, true), array('f_postcount', 1, true), array('m_edit', 1, false)))); // Config $config = new \phpbb\config\config(array('num_topics' => 1, 'num_posts' => 1, 'allow_board_notifications' => true)); $cache_driver = new \phpbb\cache\driver\dummy(); $cache = new \phpbb\cache\service($cache_driver, $config, $db, $phpbb_root_path, $phpEx); // Event dispatcher $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); // User $user = $this->getMock('\\phpbb\\user', array(), array(new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)), '\\phpbb\\datetime')); $user->ip = ''; $user->data = array('user_id' => 2, 'username' => 'user-name', 'is_registered' => true, 'user_colour' => ''); // Request $type_cast_helper = $this->getMock('\\phpbb\\request\\type_cast_helper_interface'); $request = $this->getMock('\\phpbb\\request\\request'); $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); $user_loader = new \phpbb\user_loader($db, $phpbb_root_path, $phpEx, USERS_TABLE); // Container $phpbb_container = new ContainerBuilder(); $loader = new YamlFileLoader($phpbb_container, new FileLocator(__DIR__ . '/fixtures')); $loader->load('services_notification.yml'); $phpbb_container->set('user_loader', $user_loader); $phpbb_container->set('user', $user); $phpbb_container->set('config', $config); $phpbb_container->set('dbal.conn', $db); $phpbb_container->set('auth', $auth); $phpbb_container->set('cache.driver', $cache_driver); $phpbb_container->set('cache', $cache); $phpbb_container->set('text_formatter.utils', new \phpbb\textformatter\s9e\utils()); $phpbb_container->set('dispatcher', $phpbb_dispatcher); $phpbb_container->setParameter('core.root_path', $phpbb_root_path); $phpbb_container->setParameter('core.php_ext', $phpEx); $phpbb_container->setParameter('tables.notifications', 'phpbb_notifications'); $phpbb_container->setParameter('tables.user_notifications', 'phpbb_user_notifications'); $phpbb_container->setParameter('tables.notification_types', 'phpbb_notification_types'); $phpbb_container->set('content.visibility', new \phpbb\content_visibility($auth, $config, $phpbb_dispatcher, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE)); $phpbb_container->compile(); // Notification Types $notification_types = array('quote', 'bookmark', 'post', 'post_in_queue', 'topic', 'topic_in_queue', 'approve_topic', 'approve_post'); $notification_types_array = array(); foreach ($notification_types as $type) { $class = $phpbb_container->get('notification.type.' . $type); $notification_types_array['notification.type.' . $type] = $class; } // Methods Types $notification_methods_array = array('notification.method.board' => $phpbb_container->get('notification.method.board')); // Notification Manager $phpbb_notifications = new \phpbb\notification\manager($notification_types_array, $notification_methods_array, $phpbb_container, $user_loader, $phpbb_dispatcher, $db, $cache, $user, NOTIFICATION_TYPES_TABLE, USER_NOTIFICATIONS_TABLE); $phpbb_container->set('notification_manager', $phpbb_notifications); }
protected function setUp() { parent::setUp(); $this->db = $this->new_dbal(); $this->tools = new phpbb_db_tools($this->db); $this->table_data = array('COLUMNS' => array('c_id' => array('UINT', NULL, 'auto_increment'), 'c_uint' => array('UINT', 4)), 'PRIMARY_KEY' => 'c_id'); $this->tools->sql_create_table('prefix_table_name', $this->table_data); $this->table_exists = true; }
public function setUp() { global $db; $db = $this->new_dbal(); parent::setUp(); $this->request = new \phpbb_mock_request(); request_var(false, false, false, false, $this->request); $this->qa = new \phpbb\captcha\plugins\qa('phpbb_captcha_questions', 'phpbb_captcha_answers', 'phpbb_qa_confirm'); }
public function setUp() { parent::setUp(); $this->db = $this->new_dbal(); global $config; $config = $this->config = new \phpbb\config\config(array('nestedset_forum_lock' => 0)); $this->lock = new \phpbb\lock\db('nestedset_forum_lock', $this->config, $this->db); $this->set = new \phpbb\tree\nestedset_forum($this->db, $this->lock, 'phpbb_forums'); $this->set_up_forums(); }
public function setUp() { global $config; if (!isset($config)) { $config = new \phpbb\config\config(array()); } $this->get_test_case_helpers()->set_s9e_services(); $this->db = $this->new_dbal(); parent::setUp(); }
/** * Setup test environment */ public function setUp() { /* $sql = 'DELETE FROM phpbb_config;'; $sql .= 'DELETE FROM phpbb_gallery_albums;'; $sql .= 'DELETE FROM phpbb_gallery_comments;'; $sql .= 'DELETE FROM phpbb_gallery_images;'; $sql .= 'DELETE FROM phpbb_gallery_permissions;'; $sql .= 'DELETE FROM phpbb_gallery_roles;'; $sql .= 'DELETE FROM phpbb_gallery_users;'; $sql .= 'DELETE FROM phpbb_groups;'; $sql .= 'DELETE FROM phpbb_users;'; $sql .= 'DELETE FROM phpbb_user_group;'; $sql .= 'DELETE FROM phpbb_zebra;'; $this->db->sql_query($sql);*/ parent::setUp(); global $phpbb_dispatcher, $auth, $user, $cache, $db; //Let's build some deps $this->auth = $this->getMock('\\phpbb\\auth\\auth'); $auth = $this->auth; $config = $this->config = new \phpbb\config\config(array()); $this->db = $this->new_dbal(); $db = $this->db; $this->request = $this->getMock('\\phpbb\\request\\request'); $this->template = $this->getMockBuilder('\\phpbb\\template\\template')->getMock(); $this->user = $this->getMock('\\phpbb\\user', array(), array('\\phpbb\\datetime')); $this->user->method('lang')->will($this->returnArgument(0)); $this->user->expects($this->any())->method('create_datetime')->will($this->returnCallback(array($this, 'create_datetime_callback'))); $this->user->timezone = new \DateTimeZone('UTC'); $this->user->lang = array('datetime' => array(), 'DATE_FORMAT' => 'm/d/Y'); $user = $this->user; $this->controller_helper = $this->getMockBuilder('\\phpbb\\controller\\helper')->disableOriginalConstructor()->getMock(); $this->controller_helper->expects($this->any())->method('render')->willReturnCallback(function ($template_file, $page_title = '', $status_code = 200, $display_online_list = false) { return new \Symfony\Component\HttpFoundation\Response($template_file, $status_code); }); $this->controller_helper->method('route')->will($this->returnArgument(0)); $cache = $this->cache = new \phpbb\cache\service(new \phpbb\cache\driver\null(), $this->config, $this->db, $phpbb_root_path, $phpEx); $this->cache->purge(); $this->pagination = $this->getMockBuilder('\\phpbb\\pagination')->disableOriginalConstructor()->getMock(); $phpbb_dispatcher = $this->dispatcher = new \phpbb_mock_event_dispatcher(); $this->user_loader = $this->getMockBuilder('\\phpbb\\user_loader')->disableOriginalConstructor()->getMock(); $this->gallery_cache = new \phpbbgallery\core\cache($this->cache, $this->db, 'phpbb_gallery_albums', 'phpbb_gallery_images'); $this->gallery_user = new \phpbbgallery\core\user($this->db, $this->dispatcher, 'phpbb_gallery_users'); // Let's build auth class $this->gallery_auth = new \phpbbgallery\core\auth\auth($this->gallery_cache, $this->db, $this->gallery_user, $this->user, $this->auth, 'phpbb_gallery_permissions', 'phpbb_gallery_roles', 'phpbb_gallery_users', 'phpbb_gallery_albums'); $this->misc = $this->getMockBuilder('\\phpbbgallery\\core\\misc')->disableOriginalConstructor()->getMock(); $this->display = new \phpbbgallery\core\album\display($this->auth, $this->config, $this->controller_helper, $this->db, $this->pagination, $this->request, $this->template, $this->user, $this->gallery_auth, $this->gallery_user, $this->misc, '/', 'php', 'phpbb_gallery_albums', 'phpbb_gallery_contests', 'phpbb_gallery_albums_track', 'phpbb_gallery_albums_modscache'); $this->gallery_album = new \phpbbgallery\core\album\album($this->db, $this->user, 'phpbb_gallery_albums', 'phpbb_gallery_watch', 'phpbb_gallery_contests'); $this->gallery_config = new \phpbbgallery\core\config($this->config); $this->gallery_image = $this->getMockBuilder('\\phpbbgallery\\core\\image\\image')->disableOriginalConstructor()->getMock(); $this->gallery_image->method('get_status_orphan')->willReturn(3); // Let's build Search $this->gallery_search = new \phpbbgallery\core\search($this->db, $this->template, $this->user, $this->controller_helper, $this->gallery_config, $this->gallery_auth, $this->gallery_album, $this->gallery_image, $this->pagination, $this->user_loader, 'phpbb_gallery_images', 'phpbb_gallery_albums', 'phpbb_gallery_comments'); }
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, 'allow_board_notifications' => 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_driver = new \phpbb\cache\driver\dummy(); $cache = $this->cache = new \phpbb\cache\service($cache_driver, $this->config, $this->db, $phpbb_root_path, $phpEx); $this->phpbb_dispatcher = new phpbb_mock_event_dispatcher(); $phpbb_container = $this->container = new ContainerBuilder(); $loader = new YamlFileLoader($phpbb_container, new FileLocator(__DIR__ . '/fixtures')); $loader->load('services_notification.yml'); $phpbb_container->set('user_loader', $this->user_loader); $phpbb_container->set('user', $user); $phpbb_container->set('config', $this->config); $phpbb_container->set('dbal.conn', $this->db); $phpbb_container->set('auth', $auth); $phpbb_container->set('cache.driver', $cache_driver); $phpbb_container->set('cache', $cache); $phpbb_container->set('text_formatter.utils', new \phpbb\textformatter\s9e\utils()); $phpbb_container->set('dispatcher', $this->phpbb_dispatcher); $phpbb_container->setParameter('core.root_path', $phpbb_root_path); $phpbb_container->setParameter('core.php_ext', $phpEx); $phpbb_container->setParameter('tables.notifications', 'phpbb_notifications'); $phpbb_container->setParameter('tables.user_notifications', 'phpbb_user_notifications'); $phpbb_container->setParameter('tables.notification_types', 'phpbb_notification_types'); $this->notifications = new phpbb_notification_manager_helper(array(), array(), $this->container, $this->user_loader, $this->phpbb_dispatcher, $this->db, $this->cache, $this->user, 'phpbb_notification_types', 'phpbb_user_notifications'); $phpbb_container->set('notification_manager', $this->notifications); $phpbb_container->compile(); $this->notifications->setDependencies($this->auth, $this->config); $types = array(); foreach ($this->get_notification_types() as $type) { $class = $this->build_type($type); $types[$type] = $class; } $this->notifications->set_var('notification_types', $types); $methods = array(); foreach ($this->get_notification_methods() as $method) { $class = $this->container->get($method); $methods[$method] = $class; } $this->notifications->set_var('notification_methods', $methods); $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'); }
protected function setUp() { global $phpbb_root_path, $phpEx, $db, $phpbb_dispatcher, $auth; $db = $this->new_dbal(); $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); $user = new \phpbb\user('\\phpbb\\datetime'); $user->data['user_id'] = 1; $auth = $this->getMock('\\phpbb\\auth\\auth'); $this->log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE); parent::setUp(); }
function setUp() { parent::setUp(); global $symfony_request, $phpbb_filesystem, $phpbb_path_helper, $request, $phpbb_root_path, $phpEx; $symfony_request = new \phpbb\symfony_request(new phpbb_mock_request()); $phpbb_filesystem = new \phpbb\filesystem\filesystem(); $phpbb_path_helper = new \phpbb\path_helper($symfony_request, $phpbb_filesystem, $this->getMock('\\phpbb\\request\\request'), $phpbb_root_path, $phpEx); $this->session_factory = new phpbb_session_testable_factory(); $this->db = $this->new_dbal(); $this->session_facade = new phpbb_session_testable_facade($this->db, $this->session_factory); }
protected function setUp() { parent::setUp(); global $table_prefix; $this->db = $this->new_dbal(); $config = new \phpbb\config\config(array(prefixes::CONFIG . '_display_tagcount_in_tagcloud' => true, prefixes::CONFIG . '_max_tags_in_tagcloud' => 1)); $this->template = $this->getMock('\\phpbb\\template\\template'); $this->user = $this->getMockBuilder('\\phpbb\\user')->disableOriginalConstructor()->getMock(); $this->helper = $this->getMockBuilder('\\phpbb\\controller\\helper')->disableOriginalConstructor()->getMock(); $this->tagcloud_manager = new tagcloud_manager($this->db, $config, $this->template, $this->user, $this->helper, $table_prefix); }
protected function setUp() { parent::setUp(); global $table_prefix; $this->db = $this->new_dbal(); $this->auth = $this->getMock('\\phpbb\\auth\\auth'); $config = new \phpbb\config\config(array(prefixes::CONFIG . '_allowed_tags_regex' => '/^[a-zäÄ]{3,30}$/i')); $this->config_text = new \phpbb\config\db_text($this->db, $table_prefix . 'config_text'); $db_helper = new \robertheim\topictags\service\db_helper($this->db); $this->tags_manager = new tags_manager($this->db, $config, $this->config_text, $this->auth, $db_helper, $table_prefix); }
protected function setUp() { parent::setUp(); global $cache, $config, $db, $phpbb_dispatcher, $phpbb_container; $db = $this->db = $this->new_dbal(); $config = new \phpbb\config\config(array('load_online_time' => 5, 'search_type' => '\\phpbb\\search\\fulltext_mysql')); $cache = new phpbb_mock_null_cache(); $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); $phpbb_container = new phpbb_mock_container_builder(); $phpbb_container->set('notification_manager', new phpbb_mock_notification_manager()); }
public function setUp() { global $db, $request, $phpbb_container; $db = $this->new_dbal(); parent::setUp(); $request = new \phpbb_mock_request(); $phpbb_container = new \phpbb_mock_container_builder(); $factory = new \phpbb\db\tools\factory(); $phpbb_container->set('dbal.tools', $factory->get($db)); $this->qa = new \phpbb\captcha\plugins\qa('phpbb_captcha_questions', 'phpbb_captcha_answers', 'phpbb_qa_confirm'); }