Inheritance: extends phpbb_test_case
 public function setUp()
 {
     parent::setUp();
     $this->get_db();
     $this->phpbb_extension_manager = $this->get_extension_manager();
     $this->purge_cache();
 }
Beispiel #2
0
 public function setUp()
 {
     parent::setUp();
     $this->login();
     $this->admin_login();
     $this->add_lang('acp/users');
 }
Beispiel #3
0
 public function setUp()
 {
     parent::setUp();
     $this->set_extension_group_permission(1);
     $this->path = __DIR__ . '/fixtures/files/';
     $this->add_lang('posting');
     $this->login();
 }
 public function setUp()
 {
     parent::setUp();
     $this->path = __DIR__ . '/fixtures/files/';
     $this->login();
     $this->admin_login();
     $this->add_lang(array('acp/board', 'ucp', 'acp/users', 'acp/groups'));
     $this->set_acp_settings();
 }
 public function setUp()
 {
     parent::setUp();
     $this->phpbb_extension_manager = $this->get_extension_manager();
     $this->purge_cache();
     $this->phpbb_extension_manager->enable('foo/bar');
     $this->login();
     $this->admin_login();
     $this->add_lang('acp/extensions');
 }
 public function setUp()
 {
     parent::setUp();
     // Load all language files
     $this->add_lang_ext('robertheim/topictags', array('info_acp_topictags', 'permissions_topictags', 'topictags_acp', 'topictags'));
     global $table_prefix;
     $this->auth = $this->getMock('\\phpbb\\auth\\auth');
     $config = new \phpbb\config\config(array(prefixes::CONFIG . '_allowed_tags_regex' => '/^[a-z]{3,30}$/i'));
     $db_helper = new db_helper($this->get_db());
     $config_text = new \phpbb\config\db_text($this->get_db(), $table_prefix . 'config_text');
     $this->tags_manager = new \robertheim\topictags\service\tags_manager($this->get_db(), $config, $config_text, $this->auth, $db_helper, $table_prefix);
 }
 public function setUp()
 {
     parent::setUp();
     $this->get_db();
     // Clear the phpbb_ext table
     $this->db->sql_query('DELETE FROM phpbb_ext');
     // Insert our base data
     $insert_rows = array(array('ext_name' => 'vendor2/foo', 'ext_active' => true, 'ext_state' => 'b:0;'), array('ext_name' => 'vendor/moo', 'ext_active' => false, 'ext_state' => 'b:0;'), array('ext_name' => 'vendor/test2', 'ext_active' => true, 'ext_state' => 'b:0;'), array('ext_name' => 'vendor/test3', 'ext_active' => false, 'ext_state' => 'b:0;'));
     $this->db->sql_multi_insert('phpbb_ext', $insert_rows);
     $this->login();
     $this->admin_login();
     $this->add_lang('acp/extensions');
 }
 public function setUp()
 {
     parent::setUp();
     $this->get_db();
     $acl_ary = array('auth_option' => 'u_foo', 'is_global' => 1);
     $sql = 'INSERT INTO phpbb_acl_options ' . $this->db->sql_build_array('INSERT', $acl_ary);
     $this->db->sql_query($sql);
     $this->phpbb_extension_manager = $this->get_extension_manager();
     $this->purge_cache();
     $this->login();
     $this->admin_login();
     $this->add_lang('acp/permissions');
 }
 public function setUp()
 {
     parent::setUp();
     // Only doing this within the functional framework because we need a
     // URL
     // Global $config required by unique_id
     // Global $user required by fileupload::remote_upload
     global $config, $user;
     if (!is_array($config)) {
         $config = array();
     }
     $config['rand_seed'] = '';
     $config['rand_seed_last_update'] = time() + 600;
     $user = new phpbb_mock_user();
     $user->lang = new phpbb_mock_lang();
 }
Beispiel #10
0
    public function setUp()
    {
        global $db;
        parent::setUp();
        $this->phpbb_extension_manager = $this->get_extension_manager();
        $this->phpbb_extension_manager->enable('foo/bar');
        $modules = new acp_modules();
        $db = $this->get_db();
        $sql = 'SELECT module_id
			FROM ' . MODULES_TABLE . "\n\t\t\tWHERE module_langname = 'acp'\n\t\t\t\tAND module_class = 'ACP_CAT_DOT_MODS'";
        $result = $db->sql_query($sql);
        $module_id = (int) $db->sql_fetchfield('module_id');
        $db->sql_freeresult($result);
        $parent_data = array('module_basename' => '', 'module_enabled' => 1, 'module_display' => 1, 'parent_id' => $module_id, 'module_class' => 'acp', 'module_langname' => 'ACP_FOOBAR_TITLE', 'module_mode' => '', 'module_auth' => '');
        $modules->update_module_data($parent_data, true);
        $module_data = array('module_basename' => 'foo\\bar\\acp\\main_module', 'module_enabled' => 1, 'module_display' => 1, 'parent_id' => $parent_data['module_id'], 'module_class' => 'acp', 'module_langname' => 'ACP_FOOBAR_TITLE', 'module_mode' => 'mode', 'module_auth' => '');
        $modules->update_module_data($module_data, true);
        $parent_data = array('module_basename' => '', 'module_enabled' => 1, 'module_display' => 1, 'parent_id' => 0, 'module_class' => 'ucp', 'module_langname' => 'UCP_FOOBAR_TITLE', 'module_mode' => '', 'module_auth' => '');
        $modules->update_module_data($parent_data, true);
        $module_data = array('module_basename' => 'foo\\bar\\ucp\\main_module', 'module_enabled' => 1, 'module_display' => 1, 'parent_id' => $parent_data['module_id'], 'module_class' => 'ucp', 'module_langname' => 'UCP_FOOBAR_TITLE', 'module_mode' => 'mode', 'module_auth' => '');
        $modules->update_module_data($module_data, true);
        $this->purge_cache();
    }
 public function setUp()
 {
     parent::setUp();
     // Only doing this within the functional framework because we need a
     // URL
     // Global $config required by unique_id
     global $config, $phpbb_root_path, $phpEx;
     if (!is_array($config)) {
         $config = array();
     }
     $config['rand_seed'] = '';
     $config['rand_seed_last_update'] = time() + 600;
     $this->filesystem = new \phpbb\filesystem\filesystem();
     $this->language = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx));
     $this->request = $this->getMock('\\phpbb\\request\\request');
     $this->php_ini = new \bantu\IniGetWrapper\IniGetWrapper();
     $container = new phpbb_mock_container_builder();
     $container->set('files.filespec', new \phpbb\files\filespec($this->filesystem, $this->language, $this->php_ini, new \FastImageSize\FastImageSize(), $this->phpbb_root_path));
     $this->factory = new \phpbb\files\factory($container);
     $container->set('files.factory', $this->factory);
     $container->set('files.types.remote', new \phpbb\files\types\remote($this->factory, $this->language, $this->php_ini, $this->request, $phpbb_root_path));
     $this->phpbb_root_path = $phpbb_root_path;
 }
Beispiel #12
0
 public function __construct()
 {
     parent::__construct();
     $this->backupStaticAttributesBlacklist += array('phpbb_functional_ucp_allow_pm_test' => array('data'));
 }
Beispiel #13
0
 public function __construct($name = null, array $data = array(), $dataName = '')
 {
     parent::__construct($name, $data, $dataName);
     $this->backupStaticAttributesBlacklist += array('phpbb_functional_feed_test' => array('init_values'));
 }
 public function tearDown()
 {
     parent::tearDown();
     $this->purge_cache();
 }
Beispiel #15
0
 public function setUp()
 {
     parent::setUp();
 }
 /**
  * Helper for submitting a message (post or private message)
  *
  * @param string $posting_url
  * @param string $posting_contains
  * @param array $form_data
  * @return \Symfony\Component\DomCrawler\Crawler the crawler object
  */
 protected function submit_message($posting_url, $posting_contains, $form_data)
 {
     if (time() == self::$last_post_timestamp) {
         // Travis is too fast, so we have to wait to not mix up the post/topic order
         sleep(1);
     }
     self::$last_post_timestamp = time();
     $crawler = self::request('GET', $posting_url);
     $this->assertContains($this->lang($posting_contains), $crawler->filter('html')->text());
     if (!empty($form_data['upload_files'])) {
         for ($i = 0; $i < $form_data['upload_files']; $i++) {
             $file = array('tmp_name' => __DIR__ . '/../functional/fixtures/files/valid.jpg', 'name' => 'valid.jpg', 'type' => 'image/jpeg', 'size' => filesize(__DIR__ . '/../functional/fixtures/files/valid.jpg'), 'error' => UPLOAD_ERR_OK);
             $crawler = self::$client->request('POST', $posting_url, array('add_file' => $this->lang('ADD_FILE')), array('fileupload' => $file));
         }
         unset($form_data['upload_files']);
     }
     $hidden_fields = array($crawler->filter('[type="hidden"]')->each(function ($node, $i) {
         return array('name' => $node->attr('name'), 'value' => $node->attr('value'));
     }));
     foreach ($hidden_fields as $fields) {
         foreach ($fields as $field) {
             $form_data[$field['name']] = $field['value'];
         }
     }
     // Bypass time restriction that said that if the lastclick time (i.e. time when the form was opened)
     // is not at least 2 seconds before submission, cancel the form
     $form_data['lastclick'] = 0;
     // I use a request because the form submission method does not allow you to send data that is not
     // contained in one of the actual form fields that the browser sees (i.e. it ignores "hidden" inputs)
     // Instead, I send it as a request with the submit button "post" set to true.
     return self::request('POST', $posting_url, $form_data);
 }
 public function setUp()
 {
     parent::setUp();
     $this->path = __DIR__ . '/images/';
 }
 public function setUp()
 {
     parent::setUp();
     //$this->force_allow_birthday();
     //$this->require_birthday();
 }
Beispiel #19
0
 public function setUp()
 {
     parent::setUp();
     $this->login();
     $this->admin_login();
 }
 protected static function install_board()
 {
     global $phpbb_root_path, $phpEx;
     self::$config['table_prefix'] = 'phpbb_';
     self::recreate_database(self::$config);
     $config_file = $phpbb_root_path . "config.{$phpEx}";
     $config_file_dev = $phpbb_root_path . "config_dev.{$phpEx}";
     $config_file_test = $phpbb_root_path . "config_test.{$phpEx}";
     if (file_exists($config_file)) {
         if (!file_exists($config_file_dev)) {
             rename($config_file, $config_file_dev);
         } else {
             unlink($config_file);
         }
     }
     self::$cookieJar = new CookieJar();
     self::$client = new Goutte\Client(array(), null, self::$cookieJar);
     // Set client manually so we can increase the cURL timeout
     self::$client->setClient(new Guzzle\Http\Client('', array(Guzzle\Http\Client::DISABLE_REDIRECTS => true, 'curl.options' => array(CURLOPT_TIMEOUT => 120))));
     // Reset the curl handle because it is 0 at this point and not a valid
     // resource
     self::$client->getClient()->getCurlMulti()->reset(true);
     $parseURL = parse_url(self::$config['phpbb_functional_url']);
     $crawler = self::request('GET', 'install/index.php?mode=install');
     self::assertContains('Welcome to Installation', $crawler->filter('#main')->text());
     $form = $crawler->selectButton('submit')->form();
     // install/index.php?mode=install&sub=requirements
     $crawler = self::submit($form);
     self::assertContains('Installation compatibility', $crawler->filter('#main')->text());
     $form = $crawler->selectButton('submit')->form();
     // install/index.php?mode=install&sub=database
     $crawler = self::submit($form);
     self::assertContains('Database configuration', $crawler->filter('#main')->text());
     $form = $crawler->selectButton('submit')->form(array('dbms' => str_replace('phpbb_db_driver_', '', self::$config['dbms']), 'dbhost' => self::$config['dbhost'], 'dbport' => self::$config['dbport'], 'dbname' => self::$config['dbname'], 'dbuser' => self::$config['dbuser'], 'dbpasswd' => self::$config['dbpasswd'], 'table_prefix' => self::$config['table_prefix']));
     // install/index.php?mode=install&sub=database
     $crawler = self::submit($form);
     self::assertContains('Successful connection', $crawler->filter('#main')->text());
     $form = $crawler->selectButton('submit')->form();
     // install/index.php?mode=install&sub=administrator
     $crawler = self::submit($form);
     self::assertContains('Administrator configuration', $crawler->filter('#main')->text());
     $form = $crawler->selectButton('submit')->form(array('default_lang' => 'en', 'admin_name' => 'admin', 'admin_pass1' => 'adminadmin', 'admin_pass2' => 'adminadmin', 'board_email1' => '*****@*****.**', 'board_email2' => '*****@*****.**'));
     // install/index.php?mode=install&sub=administrator
     $crawler = self::submit($form);
     self::assertContains('Tests passed', $crawler->filter('#main')->text());
     $form = $crawler->selectButton('submit')->form();
     // We have to skip install/index.php?mode=install&sub=config_file
     // because that step will create a config.php file if phpBB has the
     // permission to do so. We have to create the config file on our own
     // in order to get the DEBUG constants defined.
     $config_php_data = phpbb_create_config_file_data(self::$config, self::$config['dbms'], array(), true, true);
     $config_created = file_put_contents($config_file, $config_php_data) !== false;
     if (!$config_created) {
         self::markTestSkipped("Could not write {$config_file} file.");
     }
     // We also have to create a install lock that is normally created by
     // the installer. The file will be removed by the final step of the
     // installer.
     $install_lock_file = $phpbb_root_path . 'cache/install_lock';
     $lock_created = file_put_contents($install_lock_file, '') !== false;
     if (!$lock_created) {
         self::markTestSkipped("Could not create {$lock_created} file.");
     }
     @chmod($install_lock_file, 0666);
     // install/index.php?mode=install&sub=advanced
     $form_data = $form->getValues();
     unset($form_data['submit']);
     $crawler = self::request('POST', 'install/index.php?mode=install&sub=advanced', $form_data);
     self::assertContains('The settings on this page are only necessary to set if you know that you require something different from the default.', $crawler->filter('#main')->text());
     $form = $crawler->selectButton('submit')->form(array('email_enable' => true, 'smtp_delivery' => true, 'smtp_host' => 'nxdomain.phpbb.com', 'smtp_auth' => 'PLAIN', 'smtp_user' => 'nxuser', 'smtp_pass' => 'nxpass', 'cookie_secure' => false, 'force_server_vars' => false, 'server_protocol' => $parseURL['scheme'] . '://', 'server_name' => 'localhost', 'server_port' => isset($parseURL['port']) ? (int) $parseURL['port'] : 80, 'script_path' => $parseURL['path']));
     // install/index.php?mode=install&sub=create_table
     $crawler = self::submit($form);
     self::assertContains('The database tables used by phpBB', $crawler->filter('#main')->text());
     self::assertContains('have been created and populated with some initial data.', $crawler->filter('#main')->text());
     $form = $crawler->selectButton('submit')->form();
     // install/index.php?mode=install&sub=final
     $crawler = self::submit($form);
     self::assertContains('You have successfully installed', $crawler->text());
     copy($config_file, $config_file_test);
 }
	protected function install_board()
	{
		global $phpbb_root_path, $phpEx;

		self::$config = phpbb_test_case_helpers::get_test_config();

		if (!isset(self::$config['phpbb_functional_url']))
		{
			return;
		}

		self::$config['table_prefix'] = 'phpbb_';
		$this->recreate_database(self::$config);

		if (file_exists($phpbb_root_path . "config.$phpEx"))
		{
			if (!file_exists($phpbb_root_path . "config_dev.$phpEx"))
			{
				rename($phpbb_root_path . "config.$phpEx", $phpbb_root_path . "config_dev.$phpEx");
			}
			else
			{
				unlink($phpbb_root_path . "config.$phpEx");
			}
		}

		// begin data
		$data = array();

		$data = array_merge($data, self::$config);

		$data = array_merge($data, array(
			'default_lang'	=> 'en',
			'admin_name'	=> 'admin',
			'admin_pass1'	=> 'admin',
			'admin_pass2'	=> 'admin',
			'board_email'	=> '*****@*****.**',
		));

		$parseURL = parse_url(self::$config['phpbb_functional_url']);

		$data = array_merge($data, array(
			'email_enable'		=> false,
			'smtp_delivery'		=> false,
			'smtp_host'		=> '',
			'smtp_auth'		=> '',
			'smtp_user'		=> '',
			'smtp_pass'		=> '',
			'cookie_secure'		=> false,
			'force_server_vars'	=> false,
			'server_protocol'	=> $parseURL['scheme'] . '://',
			'server_name'		=> 'localhost',
			'server_port'		=> isset($parseURL['port']) ? (int) $parseURL['port'] : 80,
			'script_path'		=> $parseURL['path'],
		));
		// end data

		$content = $this->do_request('install');
		$this->assertContains('Welcome to Installation', $content);

		$this->do_request('create_table', $data);

		file_put_contents($phpbb_root_path . "config.$phpEx", phpbb_create_config_file_data($data, self::$config['dbms'], array(), true));

		$this->do_request('config_file', $data);

		copy($phpbb_root_path . "config.$phpEx", $phpbb_root_path . "config_test.$phpEx");

		$this->do_request('final', $data);
	}
Beispiel #22
0
 public function setUp()
 {
     parent::setUp();
     $this->path = __DIR__ . '/fixtures/files/';
     $this->add_lang('posting');
 }