Ensure that the directory doesn't already exist
This commit is contained in:
parent
d17c1defcf
commit
0ece90c6cf
7 changed files with 217 additions and 4 deletions
tests/Command
27
tests/Command/GenerateDrupal7ModuleCommandTest.php
Normal file
27
tests/Command/GenerateDrupal7ModuleCommandTest.php
Normal file
|
@ -0,0 +1,27 @@
|
|||
<?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');
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue