Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Run automated tests
run: ./gradlew test --no-daemon
run: ./gradlew clean test --no-daemon --no-build-cache --no-configuration-cache

build-windows:
runs-on: windows-latest
Expand All @@ -54,7 +54,7 @@ jobs:
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Run automated tests
run: ./gradlew test --no-daemon
run: ./gradlew clean test --no-daemon --no-build-cache --no-configuration-cache

build-macos:
runs-on: macos-latest
Expand All @@ -78,7 +78,7 @@ jobs:
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Run automated tests
run: ./gradlew test --no-daemon
run: ./gradlew clean test --no-daemon --no-build-cache --no-configuration-cache

static-tests:
runs-on: ubuntu-latest
Expand All @@ -94,8 +94,8 @@ jobs:
distribution: 'temurin'
cache: gradle
- name: Qodana - Code Quality
uses: JetBrains/qodana-action@v2024.2
uses: JetBrains/qodana-action@v2025.3
with:
cache-default-branch-only: true
use-caches: true
args: '--baseline,qodana.sarif.json'
args: '--baseline qodana.sarif.json'
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0).

### Fixed

- Read access assertion when enabling Magento support or resolving Magento version from plugin settings [#2692](https://github.com/magento/magento2-phpstorm-plugin/issues/2692)
- Override this file in a project theme is not working [#2549](https://github.com/magento/magento2-phpstorm-plugin/issues/2549)

## 2026.2.0
Expand Down
24 changes: 23 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
import org.jetbrains.changelog.Changelog
import org.jetbrains.changelog.markdownToHTML
import org.jetbrains.intellij.platform.gradle.TestFrameworkType
import org.gradle.api.tasks.testing.TestDescriptor
import org.gradle.api.tasks.testing.TestResult
import org.gradle.api.tasks.testing.TestListener

plugins {
id("java")
Expand Down Expand Up @@ -50,7 +53,8 @@ repositories {

dependencies {
testImplementation("junit:junit:4.13.2")
testCompileOnly("org.junit.jupiter:junit-jupiter-api:5.10.2")
testCompileOnly("org.junit.jupiter:junit-jupiter-api:5.13.4")
testRuntimeOnly("org.junit.vintage:junit-vintage-engine:5.13.4")

intellijPlatform {
create(providers.gradleProperty("platformType"), providers.gradleProperty("platformVersion"))
Expand Down Expand Up @@ -160,6 +164,24 @@ tasks {
systemProperty("ide.fleet.launch", "false")

useJUnitPlatform()
addTestListener(object : TestListener {
override fun beforeSuite(suite: TestDescriptor) = Unit

override fun beforeTest(testDescriptor: TestDescriptor) = Unit

override fun afterTest(testDescriptor: TestDescriptor, result: TestResult) = Unit

override fun afterSuite(suite: TestDescriptor, result: TestResult) {
if (suite.parent == null) {
logger.lifecycle(
"Test summary: ${result.testCount} run, " +
"${result.successfulTestCount} passed, " +
"${result.failedTestCount} failed, " +
"${result.skippedTestCount} skipped"
)
}
}
})
}


Expand Down
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ junitJupiter = "5.12.0"

# plugins
changelog = "2.5.0"
intelliJPlatform = "2.11.0"
intelliJPlatform = "2.16.0"
kotlin = "2.3.0"
kover = "0.9.5"
qodana = "2025.3.1"
Expand All @@ -19,4 +19,4 @@ changelog = { id = "org.jetbrains.changelog", version.ref = "changelog" }
intelliJPlatform = { id = "org.jetbrains.intellij.platform", version.ref = "intelliJPlatform" }
kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kover" }
qodana = { id = "org.jetbrains.qodana", version.ref = "qodana" }
qodana = { id = "org.jetbrains.qodana", version.ref = "qodana" }
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
13 changes: 6 additions & 7 deletions gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions gradlew.bat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions qodana.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
# https://www.jetbrains.com/help/qodana/qodana-yaml.html

version: 1.0
linter: jetbrains/qodana-jvm-community:2024.2
projectJDK: "17"
linter: jetbrains/qodana-jvm-community:2025.3
projectJDK: "21"
profile:
name: qodana.recommended
exclude:
Expand Down
14 changes: 0 additions & 14 deletions runUiTests.sh

This file was deleted.

2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
rootProject.name = "Magento 2 and Adobe Commerce"

plugins {
id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0"
id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0"
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import com.intellij.json.psi.JsonFile;
import com.intellij.json.psi.JsonObject;
import com.intellij.openapi.application.ReadAction;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.vfs.LocalFileSystem;
Expand Down Expand Up @@ -52,33 +53,35 @@
final Project project,
final String magentoPath
) {
final VirtualFile file = LocalFileSystem.getInstance().findFileByPath(
getFilePath(magentoPath)
);
final Pair<String, String> versionData = new Pair<>(DEFAULT_VERSION, null);

if (file == null) {
return versionData;
}
final PsiManager psiManager = PsiManager.getInstance(project);
final PsiFile composerFile = psiManager.findFile(file);

if (composerFile instanceof JsonFile) {
final JsonFile composerJsonFile = (JsonFile) composerFile;
final JsonObject jsonObject = PsiTreeUtil.getChildOfType(
composerJsonFile,
JsonObject.class
return ReadAction.compute(() -> {

Check warning on line 56 in src/main/java/com/magento/idea/magento2plugin/util/magento/MagentoVersionUtil.java

View workflow job for this annotation

GitHub Actions / static-tests

Deprecated API usage

'compute(com.intellij.openapi.util.@org.jetbrains.annotations.NotNull ThrowableComputable)' is deprecated
final VirtualFile file = LocalFileSystem.getInstance().findFileByPath(
getFilePath(magentoPath)
);
final Pair<String, String> versionData = new Pair<>(DEFAULT_VERSION, null);

if (jsonObject == null) {
if (file == null) {
return versionData;
}
final Pair<String, String> version = GetMagentoVersionUtil.getVersion(jsonObject);

return version == null ? versionData : version;
}
final PsiManager psiManager = PsiManager.getInstance(project);
final PsiFile composerFile = psiManager.findFile(file);

if (composerFile instanceof JsonFile) {
final JsonFile composerJsonFile = (JsonFile) composerFile;
final JsonObject jsonObject = PsiTreeUtil.getChildOfType(
composerJsonFile,
JsonObject.class
);

if (jsonObject == null) {
return versionData;
}
final Pair<String, String> version = GetMagentoVersionUtil.getVersion(jsonObject);

return version == null ? versionData : version;
}

return versionData;
return versionData;
});
}

private static String getFilePath(final String magentoPath) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

package com.magento.idea.magento2plugin.util.magento;

import com.intellij.openapi.util.Pair;
import com.intellij.testFramework.EdtTestUtil;
import com.magento.idea.magento2plugin.BaseProjectTestCase;
import java.nio.file.Path;
import java.util.concurrent.atomic.AtomicReference;

public class MagentoVersionUtilTest extends BaseProjectTestCase {
public void testGetVersionDataCanReadComposerLockOnEdtWithoutExplicitReadAction() throws Exception {
final String magentoPath = Path.of(
getTestDataPath(),
"project",
"magento2"
).toAbsolutePath().normalize().toString();

final AtomicReference<Pair<String, String>> versionHolder = new AtomicReference<>();
EdtTestUtil.runInEdtAndWait(() -> versionHolder.set(MagentoVersionUtil.getVersionData(
getProject(),
magentoPath
)));

assertNotNull(versionHolder.get());
assertEquals("2.4.7", versionHolder.get().getFirst());
assertEquals("Magento Open Source", versionHolder.get().getSecond());
}
}
Loading