Skip to content

Commit 1097210

Browse files
committed
1211: fixed test
1 parent dfd77ca commit 1097210

20 files changed

+103
-51
lines changed

Diff for: .github/workflows/gradle.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
- name: Grant execute permission for gradlew
3131
run: chmod +x gradlew
3232
- name: Run automated tests
33-
run: ./gradlew test -i --no-daemon
33+
run: ./gradlew test --no-daemon
3434

3535
build-windows:
3636
runs-on: windows-latest
@@ -54,7 +54,7 @@ jobs:
5454
- name: Grant execute permission for gradlew
5555
run: chmod +x gradlew
5656
- name: Run automated tests
57-
run: ./gradlew test -i --no-daemon
57+
run: ./gradlew test --no-daemon
5858

5959
build-macos:
6060
runs-on: macos-latest
@@ -78,7 +78,7 @@ jobs:
7878
- name: Grant execute permission for gradlew
7979
run: chmod +x gradlew
8080
- name: Run automated tests
81-
run: ./gradlew test -i --no-daemon
81+
run: ./gradlew test --no-daemon
8282

8383
static-tests:
8484
runs-on: ubuntu-latest
@@ -104,11 +104,11 @@ jobs:
104104
- id: file_changes
105105
uses: trilom/file-changes-action@v1.2.4
106106
- name: Run Code Style Check
107-
run: ./gradlew checkstyleCI -i --no-daemon
107+
run: ./gradlew checkstyleCI --no-daemon
108108
env:
109109
MODIFIED_FILES: ${{ steps.file_changes.outputs.files}}
110110
ACTIONS_STEP_DEBUG: true
111111
- name: Run PMD Quality Check
112-
run: ./gradlew pmdCI -i --no-daemon
112+
run: ./gradlew pmdCI --no-daemon
113113
env:
114114
MODIFIED_FILES: ${{ steps.file_changes.outputs.files}}

Diff for: build.gradle

+20-6
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
*/
55

66
plugins {
7-
id 'org.jetbrains.intellij' version '1.5.2'
7+
id 'org.jetbrains.intellij' version '1.11.0'
88
id 'checkstyle'
99
id 'pmd'
10-
id 'org.jetbrains.changelog' version '1.2.1'
10+
id 'org.jetbrains.changelog' version '2.0.0'
1111
}
1212

1313
repositories {
@@ -105,12 +105,26 @@ idea {
105105
}
106106

107107
dependencies {
108-
testImplementation 'junit:junit:4.13'
109-
implementation 'com.googlecode.json-simple:json-simple:1.1.1'
108+
implementation(
109+
"org.junit.jupiter:junit-jupiter:5.8.2",
110+
"com.googlecode.json-simple:json-simple:1.1.1"
111+
)
112+
testRuntimeOnly('org.junit.vintage:junit-vintage-engine:5.9.0')
113+
testRuntimeOnly("org.junit.platform:junit-platform-launcher:1.9.0")
114+
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.9.00")
110115
}
111116

112117
test {
113-
useJUnit()
114-
118+
useJUnitPlatform {
119+
includeEngines("junit-vintage")
120+
}
121+
dependsOn cleanTest
122+
testLogging.showStandardStreams = true
123+
testLogging {
124+
lifecycle {
125+
events "skipped", "failed", "standard_error", "standard_out"
126+
exceptionFormat "short"
127+
}
128+
}
115129
maxHeapSize = '1G'
116130
}

Diff for: testData/actions/generation/generator/DeleteEntityGenerator/generateDeleteEntityFile/Delete.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function execute()
5858
try {
5959
$this->deleteByIdCommand->execute($entityId);
6060
$this->messageManager->addSuccessMessage(__('You have successfully deleted Company entity'));
61-
} catch (CouldNotDeleteException | NoSuchEntityException $exception) {
61+
} catch (CouldNotDeleteException|NoSuchEntityException $exception) {
6262
$this->messageManager->addErrorMessage($exception->getMessage());
6363
}
6464

Diff for: testData/actions/generation/generator/WebApiInterfaceGenerator/withObjectTypesAndPhpDocComments/SimpleServiceTwoInterface.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public function execute(SimpleModelTwo $simpleModelTwo, ?string $param2 = null):
2222

2323
/**
2424
* TODO: need to describe this method.
25-
*
25+
* @return void
2626
*/
2727
public function fetch(): void;
2828
}

Diff for: testData/actions/generation/generator/WebApiInterfaceGenerator/withPrimitiveTypes/SimpleServiceInterface.php

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ interface SimpleServiceInterface
1313
* TODO: need to describe this method.
1414
* @param int $param1
1515
* @param string $param2
16+
* @return void
1617
*/
1718
public function execute(int $param1, string $param2);
1819
}

Diff for: tests/com/magento/idea/magento2plugin/BaseProjectTestCase.java

+26-11
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,28 @@
22
* Copyright © Magento, Inc. All rights reserved.
33
* See COPYING.txt for license details.
44
*/
5+
56
package com.magento.idea.magento2plugin;
67

78
import com.intellij.openapi.util.text.StringUtil;
9+
import com.intellij.testFramework.PlatformTestUtil;
810
import com.intellij.testFramework.fixtures.BasePlatformTestCase;
911
import com.magento.idea.magento2plugin.indexes.IndexManager;
10-
import com.magento.idea.magento2plugin.project.Settings;
1112
import com.magento.idea.magento2plugin.magento.packages.File;
13+
import com.magento.idea.magento2plugin.project.Settings;
1214

1315
/**
14-
* Configure test environment with Magento 2 project
16+
* Configure test environment with Magento 2 project.
1517
*/
16-
abstract public class BaseProjectTestCase extends BasePlatformTestCase {
17-
private static final String testDataProjectPath = "testData" + File.separator + "project";
18-
private static final String testDataProjectDirectory = "magento2";
18+
public abstract class BaseProjectTestCase extends BasePlatformTestCase {
19+
private static final String testDataProjectPath = "testData" //NOPMD
20+
+ File.separator
21+
+ "project";
22+
23+
private static final String testDataProjectDirectory = "magento2"; //NOPMD
1924

2025
@Override
21-
protected void setUp() throws Exception {
26+
public void setUp() throws Exception {
2227
super.setUp();
2328
copyMagento2ToTestProject();
2429
enablePluginAndReindex();
@@ -39,27 +44,37 @@ protected String getTestDataPath() {
3944
}
4045

4146
protected void enablePluginAndReindex() {
42-
Settings settings = Settings.getInstance(myFixture.getProject());
47+
final Settings settings = Settings.getInstance(myFixture.getProject());
4348
settings.magentoPath = "/src";
4449
settings.pluginEnabled = true;
4550
settings.mftfSupportEnabled = true;
4651
IndexManager.manualReindex();
52+
PlatformTestUtil.dispatchAllEventsInIdeEventQueue();
4753
}
4854

4955
protected void disablePluginAndReindex() {
50-
Settings settings = Settings.getInstance(myFixture.getProject());
56+
final Settings settings = Settings.getInstance(myFixture.getProject());
5157
settings.pluginEnabled = false;
5258
IndexManager.manualReindex();
59+
PlatformTestUtil.dispatchAllEventsInIdeEventQueue();
5360
}
5461

5562
protected void disableMftfSupportAndReindex() {
56-
Settings settings = Settings.getInstance(myFixture.getProject());
63+
final Settings settings = Settings.getInstance(myFixture.getProject());
5764
settings.mftfSupportEnabled = false;
5865
IndexManager.manualReindex();
66+
PlatformTestUtil.dispatchAllEventsInIdeEventQueue();
5967
}
6068

61-
protected String prepareFixturePath(String fileName, String fixturesFolderPath) {
62-
return fixturesFolderPath + getClass().getSimpleName().replace("Test", "") + File.separator + name() + File.separator + fileName;
69+
protected String prepareFixturePath(
70+
final String fileName,
71+
final String fixturesFolderPath
72+
) {
73+
return fixturesFolderPath + getClass().getSimpleName().replace("Test", "")
74+
+ File.separator
75+
+ name()
76+
+ File.separator
77+
+ fileName;
6378
}
6479

6580
private String name() {

Diff for: tests/com/magento/idea/magento2plugin/actions/generation/generator/BaseGeneratorTestCase.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public abstract class BaseGeneratorTestCase extends BaseProjectTestCase {
2323

2424
@Override
2525
@Before
26-
protected void setUp() throws Exception {
26+
public void setUp() throws Exception {
2727
super.setUp();
2828
myFixture.setTestDataPath(TEST_DATA_FOLDER_PATH);
2929
// Reset changed default code style settings to the previous default settings.
@@ -32,7 +32,7 @@ protected void setUp() throws Exception {
3232

3333
@Override
3434
@After
35-
protected void tearDown() throws Exception {
35+
public void tearDown() throws Exception {
3636
super.tearDown();
3737
LightPlatformTestCase.closeAndDeleteProject();
3838
}

Diff for: tests/com/magento/idea/magento2plugin/actions/generation/generator/DeleteEntityCommandGeneratorTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public class DeleteEntityCommandGeneratorTest extends BaseGeneratorTestCase {
2323
private static final String ACL = "Foo_Bar::book_management";
2424

2525
@Override
26-
protected void setUp() throws Exception {
26+
public void setUp() throws Exception {
2727
super.setUp();
2828
final EntityCreatorContext context = new EntityCreatorContext();
2929
context.putUserData(EntityCreatorContext.DTO_TYPE, ENTITY_DTO_TYPE);

Diff for: tests/com/magento/idea/magento2plugin/actions/generation/generator/DeleteEntityGeneratorTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public class DeleteEntityGeneratorTest extends BaseGeneratorTestCase {
2222
"/src/app/code/Foo/Bar/Controller/Adminhtml/" + ENTITY_NAME;
2323

2424
@Override
25-
protected void setUp() throws Exception {
25+
public void setUp() throws Exception {
2626
super.setUp();
2727
final EntityCreatorContext context = new EntityCreatorContext();
2828
context.putUserData(EntityCreatorContext.DTO_TYPE, ENTITY_DTO_TYPE);

Diff for: tests/com/magento/idea/magento2plugin/actions/generation/generator/FormButtonBlockGeneratorTest.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import com.magento.idea.magento2plugin.actions.generation.data.UiComponentFormButtonData;
1212
import com.magento.idea.magento2plugin.actions.generation.generator.util.NamespaceBuilder;
1313
import com.magento.idea.magento2plugin.actions.generation.util.GenerationContextRegistry;
14+
import org.junit.Before;
1415

1516
public class FormButtonBlockGeneratorTest extends BaseGeneratorTestCase {
1617

@@ -25,7 +26,8 @@ public class FormButtonBlockGeneratorTest extends BaseGeneratorTestCase {
2526
= "src/app/code/Foo/Bar/Block/Form/" + ENTITY_NAME;
2627

2728
@Override
28-
protected void setUp() throws Exception {
29+
@Before
30+
public void setUp() throws Exception {
2931
super.setUp();
3032
final EntityCreatorContext context = new EntityCreatorContext();
3133
context.putUserData(EntityCreatorContext.DTO_TYPE, ENTITY_DTO_TYPE);

Diff for: tests/com/magento/idea/magento2plugin/actions/generation/generator/FormGenericButtonBlockGeneratorTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public class FormGenericButtonBlockGeneratorTest extends BaseGeneratorTestCase {
2020
= "src/app/code/Foo/Bar/Block/Form/" + ENTITY_NAME;
2121

2222
@Override
23-
protected void setUp() throws Exception {
23+
public void setUp() throws Exception {
2424
super.setUp();
2525
final EntityCreatorContext context = new EntityCreatorContext();
2626
context.putUserData(EntityCreatorContext.DTO_TYPE, ENTITY_DTO_TYPE);

Diff for: tests/com/magento/idea/magento2plugin/actions/generation/generator/GridActionColumnFileGeneratorTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public class GridActionColumnFileGeneratorTest extends BaseGeneratorTestCase {
2020
private static final String ENTITY_DTO_TYPE = "Foo\\Bar\\Model\\Data\\BookData";
2121

2222
@Override
23-
protected void setUp() throws Exception {
23+
public void setUp() throws Exception {
2424
super.setUp();
2525
final EntityCreatorContext context = new EntityCreatorContext();
2626
context.putUserData(EntityCreatorContext.DTO_TYPE, ENTITY_DTO_TYPE);

Diff for: tests/com/magento/idea/magento2plugin/actions/generation/generator/ModuleResourceModelGeneratorTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public class ModuleResourceModelGeneratorTest extends BaseGeneratorTestCase {
1818
private static final String ENTITY_DTO_TYPE = "Foo\\Bar\\Model\\Data\\EntityData";
1919

2020
@Override
21-
protected void setUp() throws Exception {
21+
public void setUp() throws Exception {
2222
super.setUp();
2323
final EntityCreatorContext context = new EntityCreatorContext();
2424
context.putUserData(EntityCreatorContext.DTO_TYPE, ENTITY_DTO_TYPE);

Diff for: tests/com/magento/idea/magento2plugin/actions/generation/generator/UiComponentGridDataProviderGeneratorTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public class UiComponentGridDataProviderGeneratorTest extends BaseGeneratorTestC
2626
private static final String ACL = "Foo_Bar::book_management";
2727

2828
@Override
29-
protected void setUp() throws Exception {
29+
public void setUp() throws Exception {
3030
super.setUp();
3131
final EntityCreatorContext context = new EntityCreatorContext();
3232
context.putUserData(EntityCreatorContext.DTO_TYPE, ENTITY_DTO_TYPE);

Diff for: tests/com/magento/idea/magento2plugin/completion/BaseCompletionTestCase.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public abstract class BaseCompletionTestCase extends BaseProjectTestCase {
1616
= "testData" + File.separator + "completion" + File.separator;
1717

1818
@Override
19-
protected void setUp() throws Exception {
19+
public void setUp() throws Exception {
2020
super.setUp();
2121
myFixture.setTestDataPath(testDataFolderPath);
2222
}

Diff for: tests/com/magento/idea/magento2plugin/inspections/graphqls/InspectionGraphqlsFixtureTestCase.java

+10-5
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,18 @@
88
import com.magento.idea.magento2plugin.inspections.BaseInspectionsTestCase;
99
import com.magento.idea.magento2plugin.magento.packages.File;
1010

11-
abstract public class InspectionGraphqlsFixtureTestCase extends BaseInspectionsTestCase {
11+
public abstract class InspectionGraphqlsFixtureTestCase extends BaseInspectionsTestCase {
1212

13-
private static final String testDataFolderPath = "testData" + File.separator + "inspections" + File.separator;
14-
private static final String fixturesFolderPath = "graphqls" + File.separator;
13+
private static final String testDataFolderPath = "testData" //NOPMD
14+
+ File.separator
15+
+ "inspections"
16+
+ File.separator;
17+
18+
private static final String fixturesFolderPath = "graphqls" //NOPMD
19+
+ File.separator;
1520

1621
@Override
17-
protected void setUp() throws Exception {
22+
public void setUp() throws Exception {
1823
super.setUp();
1924
myFixture.setTestDataPath(testDataFolderPath);
2025
}
@@ -24,7 +29,7 @@ protected boolean isWriteActionRequired() {
2429
return false;
2530
}
2631

27-
protected String getFixturePath(String fileName) {
32+
protected String getFixturePath(final String fileName) {
2833
return prepareFixturePath(fileName, fixturesFolderPath);
2934
}
3035
}

Diff for: tests/com/magento/idea/magento2plugin/inspections/php/InspectionPhpFixtureTestCase.java

+11-5
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,24 @@
22
* Copyright © Magento, Inc. All rights reserved.
33
* See COPYING.txt for license details.
44
*/
5+
56
package com.magento.idea.magento2plugin.inspections.php;
67

78
import com.magento.idea.magento2plugin.inspections.BaseInspectionsTestCase;
89
import com.magento.idea.magento2plugin.magento.packages.File;
910

10-
abstract public class InspectionPhpFixtureTestCase extends BaseInspectionsTestCase {
11+
public abstract class InspectionPhpFixtureTestCase extends BaseInspectionsTestCase {
12+
13+
private static final String testDataFolderPath = "testData" //NOPMD
14+
+ File.separator
15+
+ "inspections"
16+
+ File.separator;
1117

12-
private static final String testDataFolderPath = "testData" + File.separator + "inspections" + File.separator;
13-
private static final String fixturesFolderPath = "php" + File.separator;
18+
private static final String fixturesFolderPath //NOPMD
19+
= "php" + File.separator;
1420

1521
@Override
16-
protected void setUp() throws Exception {
22+
public void setUp() throws Exception {
1723
super.setUp();
1824
myFixture.setTestDataPath(testDataFolderPath);
1925
}
@@ -23,7 +29,7 @@ protected boolean isWriteActionRequired() {
2329
return false;
2430
}
2531

26-
protected String getFixturePath(String fileName) {
32+
protected String getFixturePath(final String fileName) {
2733
return prepareFixturePath(fileName, fixturesFolderPath);
2834
}
2935
}
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,24 @@
1+
/*
2+
* Copyright © Magento, Inc. All rights reserved.
3+
* See COPYING.txt for license details.
4+
*/
5+
16
package com.magento.idea.magento2plugin.inspections.xml;
27

38
import com.magento.idea.magento2plugin.inspections.BaseInspectionsTestCase;
49
import com.magento.idea.magento2plugin.magento.packages.File;
510

6-
abstract public class InspectionXmlFixtureTestCase extends BaseInspectionsTestCase {
11+
public abstract class InspectionXmlFixtureTestCase extends BaseInspectionsTestCase {
12+
13+
private static final String testDataFolderPath = "testData" //NOPMD
14+
+ File.separator
15+
+ "inspections"
16+
+ File.separator;
717

8-
private static final String testDataFolderPath = "testData" + File.separator + "inspections" + File.separator;
9-
private static final String fixturesFolderPath = "xml" + File.separator;
18+
private static final String fixturesFolderPath = "xml" + File.separator; //NOPMD
1019

1120
@Override
12-
protected void setUp() throws Exception {
21+
public void setUp() throws Exception {
1322
super.setUp();
1423
myFixture.setTestDataPath(testDataFolderPath);
1524
}
@@ -19,7 +28,7 @@ protected boolean isWriteActionRequired() {
1928
return false;
2029
}
2130

22-
protected String getFixturePath(String fileName) {
31+
protected String getFixturePath(final String fileName) {
2332
return prepareFixturePath(fileName, fixturesFolderPath);
2433
}
2534
}

0 commit comments

Comments
 (0)