@@ -15,14 +15,14 @@ class GeneratorModuleCommandTest extends GenerateCommandTest
1515 */
1616 public function testInteractive ($ options , $ expected , $ input )
1717 {
18- list ($ module , $ dir , $ description , $ core , $ package , $ controller , $ tests , $ setting , $ structure, $ skip_root ) = $ expected ;
18+ list ($ module , $ machine_name , $ dir , $ description , $ core , $ package , $ controller , $ tests , $ structure ) = $ expected ;
1919
2020 $ generator = $ this ->getGenerator ();
2121
2222 $ generator
2323 ->expects ($ this ->once ())
2424 ->method ('generate ' )
25- ->with ($ module , $ dir , $ description , $ core , $ package , $ controller , $ tests , $ setting , $ structure, $ skip_root )
25+ ->with ($ module , $ machine_name , $ dir , $ description , $ core , $ package , $ controller , $ tests , $ structure )
2626 ;
2727
2828 $ command = $ this ->getCommand ($ generator , $ input );
@@ -39,14 +39,8 @@ public function getInteractiveData()
3939 // case one basic options
4040 [
4141 [],
42- ['foo ' , $ dir , 'My Awesome Module ' , '8.x ' , 'Other ' , false , true , false , true , false ],
43- "foo \n$ dir \n"
44- ],
45- // case two skip-root
46- [
47- ['--skip-root ' => true ,'--module-path ' => $ dir ,'--description ' =>'My old module ' ,'--package ' =>'Other ' ],
48- ['foo ' , $ dir , "My old module " , '8.x ' , 'Other ' , false , true , false , true , true ],
49- "foo "
42+ ['foo ' , 'foo ' , $ dir , 'My Awesome Module ' , '8.x ' , 'Other ' , false , true , true ],
43+ "foo \nfoo \n$ dir \n"
5044 ],
5145 ];
5246 }
@@ -56,14 +50,14 @@ public function getInteractiveData()
5650 */
5751 public function testNoInteractive ($ options , $ expected )
5852 {
59- list ($ module , $ dir , $ description , $ core , $ package , $ controller , $ tests , $ setting , $ structure, $ skip_root ) = $ expected ;
53+ list ($ module , $ machine_name , $ dir , $ description , $ core , $ package , $ controller , $ tests , $ structure ) = $ expected ;
6054
6155 $ generator = $ this ->getGenerator ();
6256
6357 $ generator
6458 ->expects ($ this ->once ())
6559 ->method ('generate ' )
66- ->with ($ module , $ dir , $ description , $ core , $ package , $ controller , $ tests , $ setting , $ structure, $ skip_root )
60+ ->with ($ module , $ machine_name , $ dir , $ description , $ core , $ package , $ controller , $ tests , $ structure )
6761 ;
6862
6963 $ cmd = new CommandTester ($ this ->getCommand ($ generator ,'' ));
@@ -75,14 +69,13 @@ public function getNoInteractiveData()
7569 $ dir = sys_get_temp_dir ();
7670
7771 return [
78- // case one
7972 [
80- ['--module ' =>'bar ' , '--module-path ' =>$ dir , '--description ' =>'My Awesome Module ' ,'--core ' =>'8.x ' ,'--package ' =>'Other ' , '--controller ' =>true ,'--tests ' => true , ' --setting ' =>true ,'--structure ' =>true ],
81- ['bar ' , $ dir , "My Awesome Module " , '8.x ' , 'Other ' , true , true , true , true , false ],
73+ ['--module ' =>'foo ' , '--machine-name ' => ' foo ' , ' -- module-path ' =>$ dir , '--description ' =>'My Awesome Module ' ,'--core ' =>'8.x ' ,'--package ' =>'Other ' , '--controller ' =>true ,'--tests ' =>true ,'--structure ' =>true ],
74+ ['foo ' , ' foo ' , $ dir , "My Awesome Module " , '8.x ' , 'Other ' , true , true , true ],
8275 ],
8376 [
84- ['--module ' =>'bar ' , '--module-path ' =>$ dir ,'--description ' =>'My Awesome Module ' ,'--core ' =>'8.x ' ,'--package ' =>'Other ' , '--controller ' =>true ,'--tests ' =>true ,'--setting ' => true , ' -- structure' => true , ' --skip-root ' =>true ],
85- ['bar ' , $ dir , "My Awesome Module " , '8.x ' , 'Other ' , true , true , true , true , true ],
77+ ['--module ' =>'foo ' , '--machine-name ' => ' foo ' , ' -- module-path ' =>$ dir ,'--description ' =>'My Awesome Module ' ,'--core ' =>'8.x ' ,'--package ' =>'Other ' , '--controller ' =>true ,'--tests ' =>true ,'--structure ' =>true ],
78+ ['foo ' , ' foo ' , $ dir , "My Awesome Module " , '8.x ' , 'Other ' , true , true , true ],
8679 ]
8780 ];
8881 }
@@ -92,10 +85,15 @@ protected function getCommand($generator, $input)
9285 /** @var \Drupal\AppConsole\Command\GeneratorModuleCommand $command */
9386 $ command = $ this
9487 ->getMockBuilder ('Drupal\AppConsole\Command\GeneratorModuleCommand ' )
95- ->setMethods (['validateModule ' ])
88+ ->setMethods (['validateModuleName ' , ' validateModule ' ])
9689 ->getMock ()
9790 ;
9891
92+ $ command ->expects ($ this ->any ())
93+ ->method ('validateModuleName ' )
94+ ->will ($ this ->returnValue ('foo ' ));
95+ ;
96+
9997 $ command ->expects ($ this ->any ())
10098 ->method ('validateModule ' )
10199 ->will ($ this ->returnValue ('foo ' ));
0 commit comments