Skip to content

Commit

Permalink
[php-laravel] Fix file database/migrations/2019_08_19_000000 being wr…
Browse files Browse the repository at this point in the history
…itten twice (OpenAPITools#18832)

* Implement dedicated transitional test for OpenAPITools#18831 bugfix

* Remove duplicated database migration file from supportingFiles collection

* Activate AllGeneratorsTest.noDuplicateSupportingFiles

* Drop transitional test again

* Simplify truthy assertions
  • Loading branch information
Philzen authored Jun 5, 2024
1 parent aef4d75 commit 45bc9c9
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,6 @@ public PhpLaravelServerCodegen() {
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"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@ public void testEachWithPetstore(CodegenConfig codegenConfig) {
);
}

@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());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,33 +24,29 @@

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());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 45bc9c9

Please sign in to comment.