/** * Sets up the fixture, for example, open a network connection. * This method is called before a test is executed. * * @access protected */ protected function setUp() { global $global, $dao; $global = array('approot' => realpath(dirname(__FILE__)) . '/../../../'); require_once $global['approot'] . '3rd/adodb/adodb.inc.php'; //Make the connection to $global['db'] $global['db'] = NewADOConnection('mysql'); $global['db']->Connect(TEST_DB_HOST, TEST_DB_USER, TEST_DB_PASSWD, TEST_DB_NAME); error_reporting(E_ALL ^ E_NOTICE); $dao = new DAO($global['db']); require_once '../main.inc'; shn_vm_load_db(); $this->fixture = new AccessController(); }
/** * shn_image_vm_display_image() * This lets us use Sahana's 'stream' functionality to display an image without resorting to * an extra file in /tmp. * Sahana automatically calls this, according to the shn_[stream]_[mod]_[act]() naming convention. */ function shn_image_vm_display_image() { // we're not going through our controller here, so we need to set up the database. shn_vm_load_db(); $img_uuid = $_GET['id']; $size = $_GET['size']; $p = new VMPicture($img_uuid); if ($size == 'thumb') { $p->displayThumb(); } else { $p->display(); } }