diff --git a/Test/Builders/a.php b/Test/Builders/a.php index 8990f827a..19860f50a 100644 --- a/Test/Builders/a.php +++ b/Test/Builders/a.php @@ -6,6 +6,12 @@ use Drupal\Console\Generator\AuthenticationProviderGenerator; use Drupal\Console\Generator\CommandGenerator; use Drupal\Console\Generator\EntityBundleGenerator; +use Drupal\Console\Generator\FormGenerator; +use Drupal\Console\Generator\ServiceGenerator; +use Drupal\Console\Utils\ChainQueue; +use Drupal\Console\Utils\StringConverter; +use Drupal\Core\Render\ElementInfoManager; +use Drupal\Core\Routing\RouteProvider; use Prophecy\Prophet; class a @@ -37,11 +43,62 @@ public static function authenticationProviderGenerator() return self::prophet()->prophesize(AuthenticationProviderGenerator::class); } + /** + * @return \Prophecy\Prophecy\ObjectProphecy + */ public static function commandGenerator() { return self::prophet()->prophesize(CommandGenerator::class); } + /** + * @return \Prophecy\Prophecy\ObjectProphecy + */ + public static function stringConverter() + { + return self::prophet()->prophesize(StringConverter::class); + } + + /** + * @return \Prophecy\Prophecy\ObjectProphecy + */ + public static function formGenerator() + { + return self::prophet()->prophesize(FormGenerator::class); + } + + /** + * @return \Prophecy\Prophecy\ObjectProphecy + */ + public static function routeProvider() + { + return self::prophet()->prophesize(RouteProvider::class); + } + + /** + * @return \Prophecy\Prophecy\ObjectProphecy + */ + public static function elementInfoManager() + { + return self::prophet()->prophesize(ElementInfoManager::class); + } + + /** + * @return \Prophecy\Prophecy\ObjectProphecy + */ + public static function chainQueue() + { + return self::prophet()->prophesize(ChainQueue::class); + } + + /** + * @return \Prophecy\Prophecy\ObjectProphecy + */ + public static function serviceGenerator() + { + return self::prophet()->prophesize(ServiceGenerator::class); + } + /** * @return Prophet */ diff --git a/Test/Command/Generate/ServiceCommandTest.php b/Test/Command/Generate/ServiceCommandTest.php index ddf872272..d9fda162a 100644 --- a/Test/Command/Generate/ServiceCommandTest.php +++ b/Test/Command/Generate/ServiceCommandTest.php @@ -7,6 +7,7 @@ namespace Drupal\Console\Test\Command\Generate; use Drupal\Console\Command\Generate\ServiceCommand; +use Drupal\Console\Test\Builders\a; use Symfony\Component\Console\Tester\CommandTester; use Drupal\Console\Test\DataProvider\ServiceDataProviderTrait; use Drupal\Console\Test\Command\GenerateCommandTest; @@ -35,9 +36,12 @@ public function testGenerateService( $services, $path_service ) { - $command = new ServiceCommand($this->getHelperSet()); - $command->setHelperSet($this->getHelperSet()); - $command->setGenerator($this->getGenerator()); + $command = new ServiceCommand( + a::extensionManager(), + a::serviceGenerator()->reveal(), + a::stringConverter()->reveal(), + a::chainQueue()->reveal() + ); $commandTester = new CommandTester($command); @@ -59,13 +63,4 @@ public function testGenerateService( $this->assertEquals(0, $code); } - - private function getGenerator() - { - return $this - ->getMockBuilder('Drupal\Console\Generator\ServiceGenerator') - ->disableOriginalConstructor() - ->setMethods(['generate']) - ->getMock(); - } }