public function testInstall()
 {
     $package = $this->getMockBuilder('Package')->setMethods(['getExtra'])->getMock();
     $package->expects($this->once())->method('getExtra')->will($this->returnValue(['symfony-app-dir' => $this->tempDir]));
     $composer = $this->getMockBuilder('Composer')->setMethods(['getPackage'])->getMock();
     $composer->expects($this->once())->method('getPackage')->will($this->returnValue($package));
     $console = $this->getMockBuilder('Composer\\IO\\ConsoleIO')->setMethods(['write', 'ask'])->getMock();
     $console->expects($this->any())->method('ask')->will($this->returnValue('myValue'));
     $event = $this->getMockBuilder('Composer\\Script\\Event')->setMethods(['getComposer', 'getIO'])->getMock();
     $event->expects($this->once())->method('getComposer')->will($this->returnValue($composer));
     $event->expects($this->once())->method('getIO')->will($this->returnValue($console));
     // after so many mockup, this is what I call the undoubtful proof for a violation of Demeter's law somewhere
     // Remember, everytime you broke Demeter's law, God kills a kitten. Please think of the kitten
     $this->assertFileNotExists($this->generated);
     Script::installPlatform($event);
     $this->assertFileExists($this->generated);
     $customCfg = \Symfony\Component\Yaml\Yaml::parse(file_get_contents($this->generated));
     $this->assertEquals('myValue', $customCfg['parameters']['oneParam']);
 }
示例#2
0
 /**
  * Loading the config for the current evironment 
  * and importing platform-specific parameters depending of computer's name
  * 
  * With this system you can store/commit/track (or not with .gitignore) every change in
  * every config on every computer. Reduce the rate of "But it works on my computer !"
  * 
  * I prefer this system than one from Incenteev but you can mix both
  * 
  * @param \Symfony\Component\Config\Loader\LoaderInterface $loader
  */
 public function registerContainerConfiguration(LoaderInterface $loader)
 {
     $loader->load($this->rootDir . '/config/config_' . $this->getEnvironment() . '.yml');
     $loader->import($this->rootDir . Script::getPlatformSubdir() . Script::getPlatformName() . '.yml');
 }