Note that this method is overloaded; you can pass in different
value types for the $config parameter.
* null|false -- This will not load any new configuration values;
you will get only the default values defined in the Solar class.
* string -- The string is treated as a path to a Solar.config.php
file; the return value from that file will be used for [[Solar_Config::load()]].
* array -- This will use the passed array for the [[Solar_Config::load()]]
values.
* object -- The passed object will be cast as an array, and those
values will be used for [[Solar_Config::load()]].
Here are some examples of starting with alternative configuration parameters:
{{code: php
require_once 'Solar.php';
don't load any config values at all
Solar::start();
point to a config file (which returns an array)
Solar::start('/path/to/another/config.php');
use an array as the config source
$config = array(
'Solar' => array(
'ini_set' => array(
'error_reporting' => E_ALL,
),
),
);
Solar::start($config);
use an object as the config source
$config = new StdClass;
$config->Solar = array(
'ini_set' => array(
'error_reporting' => E_ALL,
),
);
Solar::start($config);
}}
public function testGetTextRaw_badLocaleKey() { Solar::start(false); $actual = $this->_view->getTextRaw('no such "locale" key'); $expect = 'no such "locale" key'; $this->assertSame($actual, $expect); }
public function setup() { Solar::start(false); // to get the $locale object parent::setup(); // when running from the command line, these elements are empty. // add them so that web-like testing can occur. $this->_request->server['HTTP_HOST'] = 'example.com'; $this->_request->server['SCRIPT_NAME'] = '/path/to/index.php'; $this->_request->server['PATH_INFO'] = '/appname/action'; $this->_request->server['QUERY_STRING'] = ''; $this->_request->server['REQUEST_URI'] = $this->_request->server['SCRIPT_NAME'] . $this->_request->server['PATH_INFO'] . '?' . $this->_request->server['QUERY_STRING']; // emulate GET vars from the URI and inject to $this->_request parse_str($this->_request->server['QUERY_STRING'], $this->_request->get); }
* * When you're ready to really get going, point your web server document root * to `system/docroot/` and turn on mod_rewrite. * */ // Solar system directory $system = dirname(__FILE__); // set the include-path set_include_path("{$system}/include"); // load Solar require_once 'Solar.php'; // get the system config array $config = (require "{$system}/config.php"); // force the Action and Public URI path configs, overwriting anything from // the original config $path = $_SERVER['REQUEST_URI']; $pos = strpos($path, "/index.php"); if ($pos !== false) { // strip "/index.php" and everything after it $path = substr($path, 0, $pos); } $path = rtrim($path, '/'); $config['Solar_Uri_Action']['path'] = "{$path}/index.php"; $config['Solar_Uri_Public']['path'] = "{$path}/docroot/public"; // start Solar with the modified config values Solar::start($config); // instantiate and run the front controller $front = Solar_Registry::get('controller_front'); $front->display(); // Done! Solar::stop();
public function setup() { Solar::start(false); // to get the $locale object parent::setup(); }
<?php set_include_path('../include'); require_once 'Solar.php'; $config_file = '../config/JForg.conf.php'; Solar::start($config_file); $front = Solar::factory('Solar_Controller_Front'); $front->display(); Solar::stop();
<?php /** * * Copy this file, edit the SOLAR_CONFIG_PATH to point to your * config file, then run from the command line. * */ define('SOLAR_CONFIG_PATH', '/path/to/Solar.config.php'); require 'Solar.php'; Solar::start(); $sql = Solar::factory('Solar_Sql'); // DROP INDEX nodes__unique_in_area__i ON nodes; $sql->dropIndex('nodes', 'unique_in_area'); // CREATE UNIQUE INDEX nodes__area_type_name__i ON nodes (area_id, type, name); $sql->createIndex('nodes', 'area_type_name', true, array('area_id', 'type', 'name')); // done! echo "Done!\n";
public function setUp() { Solar::start('config.inc.php'); }
public function setUp() { Solar::start('config.inc.php'); $this->_view = Solar::factory('Solar_View'); }