Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ before_install:
- "export ORG_GRADLE_PROJECT_annotationPluginVersion=${ANNOTATION_PLUGIN_VERSION}"

env:
- PHPSTORM_ENV="skip incomplete" IDEA_VERSION="IU-182.2949.4" PHP_PLUGIN_VERSION="182.2949.27" TWIG_PLUGIN_VERSION="182.2757.22" TOOLBOX_PLUGIN_VERSION="0.4.6" ANNOTATION_PLUGIN_VERSION="5.3"
- PHPSTORM_ENV="skip incomplete" IDEA_VERSION="IU-2018.2" PHP_PLUGIN_VERSION="182.3684.42" TWIG_PLUGIN_VERSION="182.3458.35" TOOLBOX_PLUGIN_VERSION="0.4.6" ANNOTATION_PLUGIN_VERSION="5.3"
- PHPSTORM_ENV="skip incomplete" IDEA_VERSION="IU-2018.1" PHP_PLUGIN_VERSION="181.4203.565" TWIG_PLUGIN_VERSION="181.3741.23" TOOLBOX_PLUGIN_VERSION="0.4.6" ANNOTATION_PLUGIN_VERSION="5.3"
- PHPSTORM_ENV="skip incomplete" IDEA_VERSION="IU-2017.3.5" PHP_PLUGIN_VERSION="173.4301.34" TWIG_PLUGIN_VERSION="173.4301.7" TOOLBOX_PLUGIN_VERSION="0.4.6" ANNOTATION_PLUGIN_VERSION="5.2.1"

Expand Down
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ideaVersion = IU-182.2949.4
phpPluginVersion = 182.2949.27
twigPluginVersion = 182.2757.22
ideaVersion = IU-2018.2
phpPluginVersion = 182.3684.42
twigPluginVersion = 182.3458.35
toolboxPluginVersion = 0.4.6
annotationPluginVersion = 5.3

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -316,9 +316,9 @@ public static String findModelNameInScope(@NotNull PsiElement psiElement) {
if(yamlDocument != null) {
YAMLValue topLevelValue = yamlDocument.getTopLevelValue();
if(topLevelValue instanceof YAMLMapping) {
PsiElement firstChild = topLevelValue.getFirstChild();
if(firstChild instanceof YAMLKeyValue) {
String keyText = ((YAMLKeyValue) firstChild).getKeyText();
YAMLKeyValue firstChild = PsiTreeUtil.findChildOfType(topLevelValue, YAMLKeyValue.class);
if(firstChild != null) {
String keyText = firstChild.getKeyText();
if(StringUtils.isNotBlank(keyText)) {
return keyText;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import fr.adrienbrault.idea.symfony2plugin.util.PhpElementsUtil;
import org.jetbrains.yaml.YAMLFileType;

import java.io.File;
import java.util.*;

/**
Expand Down Expand Up @@ -236,7 +235,7 @@ public void testYamlFindModelNameInScope() {
}) {
myFixture.configureByText(YAMLFileType.YML, s);
PsiElement psiElement = myFixture.getFile().findElementAt(myFixture.getCaretOffset());
assertEquals("Foo\\Foo", DoctrineMetadataUtil.findModelNameInScope(psiElement));
assertEquals(String.format("Fixture %s", s), "Foo\\Foo", DoctrineMetadataUtil.findModelNameInScope(psiElement));
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package fr.adrienbrault.idea.symfony2plugin.tests.intentions.yaml.dic;

import com.intellij.openapi.application.ApplicationInfo;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.command.CommandProcessor;
import com.intellij.psi.util.PsiTreeUtil;
Expand Down Expand Up @@ -47,14 +48,26 @@ public void run() {
}
}, null, null);

assertEquals("" +
"services:\n" +
" foo:\n" +
" class: Foo\\Foo\n" +
" arguments: ['@foo', '@?', '@?']\n",
yamlFile.getText()
);

ApplicationInfo instance = ApplicationInfo.getInstance();
String minorVersion = instance.getMinorVersion();
if ((instance.getMajorVersion().equals("2018") && Integer.valueOf(minorVersion) >= 2)) {
assertEquals("" +
"services:\n" +
" foo:\n" +
" class: Foo\\Foo\n" +
" arguments:\n" +
" ['@foo', '@?', '@?']\n",
yamlFile.getText()
);
} else {
assertEquals("" +
"services:\n" +
" foo:\n" +
" class: Foo\\Foo\n" +
" arguments: ['@foo', '@?', '@?']\n",
yamlFile.getText()
);
}
}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package fr.adrienbrault.idea.symfony2plugin.tests.util.yaml;

import com.intellij.openapi.application.ApplicationInfo;
import com.intellij.psi.PsiElement;
import com.intellij.util.Function;
import com.intellij.util.containers.ContainerUtil;
Expand All @@ -16,10 +17,8 @@
import org.jetbrains.yaml.psi.YAMLFile;
import org.jetbrains.yaml.psi.YAMLKeyValue;
import org.jetbrains.yaml.psi.YAMLScalar;
import org.jetbrains.yaml.psi.impl.YAMLArrayImpl;
import org.jetbrains.yaml.psi.impl.YAMLHashImpl;

import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
Expand Down Expand Up @@ -338,16 +337,31 @@ public void testInsertKeyWithArrayValue() {

YamlHelper.insertKeyIntoFile(yamlFile, yamlKeyValue, "services");

assertEquals("" +
"services:\n" +
" foo:\n" +
" car: test\n" +
" my_service:\n" +
" class: foo\n" +
" tag:\n" +
" - foo",
yamlFile.getText()
);
ApplicationInfo instance = ApplicationInfo.getInstance();
String minorVersion = instance.getMinorVersion();
if ((instance.getMajorVersion().equals("2018") && Integer.valueOf(minorVersion) >= 2)) {
assertEquals("" +
"services:\n" +
" foo:\n" +
" car: test\n" +
" my_service:\n" +
" class: foo\n" +
" tag:\n" +
" - foo",
yamlFile.getText()
);
} else {
assertEquals("" +
"services:\n" +
" foo:\n" +
" car: test\n" +
" my_service:\n" +
" class: foo\n" +
" tag:\n" +
" - foo",
yamlFile.getText()
);
}
}

/**
Expand All @@ -366,14 +380,27 @@ public void testInsertKeyValueWithMissingMainKeyInRoot() {

YamlHelper.insertKeyIntoFile(yamlFile, yamlKeyValue, "services");

assertEquals("" +
"foo: foo\n" +
"services:\n" +
" my_service:\n" +
" class: foo\n" +
" tag: foo",
yamlFile.getText()
);
ApplicationInfo instance = ApplicationInfo.getInstance();
String minorVersion = instance.getMinorVersion();
if ((instance.getMajorVersion().equals("2018") && Integer.valueOf(minorVersion) >= 2)) {
assertEquals("" +
"foo: foo\n" +
"services:\n" +
" my_service:\n" +
" class: foo\n" +
" tag: foo",
yamlFile.getText()
);
}else {
assertEquals("" +
"foo: foo\n" +
"services:\n" +
" my_service:\n" +
" class: foo\n" +
" tag: foo",
yamlFile.getText()
);
}
}

/**
Expand Down