Refactor
Use tearDown, update module name
This commit is contained in:
parent
0e5fbd2cec
commit
000716d670
1 changed files with 16 additions and 11 deletions
|
@ -9,20 +9,21 @@ use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class GenerateDrupal7ModuleCommandTest extends TestCase
|
class GenerateDrupal7ModuleCommandTest extends TestCase
|
||||||
{
|
{
|
||||||
|
protected function tearDown(): void
|
||||||
|
{
|
||||||
|
rmdir('test_module');
|
||||||
|
}
|
||||||
|
|
||||||
/** @test */
|
/** @test */
|
||||||
public function it_throws_an_exception_if_the_directory_already_exists() {
|
public function it_throws_an_exception_if_the_directory_already_exists() {
|
||||||
mkdir('my-existing-drupal-module');
|
mkdir('test_module');
|
||||||
|
|
||||||
try {
|
$this->expectExceptionObject(CannotCreateModuleException::directoryAlreadyExists());
|
||||||
$commandTester = new CommandTester(new GenerateDrupal7Command());
|
|
||||||
$commandTester->execute([
|
|
||||||
'module-name' => 'my-existing-drupal-module',
|
|
||||||
]);
|
|
||||||
} catch (CannotCreateModuleException $e) {
|
|
||||||
$this->addToAssertionCount(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
rmdir('my-existing-drupal-module');
|
$commandTester = new CommandTester(new GenerateDrupal7Command());
|
||||||
|
$commandTester->execute([
|
||||||
|
'module-name' => 'test_module'
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @test */
|
/** @test */
|
||||||
|
@ -30,7 +31,11 @@ class GenerateDrupal7ModuleCommandTest extends TestCase
|
||||||
{
|
{
|
||||||
$commandTester = new CommandTester(new GenerateDrupal7Command());
|
$commandTester = new CommandTester(new GenerateDrupal7Command());
|
||||||
$commandTester->execute([
|
$commandTester->execute([
|
||||||
'module-name' => 'my-new-drupal-module',
|
'module-name' => 'test_module',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->assertTrue(is_dir('test_module'));
|
||||||
|
}
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->assertTrue(is_dir('my-new-drupal-module'));
|
$this->assertTrue(is_dir('my-new-drupal-module'));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue