public function testKeepPrivate()
 {
     $configJson = array('scripts' => array('pre-update-cmd' => array('ContaoCommunityAlliance\\ComposerInstaller\\ModuleInstaller::preUpdate', 'TestVendor\\Hook::run'), 'post-update-cmd' => 'OtherVendor\\Hook::run', 'post-autoload-dump' => 'ContaoCommunityAlliance\\ComposerInstaller\\ModuleInstaller::postAutoloadDump'));
     $messages = array();
     self::assertTrue(ConfigManipulator::removeObsoleteScripts($configJson, $messages));
     self::assertEquals(2, count($messages));
     self::assertEquals(array('scripts' => array('pre-update-cmd' => array(1 => 'TestVendor\\Hook::run'), 'post-update-cmd' => 'OtherVendor\\Hook::run')), $configJson);
 }
Exemple #2
0
 public function testDoNothingForContaoModule()
 {
     $configJson = array('type' => 'contao-module', 'require' => array('some/package' => '~1.0'));
     $messages = array();
     self::assertFalse(ConfigManipulator::updateRequirements($configJson, $messages));
     self::assertEmpty($messages);
     self::assertEquals(array('type' => 'contao-module', 'require' => array('some/package' => '~1.0')), $configJson);
 }
 public function testNotRemoveVersion()
 {
     $configJson = array('name' => 'contao/core', 'description' => 'contao core', 'license' => 'LGPL-3.0', 'type' => 'project', 'version' => '0.0.0.0');
     $messages = array();
     self::assertFalse(ConfigManipulator::removeObsoleteContaoVersion($configJson, $messages));
     self::assertEmpty($messages);
     self::assertEquals(array('name' => 'contao/core', 'description' => 'contao core', 'license' => 'LGPL-3.0', 'type' => 'project', 'version' => '0.0.0.0'), $configJson);
 }
 public function testNotRemoveSwiftMailerFromCustomProject()
 {
     $configJson = array('name' => 'local/website', 'provide' => array('swiftmailer/swiftmailer' => '0.0.0.0'));
     $messages = array();
     self::assertFalse(ConfigManipulator::removeObsoleteProvides($configJson, $messages));
     self::assertEmpty($messages);
     self::assertEquals(array('name' => 'local/website', 'provide' => array('swiftmailer/swiftmailer' => '0.0.0.0')), $configJson);
 }
 public function testDoNothingForContaoModule()
 {
     $configJson = array('type' => 'contao-module');
     $messages = array();
     self::assertFalse(ConfigManipulator::restoreRepositories($configJson, $messages));
     self::assertEmpty($messages);
     self::assertEquals(array('type' => 'contao-module'), $configJson);
 }
 public function testRemoveArtifactPath()
 {
     $configJson = array('extra' => array('contao' => array('somedata' => 'some-value', 'artifactPath' => '/home/contao/packages')));
     $messages = array();
     self::assertTrue(ConfigManipulator::removeObsoleteConfigEntries($configJson, $messages));
     self::assertEquals(1, count($messages));
     self::assertEquals(array('extra' => array('contao' => array('somedata' => 'some-value'))), $configJson);
 }
Exemple #7
0
 /**
  * Handle command events.
  *
  * @param CommandEvent $event The event being raised.
  *
  * @return void
  *
  * @throws \RuntimeException When the artifact directory could not be created.
  */
 public function handleCommand(CommandEvent $event)
 {
     switch ($event->getCommandName()) {
         case 'update':
             ConfigManipulator::run();
             break;
         default:
     }
 }
 public function testDoNotSetComponentsDirForContaoModule()
 {
     $configJson = array('name' => 'local/website', 'license' => 'LGPL-3.0', 'type' => 'contao-module', 'description' => 'My Website');
     $messages = array();
     self::assertFalse(ConfigManipulator::restoreNeededConfigKeys($configJson, $messages));
     self::assertEquals(array('name' => 'local/website', 'license' => 'LGPL-3.0', 'type' => 'contao-module', 'description' => 'My Website'), $configJson);
     self::assertEmpty($messages);
 }