public function testCreateWithDispatcher()
 {
     $config = new Config();
     $dispatcher = new EventDispatcher();
     $environment = new GlobalEnvironment(null, $config, null, $dispatcher);
     $this->assertSame($dispatcher, $environment->getEventDispatcher());
 }
예제 #2
0
 /**
  * Starts the service container.
  */
 public function start()
 {
     if ($this->started) {
         throw new LogicException('Puli is already started');
     }
     if ($this->rootDir) {
         $this->environment = $this->createProjectEnvironment($this->rootDir);
     } else {
         $this->environment = $this->createGlobalEnvironment();
     }
     $this->dispatcher = $this->environment->getEventDispatcher();
     $this->started = true;
     // Start plugins once the container is running
     if ($this->rootDir && $this->pluginsEnabled) {
         $this->activatePlugins();
     }
 }