|
7 | 7 | use Composer\Factory; |
8 | 8 | use Composer\IO\IOInterface; |
9 | 9 | use Composer\IO\NullIO; |
| 10 | +use Composer\Package\Package; |
10 | 11 | use Composer\Plugin\PluginManager; |
11 | 12 | use IonBazan\ComposerDiff\Command\DiffCommand; |
12 | 13 | use IonBazan\ComposerDiff\PackageDiff; |
@@ -46,11 +47,13 @@ public function testComposerApplication($expectedOutput, array $input) |
46 | 47 | $app = new ComposerApplication(); |
47 | 48 | $app->setIO(new NullIO()); // For Composer v1 |
48 | 49 | $app->setAutoExit(false); |
49 | | - $composer = Factory::create($app->getIO(), null, true); |
| 50 | + $plugin = $this->getPluginPackage(); |
| 51 | + $config = array('allow-plugins' => array($plugin->getName() => true)); |
| 52 | + $composer = Factory::create($app->getIO(), array('config' => $config), true); |
50 | 53 | $app->setComposer($composer); |
51 | 54 | $pm = new PluginManager($app->getIO(), $composer); |
52 | 55 | $composer->setPluginManager($pm); |
53 | | - $pm->registerPackage($composer->getPackage(), true); |
| 56 | + $pm->registerPackage($plugin, true); |
54 | 57 | $tester = new ApplicationTester($app); |
55 | 58 | $result = $tester->run($input, array('verbosity' => Output::VERBOSITY_VERY_VERBOSE)); |
56 | 59 | $this->assertSame($expectedOutput, $tester->getDisplay()); |
@@ -232,6 +235,17 @@ public function commandArgumentsDataProvider() |
232 | 235 | ), |
233 | 236 | ); |
234 | 237 | } |
| 238 | + |
| 239 | + /** |
| 240 | + * @return Package |
| 241 | + */ |
| 242 | + private function getPluginPackage() |
| 243 | + { |
| 244 | + $plugin = new Package('test-plugin-package', '1.0', '1.0'); |
| 245 | + $plugin->setExtra(array('class' => 'IonBazan\ComposerDiff\Composer\Plugin')); |
| 246 | + |
| 247 | + return $plugin; |
| 248 | + } |
235 | 249 | } |
236 | 250 |
|
237 | 251 | class ComposerApplication extends Application |
|
0 commit comments