28 lines
854 B
PHP
28 lines
854 B
PHP
|
<?php
|
||
|
|
||
|
namespace Opdavies\Tests\DrupalModuleGenerator\Command;
|
||
|
|
||
|
use Opdavies\DrupalModuleGenerator\Command\GenerateDrupal7Command;
|
||
|
use Opdavies\DrupalModuleGenerator\Exception\CannotCreateModuleException;
|
||
|
use Symfony\Component\Console\Tester\CommandTester;
|
||
|
use PHPUnit\Framework\TestCase;
|
||
|
|
||
|
class GenerateDrupal7ModuleCommandTest extends TestCase
|
||
|
{
|
||
|
/** @test */
|
||
|
public function it_throws_an_exception_if_the_directory_already_exists() {
|
||
|
mkdir('my-existing-drupal-module');
|
||
|
|
||
|
try {
|
||
|
$commandTester = new CommandTester(new GenerateDrupal7Command());
|
||
|
$commandTester->execute([
|
||
|
'module-name' => 'my-existing-drupal-module',
|
||
|
]);
|
||
|
} catch (CannotCreateModuleException $e) {
|
||
|
$this->addToAssertionCount(1);
|
||
|
}
|
||
|
|
||
|
rmdir('my-existing-drupal-module');
|
||
|
}
|
||
|
}
|