Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions Test/Builders/a.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
*/
Expand Down
19 changes: 7 additions & 12 deletions Test/Command/Generate/ServiceCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);

Expand All @@ -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();
}
}