コード例 #1
0
ファイル: InjectCoreBundlesTest.php プロジェクト: Jobu/core
 /**
  * Test that the core bundles get correctly injected.
  *
  * @return void
  */
 public function testInjectCoreBundles()
 {
     $inOut = $this->getMock('Composer\\IO\\IOInterface');
     $factory = new Factory();
     $composer = $factory->createComposer($inOut, $this->config);
     $plugin = new Plugin();
     $local = $composer->getRepositoryManager()->getLocalRepository();
     if ($core = $local->findPackages('contao/core')) {
         $this->fail('Contao core has already been injected, found version ' . $core[0]->getVersion());
     }
     $plugin->activate($composer, $inOut);
     if (!($core = $local->findPackages('contao/core'))) {
         $this->fail('Contao core has not been injected.');
     }
     $core = $core[0];
     $constraint = new Constraint('=', $core->getVersion());
     $pool = new Pool('dev');
     $pool->addRepository($local);
     $this->assertNotNull($core = $pool->whatProvides('contao/core', $constraint));
     // bundle names + 'contao-community-alliance/composer-client'
     $this->assertCount(8, $core[0]->getRequires());
     foreach (array('contao/calendar-bundle', 'contao/comments-bundle', 'contao/core-bundle', 'contao/faq-bundle', 'contao/listing-bundle', 'contao/news-bundle', 'contao/newsletter-bundle') as $bundleName) {
         $this->assertNotNull($matches = $pool->whatProvides($bundleName, $constraint));
         $this->assertCount(1, $matches);
         $this->assertEquals('metapackage', $matches[0]->getType());
     }
 }
コード例 #2
0
ファイル: IssuesTest.php プロジェクト: Jobu/core
 /**
  * When the plugin is loaded, the event listeners are registered which require the Housekeeper.
  *
  * When the plugin gets uninstalled the housekeeper does not exist anymore and a "Housekeeper class not found" is
  * thrown.
  *
  * Test for https://github.com/contao-community-alliance/composer-plugin/issues/30
  *
  * Situation:
  *  - plugin is installed.
  *  - plugin get uninstalled.
  *
  * Result:
  *  - Housekeeper class not found.
  *
  * @return void
  */
 public function testIssue30LoadHousekeeper()
 {
     $inOut = $this->getMock('Composer\\IO\\IOInterface');
     $factory = new Factory();
     $composer = $factory->createComposer($inOut);
     $plugin = new Plugin();
     $plugin->activate($composer, $inOut);
     $this->assertTrue(class_exists('ContaoCommunityAlliance\\Composer\\Plugin\\Housekeeper', false));
 }