@@ -188,7 +188,6 @@ function ($args) use ($that) {
188188 }
189189
190190
191-
192191 /**
193192 * Given a root package with no requires
194193 * and a composer.local.json with one require, which includes a composer.local.2.json
@@ -225,6 +224,7 @@ function ($args) use (&$packages) {
225224 $ this ->assertEquals (0 , count ($ extraInstalls ));
226225 }
227226
227+
228228 /**
229229 * Given a root package with no requires that disables recursion
230230 * and a composer.local.json with one require, which includes a composer.local.2.json
@@ -261,6 +261,7 @@ function ($args) use (&$packages) {
261261 $ this ->assertEquals (0 , count ($ extraInstalls ));
262262 }
263263
264+
264265 /**
265266 * Given a root package with requires
266267 * and a composer.local.json with requires
@@ -311,6 +312,7 @@ function ($args) use ($that) {
311312 $ this ->assertEquals ('foo ' , $ extraInstalls [1 ][0 ]);
312313 }
313314
315+
314316 /**
315317 * Given a root package
316318 * and a composer.local.json with a repository
@@ -391,6 +393,7 @@ function ($args) use ($that) {
391393 $ this ->assertEquals (0 , count ($ extraInstalls ));
392394 }
393395
396+
394397 /**
395398 * Given a root package
396399 * and a composer.local.json with required packages
@@ -449,6 +452,7 @@ function ($args) use ($that, &$expects) {
449452 $ this ->assertEquals (0 , count ($ extraInstalls ));
450453 }
451454
455+
452456 public function testMergedAutoload ()
453457 {
454458 $ that = $ this ;
@@ -528,6 +532,7 @@ function ($args) use ($that) {
528532 );
529533 }
530534
535+
531536 /**
532537 * Given a root package with an extra section
533538 * and a composer.local.json with an extra section with no conflicting keys
@@ -564,6 +569,7 @@ function ($args) use ($that) {
564569 $ this ->assertEquals (0 , count ($ extraInstalls ));
565570 }
566571
572+
567573 /**
568574 * Given a root package with an extra section
569575 * and a composer.local.json with an extra section with a conflicting key
@@ -600,6 +606,7 @@ function ($args) use ($that) {
600606 $ this ->assertEquals (0 , count ($ extraInstalls ));
601607 }
602608
609+
603610 /**
604611 * Given a root package with an extra section
605612 * and replace mode is active
@@ -637,6 +644,7 @@ function ($args) use ($that) {
637644 $ this ->assertEquals (0 , count ($ extraInstalls ));
638645 }
639646
647+
640648 /**
641649 * @dataProvider provideOnPostPackageInstall
642650 * @param string $package Package installed
@@ -665,6 +673,7 @@ public function testOnPostPackageInstall($package, $first, $locked)
665673 $ this ->assertEquals ($ locked , $ this ->getState ()->isLocked ());
666674 }
667675
676+
668677 public function provideOnPostPackageInstall ()
669678 {
670679 return array (
@@ -674,6 +683,7 @@ public function provideOnPostPackageInstall()
674683 );
675684 }
676685
686+
677687 /**
678688 * Given a root package with a branch alias
679689 * When the plugin is run
@@ -768,6 +778,7 @@ function ($args) use ($that, &$expects) {
768778 $ extraInstalls = $ this ->triggerPlugin ($ root ->reveal (), $ dir );
769779 }
770780
781+
771782 /**
772783 * Test replace link with self.version as version constraint.
773784 */
@@ -856,6 +867,7 @@ function ($args) use ($that, &$expects) {
856867 $ extraInstalls = $ this ->triggerPlugin ($ root ->reveal (), $ dir );
857868 }
858869
870+
859871 /**
860872 * Given a root package with merge-dev=false
861873 * and an include with require-dev and autoload-dev sections
@@ -884,6 +896,39 @@ function ($args) use ($that) {
884896 }
885897
886898
899+ /**
900+ * @expectedException \Wikimedia\Composer\Merge\MissingFileException
901+ */
902+ public function testMissingRequireThrowsException ()
903+ {
904+ $ dir = $ this ->fixtureDir (__FUNCTION__ );
905+ $ root = $ this ->rootFromJson ("{$ dir }/composer.json " );
906+ $ root ->getRequires ()->shouldNotBeCalled ();
907+ $ this ->triggerPlugin ($ root ->reveal (), $ dir );
908+ }
909+
910+
911+ public function testRequire ()
912+ {
913+ $ that = $ this ;
914+ $ dir = $ this ->fixtureDir (__FUNCTION__ );
915+
916+ $ root = $ this ->rootFromJson ("{$ dir }/composer.json " );
917+
918+ $ root ->setRequires (Argument::type ('array ' ))->will (
919+ function ($ args ) use ($ that ) {
920+ $ requires = $ args [0 ];
921+ $ that ->assertEquals (1 , count ($ requires ));
922+ $ that ->assertArrayHasKey ('monolog/monolog ' , $ requires );
923+ }
924+ );
925+
926+ $ extraInstalls = $ this ->triggerPlugin ($ root ->reveal (), $ dir );
927+
928+ $ this ->assertEquals (0 , count ($ extraInstalls ));
929+ }
930+
931+
887932 /**
888933 * @param RootPackage $package
889934 * @param string $directory Working directory for composer run
0 commit comments