/** * Test iteration */ public function testIteration() { $_SESSION['slim.flash'] = array('info' => 'foo', 'error' => 'bar'); $f = new \Slim\Middleware\Flash(); $f->loadMessages(); $output = ''; foreach ($f as $key => $value) { $output .= $key . $value; } $this->assertEquals('infofooerrorbar', $output); }
public function create_db(array $data) { Core::init_db($data); // Load appropriate language load_textdomain('featherbb', $this->feather->forum_env['FEATHER_ROOT'] . 'featherbb/lang/' . $data['default_lang'] . '/install.mo'); // Handle db prefix $data['db_prefix'] = !empty($data['db_prefix']) ? $data['db_prefix'] : ''; // Create tables foreach ($this->model->get_database_scheme() as $table => $sql) { if (!$this->model->create_table($data['db_prefix'] . $table, $sql)) { // Error handling $this->errors[] = 'A problem was encountered while creating table ' . $table; } } // Populate group table with default values foreach ($this->model->load_default_groups() as $group_name => $group_data) { $this->model->add_data('groups', $group_data); } // Populate user table with default values $this->model->add_data('users', $this->model->load_default_user()); $this->model->add_data('users', $this->model->load_admin_user($data)); // Populate categories, forums, topics, posts $this->model->add_mock_forum($this->model->load_mock_forum_data($data)); // Store config in DB $this->model->save_config($this->load_default_config($data)); // Handle .htaccess if (function_exists('apache_get_modules') && in_array('mod_rewrite', apache_get_modules())) { $this->write_htaccess(); } // Install success flash message $flash = new \Slim\Middleware\Flash(); $flash->set('success', __('Message')); $flash->save(); // Redirect to homepage Url::redirect($this->feather->urlFor('home')); }