diff --git a/resources/META-INF/plugin.xml b/resources/META-INF/plugin.xml index a3f9dffd1..bacddef60 100644 --- a/resources/META-INF/plugin.xml +++ b/resources/META-INF/plugin.xml @@ -64,6 +64,7 @@ + diff --git a/resources/fileTemplates/internal/Magento System XML.xml.ft b/resources/fileTemplates/internal/Magento System XML.xml.ft new file mode 100644 index 000000000..b38d0ee44 --- /dev/null +++ b/resources/fileTemplates/internal/Magento System XML.xml.ft @@ -0,0 +1,7 @@ + +#parse("XML File Header.xml") + + + + diff --git a/resources/fileTemplates/internal/Magento System XML.xml.html b/resources/fileTemplates/internal/Magento System XML.xml.html new file mode 100644 index 000000000..9b8c016bb --- /dev/null +++ b/resources/fileTemplates/internal/Magento System XML.xml.html @@ -0,0 +1,27 @@ + + + + + + + + + + +
+ The system.xml file allows you to manage the Magento system configuration. Use this topic as a general reference for the system.xml file. + The system.xml file is located under etc/adminhtml/system.xml in a given Magento 2 extension. +
+
+ Read more about the system.xml in the + + DevDocs. +
+
+ + diff --git a/src/com/magento/idea/magento2plugin/actions/context/AbstractContextAction.java b/src/com/magento/idea/magento2plugin/actions/context/AbstractContextAction.java index 91c835645..d54bbaa75 100644 --- a/src/com/magento/idea/magento2plugin/actions/context/AbstractContextAction.java +++ b/src/com/magento/idea/magento2plugin/actions/context/AbstractContextAction.java @@ -20,6 +20,7 @@ import com.intellij.psi.PsiFile; import com.magento.idea.magento2plugin.MagentoIcons; import com.magento.idea.magento2plugin.magento.files.ModuleFileInterface; +import com.magento.idea.magento2plugin.magento.packages.Package; import com.magento.idea.magento2plugin.util.magento.GetMagentoModuleUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -154,6 +155,18 @@ protected FileTemplate getTemplate( return template; } + protected @Nullable PsiDirectory getGlobalScopeDir(final @NotNull PsiDirectory directory) { + PsiDirectory globalScopeDir; + + if (Package.moduleBaseAreaDir.equals(directory.getName())) { + globalScopeDir = directory; + } else { + globalScopeDir = directory.getParentDirectory(); + } + + return globalScopeDir; + } + @Override public boolean isDumbAware() { return false; diff --git a/src/com/magento/idea/magento2plugin/actions/context/xml/NewAclXmlAction.java b/src/com/magento/idea/magento2plugin/actions/context/xml/NewAclXmlAction.java index 0b996ce97..9c432d0b3 100644 --- a/src/com/magento/idea/magento2plugin/actions/context/xml/NewAclXmlAction.java +++ b/src/com/magento/idea/magento2plugin/actions/context/xml/NewAclXmlAction.java @@ -33,7 +33,14 @@ protected boolean isVisible( final @NotNull PsiDirectory targetDirectory, final PsiFile targetFile ) { + final PsiDirectory configDir = moduleData.getConfigDir(); + + if (configDir == null) { + return false; + } + return targetDirectory.getName().equals(Package.moduleBaseAreaDir) + && targetDirectory.equals(configDir) && moduleData.getType().equals(ComponentType.module); } diff --git a/src/com/magento/idea/magento2plugin/actions/context/xml/NewConfigXmlAction.java b/src/com/magento/idea/magento2plugin/actions/context/xml/NewConfigXmlAction.java index 76cdd1060..f6c5db590 100644 --- a/src/com/magento/idea/magento2plugin/actions/context/xml/NewConfigXmlAction.java +++ b/src/com/magento/idea/magento2plugin/actions/context/xml/NewConfigXmlAction.java @@ -33,7 +33,14 @@ protected boolean isVisible( final @NotNull PsiDirectory targetDirectory, final PsiFile targetFile ) { + final PsiDirectory configDir = moduleData.getConfigDir(); + + if (configDir == null) { + return false; + } + return targetDirectory.getName().equals(Package.moduleBaseAreaDir) + && targetDirectory.equals(configDir) && moduleData.getType().equals(ComponentType.module); } diff --git a/src/com/magento/idea/magento2plugin/actions/context/xml/NewDiXmlAction.java b/src/com/magento/idea/magento2plugin/actions/context/xml/NewDiXmlAction.java index 67c00db14..9118ef874 100644 --- a/src/com/magento/idea/magento2plugin/actions/context/xml/NewDiXmlAction.java +++ b/src/com/magento/idea/magento2plugin/actions/context/xml/NewDiXmlAction.java @@ -36,6 +36,12 @@ protected boolean isVisible( final @NotNull PsiDirectory targetDirectory, final PsiFile targetFile ) { + final PsiDirectory configDir = moduleData.getConfigDir(); + final PsiDirectory globalScopeDir = getGlobalScopeDir(targetDirectory); + + if (configDir == null || globalScopeDir == null) { + return false; + } final List allowedDirectories = Arrays.asList( Package.moduleBaseAreaDir, Areas.adminhtml.toString(), @@ -47,6 +53,7 @@ protected boolean isVisible( ); return allowedDirectories.contains(targetDirectory.getName()) + && globalScopeDir.equals(configDir) && moduleData.getType().equals(ComponentType.module); } diff --git a/src/com/magento/idea/magento2plugin/actions/context/xml/NewRoutesXmlAction.java b/src/com/magento/idea/magento2plugin/actions/context/xml/NewRoutesXmlAction.java index cd007dffe..b259dcbd9 100644 --- a/src/com/magento/idea/magento2plugin/actions/context/xml/NewRoutesXmlAction.java +++ b/src/com/magento/idea/magento2plugin/actions/context/xml/NewRoutesXmlAction.java @@ -36,6 +36,12 @@ protected boolean isVisible( final @NotNull PsiDirectory targetDirectory, final PsiFile targetFile ) { + final PsiDirectory configDir = moduleData.getConfigDir(); + final PsiDirectory globalScopeDir = getGlobalScopeDir(targetDirectory); + + if (configDir == null || globalScopeDir == null) { + return false; + } final List allowedDirectories = Arrays.asList( Package.moduleBaseAreaDir, Areas.adminhtml.toString(), @@ -43,6 +49,7 @@ protected boolean isVisible( ); return allowedDirectories.contains(targetDirectory.getName()) + && globalScopeDir.equals(configDir) && moduleData.getType().equals(ComponentType.module); } diff --git a/src/com/magento/idea/magento2plugin/actions/context/xml/NewSystemXmlAction.java b/src/com/magento/idea/magento2plugin/actions/context/xml/NewSystemXmlAction.java new file mode 100644 index 000000000..f1a581834 --- /dev/null +++ b/src/com/magento/idea/magento2plugin/actions/context/xml/NewSystemXmlAction.java @@ -0,0 +1,57 @@ +/* + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +package com.magento.idea.magento2plugin.actions.context.xml; + +import com.intellij.ide.fileTemplates.actions.AttributesDefaults; +import com.intellij.psi.PsiDirectory; +import com.intellij.psi.PsiFile; +import com.magento.idea.magento2plugin.actions.context.AbstractContextAction; +import com.magento.idea.magento2plugin.magento.files.ModuleSystemXmlFile; +import com.magento.idea.magento2plugin.magento.packages.Areas; +import com.magento.idea.magento2plugin.magento.packages.ComponentType; +import com.magento.idea.magento2plugin.util.magento.GetMagentoModuleUtil; +import org.jetbrains.annotations.NotNull; + +public class NewSystemXmlAction extends AbstractContextAction { + + public static final String ACTION_NAME = "Magento 2 System File"; + public static final String ACTION_DESCRIPTION = "Create a new Magento 2 system.xml file"; + + /** + * New system.xml file generation action constructor. + */ + public NewSystemXmlAction() { + super(ACTION_NAME, ACTION_DESCRIPTION, new ModuleSystemXmlFile()); + } + + @Override + protected boolean isVisible( + final @NotNull GetMagentoModuleUtil.MagentoModuleData moduleData, + final @NotNull PsiDirectory targetDirectory, + final PsiFile targetFile + ) { + final PsiDirectory parentDir = targetDirectory.getParentDirectory(); + final PsiDirectory configDir = moduleData.getConfigDir(); + + if (parentDir == null || configDir == null) { + return false; + } + + return targetDirectory.getName().equals(Areas.adminhtml.toString()) + && parentDir.equals(configDir) + && moduleData.getType().equals(ComponentType.module); + } + + @Override + protected AttributesDefaults getProperties( + final @NotNull AttributesDefaults defaults, + final @NotNull GetMagentoModuleUtil.MagentoModuleData moduleData, + final PsiDirectory targetDirectory, + final PsiFile targetFile + ) { + return defaults; + } +} diff --git a/src/com/magento/idea/magento2plugin/actions/context/xml/NewWebapiXmlAction.java b/src/com/magento/idea/magento2plugin/actions/context/xml/NewWebapiXmlAction.java index 241d24d83..ada13372f 100644 --- a/src/com/magento/idea/magento2plugin/actions/context/xml/NewWebapiXmlAction.java +++ b/src/com/magento/idea/magento2plugin/actions/context/xml/NewWebapiXmlAction.java @@ -33,7 +33,14 @@ protected boolean isVisible( final @NotNull PsiDirectory targetDirectory, final PsiFile targetFile ) { + final PsiDirectory configDir = moduleData.getConfigDir(); + + if (configDir == null) { + return false; + } + return targetDirectory.getName().equals(Package.moduleBaseAreaDir) + && targetDirectory.equals(configDir) && moduleData.getType().equals(ComponentType.module); } diff --git a/src/com/magento/idea/magento2plugin/completion/xml/XmlCompletionContributor.java b/src/com/magento/idea/magento2plugin/completion/xml/XmlCompletionContributor.java index 6590d10cf..e22847d74 100644 --- a/src/com/magento/idea/magento2plugin/completion/xml/XmlCompletionContributor.java +++ b/src/com/magento/idea/magento2plugin/completion/xml/XmlCompletionContributor.java @@ -154,24 +154,24 @@ public XmlCompletionContributor() { // php class completion in system.xml files. extend(CompletionType.BASIC, PlatformPatterns.psiElement(XmlTokenType.XML_DATA_CHARACTERS) - .inside(XmlPatterns.xmlTag().withName(ModuleSystemXml.XML_TAG_SOURCE_MODEL) - .withParent(XmlPatterns.xmlTag().withName(ModuleSystemXml.FIELD_ELEMENT_NAME)) - ).inFile(XmlPatterns.xmlFile().withName(StandardPatterns.string().matches(ModuleSystemXml.FILE_NAME))), + .inside(XmlPatterns.xmlTag().withName(ModuleSystemXmlFile.XML_TAG_SOURCE_MODEL) + .withParent(XmlPatterns.xmlTag().withName(ModuleSystemXmlFile.FIELD_ELEMENT_NAME)) + ).inFile(XmlPatterns.xmlFile().withName(StandardPatterns.string().matches(ModuleSystemXmlFile.FILE_NAME))), new PhpClassCompletionProvider() ); // completion extend(CompletionType.BASIC, PlatformPatterns.psiElement(XmlTokenType.XML_DATA_CHARACTERS) - .inside(XmlPatterns.xmlTag().withName(ModuleSystemXml.XML_TAG_FRONTEND_MODEL)), + .inside(XmlPatterns.xmlTag().withName(ModuleSystemXmlFile.XML_TAG_FRONTEND_MODEL)), new PhpClassCompletionProvider() ); // completion in system.xml extend(CompletionType.BASIC, PlatformPatterns.psiElement(XmlTokenType.XML_DATA_CHARACTERS) - .inside(XmlPatterns.xmlTag().withName(ModuleSystemXml.XML_TAG_BACKEND_MODEL) - .withParent(XmlPatterns.xmlTag().withName(ModuleSystemXml.FIELD_ELEMENT_NAME)) - ).inFile(XmlPatterns.xmlFile().withName(StandardPatterns.string().matches(ModuleSystemXml.FILE_NAME))), + .inside(XmlPatterns.xmlTag().withName(ModuleSystemXmlFile.XML_TAG_BACKEND_MODEL) + .withParent(XmlPatterns.xmlTag().withName(ModuleSystemXmlFile.FIELD_ELEMENT_NAME)) + ).inFile(XmlPatterns.xmlFile().withName(StandardPatterns.string().matches(ModuleSystemXmlFile.FILE_NAME))), new PhpClassCompletionProvider() ); diff --git a/src/com/magento/idea/magento2plugin/magento/files/ModuleSystemXml.java b/src/com/magento/idea/magento2plugin/magento/files/ModuleSystemXmlFile.java similarity index 50% rename from src/com/magento/idea/magento2plugin/magento/files/ModuleSystemXml.java rename to src/com/magento/idea/magento2plugin/magento/files/ModuleSystemXmlFile.java index 2545ee75a..11017dd18 100644 --- a/src/com/magento/idea/magento2plugin/magento/files/ModuleSystemXml.java +++ b/src/com/magento/idea/magento2plugin/magento/files/ModuleSystemXmlFile.java @@ -2,12 +2,34 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + package com.magento.idea.magento2plugin.magento.files; -public class ModuleSystemXml { +import com.intellij.lang.Language; +import com.intellij.lang.xml.XMLLanguage; + +public final class ModuleSystemXmlFile implements ModuleFileInterface { + public static final String FILE_NAME = "system.xml"; + public static final String TEMPLATE = "Magento System XML"; + public static final String FIELD_ELEMENT_NAME = "field"; public static final String XML_TAG_SOURCE_MODEL = "source_model"; public static final String XML_TAG_FRONTEND_MODEL = "frontend_model"; public static final String XML_TAG_BACKEND_MODEL = "backend_model"; + + @Override + public String getFileName() { + return FILE_NAME; + } + + @Override + public String getTemplate() { + return TEMPLATE; + } + + @Override + public Language getLanguage() { + return XMLLanguage.INSTANCE; + } } diff --git a/src/com/magento/idea/magento2plugin/util/magento/GetMagentoModuleUtil.java b/src/com/magento/idea/magento2plugin/util/magento/GetMagentoModuleUtil.java index 067191935..207b7eaf4 100644 --- a/src/com/magento/idea/magento2plugin/util/magento/GetMagentoModuleUtil.java +++ b/src/com/magento/idea/magento2plugin/util/magento/GetMagentoModuleUtil.java @@ -16,8 +16,10 @@ import com.jetbrains.php.lang.psi.elements.impl.ClassConstImpl; import com.magento.idea.magento2plugin.magento.files.RegistrationPhp; import com.magento.idea.magento2plugin.magento.packages.ComponentType; +import com.magento.idea.magento2plugin.magento.packages.Package; import java.util.Collection; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; public final class GetMagentoModuleUtil { @@ -46,6 +48,9 @@ public static MagentoModuleData getByContext( if (registrationFile == null) { return null; } + final PsiDirectory configDir = registrationFile + .getContainingDirectory() + .findSubdirectory(Package.moduleBaseAreaDir); final Collection methodReferences = PsiTreeUtil.findChildrenOfType( registrationFile, MethodReference.class @@ -71,7 +76,7 @@ public static MagentoModuleData getByContext( return null; } - return new MagentoModuleData(name, resolvedType); + return new MagentoModuleData(name, resolvedType, configDir); } return null; @@ -124,13 +129,36 @@ public static class MagentoModuleData { private final String name; private final ComponentType type; - + private final PsiDirectory configDir; + + /** + * Default constructor. + * + * @param name String + * @param type ComponentType + */ public MagentoModuleData( final @NotNull String name, final @NotNull ComponentType type + ) { + this(name, type, null); + } + + /** + * Constructor with a config directory specified. + * + * @param name String + * @param type ComponentType + * @param configDir PsiDirectory + */ + public MagentoModuleData( + final @NotNull String name, + final @NotNull ComponentType type, + final @Nullable PsiDirectory configDir ) { this.name = name; this.type = type; + this.configDir = configDir; } public String getName() { @@ -140,5 +168,9 @@ public String getName() { public ComponentType getType() { return type; } + + public @Nullable PsiDirectory getConfigDir() { + return configDir; + } } } diff --git a/tests/com/magento/idea/magento2plugin/completion/xml/BackendModelXmlCompletionRegistrarTest.java b/tests/com/magento/idea/magento2plugin/completion/xml/BackendModelXmlCompletionRegistrarTest.java index c6a49fba0..0a5a14b63 100644 --- a/tests/com/magento/idea/magento2plugin/completion/xml/BackendModelXmlCompletionRegistrarTest.java +++ b/tests/com/magento/idea/magento2plugin/completion/xml/BackendModelXmlCompletionRegistrarTest.java @@ -2,89 +2,114 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + package com.magento.idea.magento2plugin.completion.xml; import com.magento.idea.magento2plugin.magento.files.ModuleConfigXml; -import com.magento.idea.magento2plugin.magento.files.ModuleSystemXml; +import com.magento.idea.magento2plugin.magento.files.ModuleSystemXmlFile; public class BackendModelXmlCompletionRegistrarTest extends CompletionXmlFixtureTestCase { - private static final String[] systemXmlBackendModelLookupStringCheck = new String[]{ - "Magento\\Backend\\Model\\Source\\Roles" - }; - private static final String[] configXmlBackendModelLookupStringCheck = new String[]{ - "Magento\\Backend\\Model\\Source\\YesNo" + private static final String[] SYSTEM_XML_BACKEND_MODEL_LOOKUP_STRING_CHECK = { + "Magento\\Backend\\Model\\Source\\Roles" + }; + private static final String[] CONFIG_XML_BACKEND_MODEL_LOOKUP_STRING_CHECK = { + "Magento\\Backend\\Model\\Source\\YesNo" }; + /** + * Test system.xml file element completion. + */ public void testSystemXmlElementProvideCompletion() { - String filePath = this.getFixturePath(ModuleSystemXml.FILE_NAME); + final String filePath = this.getFixturePath(ModuleSystemXmlFile.FILE_NAME); myFixture.configureByFile(filePath); - assertCompletionContains(filePath, systemXmlBackendModelLookupStringCheck); + assertCompletionContains(filePath, SYSTEM_XML_BACKEND_MODEL_LOOKUP_STRING_CHECK); } + /** + * Test system.xml file element completion won't show. + */ public void testSystemXmlElementCompletionWontShow() { - String filePath = this.getFixturePath( - ModuleSystemXml.FILE_NAME + final String filePath = this.getFixturePath( + ModuleSystemXmlFile.FILE_NAME ); myFixture.copyFileToProject(filePath); assertCompletionNotShowing(filePath); } + /** + * Test system.xml backend model attribute match with the file. + */ public void testSystemXmlBackendModelAttributeMatchWithFile() { - String filePath = this.getFixturePath( - ModuleSystemXml.FILE_NAME + final String filePath = this.getFixturePath( + ModuleSystemXmlFile.FILE_NAME ); - assertFileContainsCompletions(filePath, systemXmlBackendModelLookupStringCheck); + assertFileContainsCompletions(filePath, SYSTEM_XML_BACKEND_MODEL_LOOKUP_STRING_CHECK); } + /** + * Test system.xml backend model attribute doesn't match with the file. + */ public void testSystemXmlBackendModelAttributeDontMatchWithFile() { - String filePath = this.getFixturePath( - "other-file-than-system.xml" + final String filePath = this.getFixturePath( + "other-file-than-system.xml" ); assertFileNotContainsCompletions( filePath, - systemXmlBackendModelLookupStringCheck + SYSTEM_XML_BACKEND_MODEL_LOOKUP_STRING_CHECK ); } + /** + * Test config.xml file element completion. + */ public void testConfigXmlElementProvideCompletion() { - String filePath = this.getFixturePath( - ModuleConfigXml.FILE_NAME + final String filePath = this.getFixturePath( + ModuleConfigXml.FILE_NAME ); myFixture.copyFileToProject(filePath); - assertCompletionContains(filePath, configXmlBackendModelLookupStringCheck); + assertCompletionContains(filePath, CONFIG_XML_BACKEND_MODEL_LOOKUP_STRING_CHECK); } + /** + * Test config.xml file element completion won't show. + */ public void testConfigXmlElementCompletionWontShow() { - String filePath = this.getFixturePath( - ModuleConfigXml.FILE_NAME + final String filePath = this.getFixturePath( + ModuleConfigXml.FILE_NAME ); myFixture.copyFileToProject(filePath); assertCompletionNotShowing(filePath); } + /** + * Test config.xml backend model attribute match with the file. + */ public void testConfigXmlBackendModelAttributeMatchWithFile() { - String filePath = this.getFixturePath( - ModuleConfigXml.FILE_NAME + final String filePath = this.getFixturePath( + ModuleConfigXml.FILE_NAME ); - assertFileContainsCompletions(filePath, configXmlBackendModelLookupStringCheck); + assertFileContainsCompletions(filePath, CONFIG_XML_BACKEND_MODEL_LOOKUP_STRING_CHECK); } + /** + * Test config.xml backend model attribute doesn't match with the file. + */ public void testConfigXmlBackendModelAttributeDontMatchWithFile() { - String filePath = this.getFixturePath( - "other-file-than-config.xml" + final String filePath = this.getFixturePath( + "other-file-than-config.xml" ); assertFileNotContainsCompletions( filePath, - configXmlBackendModelLookupStringCheck + CONFIG_XML_BACKEND_MODEL_LOOKUP_STRING_CHECK ); } } diff --git a/tests/com/magento/idea/magento2plugin/completion/xml/SourceModelXmlCompletionRegistrarTest.java b/tests/com/magento/idea/magento2plugin/completion/xml/SourceModelXmlCompletionRegistrarTest.java index c158498a2..939380523 100644 --- a/tests/com/magento/idea/magento2plugin/completion/xml/SourceModelXmlCompletionRegistrarTest.java +++ b/tests/com/magento/idea/magento2plugin/completion/xml/SourceModelXmlCompletionRegistrarTest.java @@ -2,63 +2,81 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + package com.magento.idea.magento2plugin.completion.xml; -import com.magento.idea.magento2plugin.magento.files.ModuleSystemXml; +import com.magento.idea.magento2plugin.magento.files.ModuleSystemXmlFile; import com.magento.idea.magento2plugin.magento.files.ModuleWidgetXml; -import java.io.IOException; public class SourceModelXmlCompletionRegistrarTest extends CompletionXmlFixtureTestCase { - private static final String[] lookupStringsCheck = new String[]{ + private static final String[] LOOKUP_STRINGS_CHECK = { "Magento\\Backend\\Model\\Source\\YesNo" }; + /** + * Test source model xml element completion. + */ public void testSourceModelXmlElementMustProvideCompletion() { - String filePath = this.getFixturePath(ModuleSystemXml.FILE_NAME); + final String filePath = this.getFixturePath(ModuleSystemXmlFile.FILE_NAME); myFixture.copyFileToProject(filePath); - assertCompletionContains(filePath, lookupStringsCheck); + assertCompletionContains(filePath, LOOKUP_STRINGS_CHECK); } + /** + * Test source model xml element completion match with the file false positive. + */ public void testSourceModelXmlElementMatchWithFilePositiveCase() { - String filePath = this.getFixturePath(ModuleSystemXml.FILE_NAME); + final String filePath = this.getFixturePath(ModuleSystemXmlFile.FILE_NAME); myFixture.copyFileToProject(filePath); - assertFileContainsCompletions(filePath, lookupStringsCheck); + assertFileContainsCompletions(filePath, LOOKUP_STRINGS_CHECK); } + /** + * Test source model xml element completion match with the file negative case. + */ public void testSourceModelXmlElementMatchWithFileNegativeCase() { - String filePath = this.getFixturePath("not-system.xml"); + final String filePath = this.getFixturePath("not-system.xml"); myFixture.copyFileToProject(filePath); assertFileNotContainsCompletions( - filePath, - lookupStringsCheck + filePath, + LOOKUP_STRINGS_CHECK ); } + /** + * Test source model attribute must provide completion. + */ public void testSourceModelXmlAttributeMustProvideCompletion() { - String filePath = this.getFixturePath(ModuleWidgetXml.FILE_NAME); + final String filePath = this.getFixturePath(ModuleWidgetXml.FILE_NAME); myFixture.copyFileToProject(filePath); - assertCompletionContains(filePath, lookupStringsCheck); + assertCompletionContains(filePath, LOOKUP_STRINGS_CHECK); } + /** + * Test source model attribute match with the file positive case. + */ public void testSourceModelXmlAttributeMatchWithFilePositiveCase() { - String filePath = this.getFixturePath(ModuleWidgetXml.FILE_NAME); + final String filePath = this.getFixturePath(ModuleWidgetXml.FILE_NAME); myFixture.copyFileToProject(filePath); - assertFileContainsCompletions(filePath, lookupStringsCheck); + assertFileContainsCompletions(filePath, LOOKUP_STRINGS_CHECK); } - public void testSourceModelXmlAttributeMatchWithFileNegativeCase() throws IOException { - String filePath = this.getFixturePath("not-widget.xml"); + /** + * Test source model attribute match with the file negative case. + */ + public void testSourceModelXmlAttributeMatchWithFileNegativeCase() { + final String filePath = this.getFixturePath("not-widget.xml"); myFixture.copyFileToProject(filePath); assertFileNotContainsCompletions( - filePath, - lookupStringsCheck + filePath, + LOOKUP_STRINGS_CHECK ); } }