Populate more of the test stub

This commit is contained in:
Oliver Davies 2020-02-09 21:28:46 +00:00
parent ea2f5a4ae8
commit 0d6bd4e070
3 changed files with 25 additions and 2 deletions

View file

@ -1,5 +1,21 @@
<?php <?php
namespace Drupal\{{ name }}\Tests\Functional; namespace Drupal\{{ machine_name }}\Tests\Functional;
final class {{ test_name }} extends \DrupalWebTestCase {} final class {{ test_name }} extends \DrupalWebTestCase {
public static function getInfo() {
return array(
'name' => '{{ name }}',
'description' => '{{ name }} tests.',
'group' => '{{ name }}',
);
}
public function test_that_the_front_page_loads() {
$this->drupalGet('<front>');
$this->assertResponse(200);
}
}

View file

@ -120,6 +120,7 @@ final class GenerateDrupal7Command extends Command
private function updateFileContents($contents) private function updateFileContents($contents)
{ {
$contents = str_replace('{{ machine_name }}', $this->machineName, $contents);
$contents = str_replace('{{ name }}', $this->moduleName, $contents); $contents = str_replace('{{ name }}', $this->moduleName, $contents);
$contents = str_replace('{{ test_name }}', $this->testName, $contents); $contents = str_replace('{{ test_name }}', $this->testName, $contents);

View file

@ -109,6 +109,12 @@ final class GenerateDrupal7ModuleCommandTest extends TestCase
$contents = file_get_contents('test_module/src/Tests/Functional/TestModuleTest.php'); $contents = file_get_contents('test_module/src/Tests/Functional/TestModuleTest.php');
$this->assertStringContainsString('namespace Drupal\\test_module\\Tests\\Functional', $contents);
$this->assertStringContainsString('final class TestModuleTest', $contents); $this->assertStringContainsString('final class TestModuleTest', $contents);
$this->assertStringContainsString("'name' => 'Test Module'", $contents);
$this->assertStringContainsString("'description' => 'Test Module tests.'", $contents);
$this->assertStringContainsString("'group' => 'Test Module'", $contents);
} }
} }