/** * get the bootstrap file that will be used when calling phpunit * * this builds the boostrap file and saves it in the temp dir for every test * request, I thought about caching, but I'm not sure it is that big of a deal. * The great thing about doing it this way is it allows overriding of all the * stuff * * @since 7-28-11 * @return string the file path */ protected function getBootstrap() { $this->tmpl->setField('author', sprintf('Auto-generated by %s on %s', get_class($this), date(DATE_RFC822))); $framework_class_name = get_class($this->framework); $this->tmpl->setField('framework_class_name', $framework_class_name); // find all the framework paths... $rframework = new \ReflectionClass($framework_class_name); $framework_parent_list = array(); $framework_interface_list = array(); $framework_parent_list[] = $rframework->getFileName(); $rparent = $rframework->getParentClass(); do { if ($rparent = $rparent->getParentClass()) { $framework_parent_list[] = $rparent->getFileName(); } //if } while (!empty($rparent)); foreach ($rframework->getInterfaces() as $rinterface) { $framework_interface_list[] = $rinterface->getFileName(); } //foreach $this->tmpl->setField('framework_path_list', array_merge($framework_interface_list, array_reverse($framework_parent_list))); $this->tmpl->setField('app_path', $this->framework_config->getAppPath()); $temp_file = new Path(sys_get_temp_dir(), 'bootstrap.php'); // write out the bootsrap to the temp file... $temp_file->set($this->tmpl->render('bootstrap.php')); return $temp_file; }
/** * handle the framework initialization */ public function handleStart(\Montage\Event\Event $event) { $this->handleError(); mb_internal_encoding($this->config->getCharset()); date_default_timezone_set($this->config->getTimezone()); }