public function setUp() { $system = realpath(__DIR__ . '/../../'); $options = array('production' => false, 'max_age' => 3600, 'load_paths' => array(), 'output_compression' => false, 'output_style' => 'none'); $container = new Scaffold_Container($system, $options); $this->object = $container->build(); }
public function testBuild() { $obj = $this->object->build(); $this->assertEquals(get_class($obj), 'Scaffold'); }
register_shutdown_function(array('Environment', 'shutdown_handler')); /** * Set the view to use for errors and exceptions */ Environment::set_view(realpath($system . '/views/error.php')); // ========================================= // = Start the scaffolding magic = // ========================================= // Make sure the config var is set if (!isset($config)) { $config = array(); } // The container creates Scaffold objects $container = new Scaffold_Container($system, $config); // This is where the magic happens $scaffold = $container->build(); // Get the requested source if (isset($_GET['file'])) { $source = new Scaffold_Source_File($scaffold->loader->find_file($_GET['file'])); } elseif (isset($_GET['url'])) { $source = new Scaffold_Source_Url($_GET['url']); } elseif (isset($_GET['string'])) { $source = new Scaffold_Source_String($_GET['string']); } else { echo 'No source :('; exit; } // Compiles the source object $source = $scaffold->compile($source); // Use the result to render it to the browser. Hooray! $scaffold->render($source);
/** * Set timezone, just in case it isn't set. PHP 5.3+ * throws a tantrum if you try and use time() without * this being set. */ date_default_timezone_set('GMT'); /** * Automatically load any Scaffold Classes */ Scaffold_Environment::auto_load(); /** * Let Scaffold handle errors */ Scaffold_Environment::handle_errors(); /** * Set the view to use for errors and exceptions */ Scaffold_Environment::set_view(realpath($system . '/views/error.php')); // ========================================= // = Start the scaffolding magic = // ========================================= // The container creates Scaffold objects $Container = new Scaffold_Container($system, $config); // This is where the magic happens $Scaffold = $Container->build(); // Get the sources $Source = $Scaffold->getSource(null, $config); // Compiles the source object $Source = $Scaffold->compile($Source); // Use the result to render it to the browser. Hooray! $Scaffold->render($Source);