[php-laravel] Fix file database/migrations/2019_08_19_000000 being written twice (#18832)

* Implement dedicated transitional test for #18831 bugfix

* Remove duplicated database migration file from supportingFiles collection

* Activate AllGeneratorsTest.noDuplicateSupportingFiles

* Drop transitional test again

* Simplify truthy assertions
This commit is contained in:
Philzen
2024-06-05 04:43:52 +02:00
committed by GitHub
parent aef4d75fd5
commit 45bc9c9e2f
4 changed files with 7 additions and 16 deletions

View File

@@ -202,9 +202,6 @@ public class PhpLaravelServerCodegen extends AbstractPhpCodegen {
supportingFiles.add(new SupportingFile("config/session.php", outputFolder + File.separator + "config", "session.php"));
supportingFiles.add(new SupportingFile("config/view.php", outputFolder + File.separator + "config", "view.php"));
// /database/
supportingFiles.add(new SupportingFile("database/migrations/2019_08_19_000000_create_failed_jobs_table.php", outputFolder + File.separator + "database" + File.separator + "migrations", "2019_08_19_000000_create_failed_jobs_table.php"));
// /resources/
supportingFiles.add(new SupportingFile("resources/js/app.js", outputFolder + File.separator + "resources" + File.separator + "assets" + File.separator + "js", "app.js"));
supportingFiles.add(new SupportingFile("resources/js/bootstrap.js", outputFolder + File.separator + "resources" + File.separator + "assets" + File.separator + "js", "bootstrap.js"));

View File

@@ -86,8 +86,7 @@ public class AllGeneratorsTest {
);
}
@Test(dataProvider = "generators", enabled = false) // re-enable when https://github.com/OpenAPITools/openapi-generator/issues/18831 is fixed
void noDuplicateSupportingFiles(CodegenConfig codegenConfig) {
@Test(dataProvider = "generators") void noDuplicateSupportingFiles(CodegenConfig codegenConfig) {
final List<String> supportingFiles = codegenConfig.supportingFiles()
.stream().map(SupportingFile::toString).collect(Collectors.toList());

View File

@@ -24,33 +24,29 @@ import org.testng.annotations.Test;
public class PhpLaravelServerCodegenTest {
@Test
public void testInitialConfigValues() throws Exception {
@Test public void testInitialConfigValues() throws Exception {
final PhpLaravelServerCodegen codegen = new PhpLaravelServerCodegen();
codegen.processOpts();
Assert.assertEquals(codegen.additionalProperties().get(CodegenConstants.HIDE_GENERATION_TIMESTAMP), Boolean.TRUE);
Assert.assertEquals(codegen.isHideGenerationTimestamp(), true);
Assert.assertTrue(codegen.isHideGenerationTimestamp());
}
@Test
public void testSettersForConfigValues() throws Exception {
@Test public void testSettersForConfigValues() throws Exception {
final PhpLaravelServerCodegen codegen = new PhpLaravelServerCodegen();
codegen.setHideGenerationTimestamp(false);
codegen.processOpts();
Assert.assertEquals(codegen.additionalProperties().get(CodegenConstants.HIDE_GENERATION_TIMESTAMP), Boolean.FALSE);
Assert.assertEquals(codegen.isHideGenerationTimestamp(), false);
Assert.assertFalse(codegen.isHideGenerationTimestamp());
}
@Test
public void testAdditionalPropertiesPutForConfigValues() throws Exception {
@Test public void testAdditionalPropertiesPutForConfigValues() throws Exception {
final PhpLaravelServerCodegen codegen = new PhpLaravelServerCodegen();
codegen.additionalProperties().put(CodegenConstants.HIDE_GENERATION_TIMESTAMP, false);
codegen.processOpts();
Assert.assertEquals(codegen.additionalProperties().get(CodegenConstants.HIDE_GENERATION_TIMESTAMP), Boolean.FALSE);
Assert.assertEquals(codegen.isHideGenerationTimestamp(), false);
Assert.assertFalse(codegen.isHideGenerationTimestamp());
}
}

View File

@@ -100,7 +100,6 @@ lib/database/.gitignore
lib/database/factories/UserFactory.php
lib/database/migrations/2014_10_12_000000_create_users_table.php
lib/database/migrations/2019_08_19_000000_create_failed_jobs_table.php
lib/database/migrations/2019_08_19_000000_create_failed_jobs_table.php
lib/database/seeds/DatabaseSeeder.php
lib/package.json
lib/phpunit.xml