Ejemplo n.º 1
0
 /**
  * Initialize application. Should be run only once.
  * @param Configuration $configuration
  */
 public function bootstrap(Configuration $configuration = null)
 {
     $this->request = HttpRequest::createFromServer();
     $this->configuration = $configuration;
     $timeZone = $this->getConfiguration()->get('timezone');
     if ($timeZone) {
         date_default_timezone_set($timeZone);
     }
     if ($this->getConfiguration()->get('autoload')) {
         foreach ($this->getConfiguration()->get('autoload') as $dir) {
             $files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir, RecursiveDirectoryIterator::SKIP_DOTS), RecursiveIteratorIterator::SELF_FIRST);
             foreach ($files as $fileinfo) {
                 /** @var \SplFileInfo $fileinfo */
                 require_once $fileinfo->getRealPath();
             }
         }
     }
     $sl = new ServiceLocator($this->getConfiguration());
     $this->serviceLocator = $sl;
     $sl->register($configuration);
 }
Ejemplo n.º 2
0
 /**
  * @expectedException \Alien\Routing\Exception\InvalidHttpRequestException
  */
 public function testInvalidUriException()
 {
     $this->assertEmpty(HttpRequest::createFromString('GET    HTTP/1.2'));
 }