From 96f0f93dbccd1d14fc1a22918573379af202495d Mon Sep 17 00:00:00 2001 From: Adarsh Manickam Date: Sun, 15 Nov 2020 10:26:21 +0530 Subject: [PATCH 1/2] Added test coverage for PhpConstructorArgumentCompletionProvider --- .../diXmlMustHaveCompletion/di.xml | 14 +++++++++++++ ...ructorArgumentCompletionRegistrarTest.java | 21 +++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 testData/completion/xml/ConstructorArgumentCompletionRegistrar/diXmlMustHaveCompletion/di.xml create mode 100644 tests/com/magento/idea/magento2plugin/completion/xml/ConstructorArgumentCompletionRegistrarTest.java diff --git a/testData/completion/xml/ConstructorArgumentCompletionRegistrar/diXmlMustHaveCompletion/di.xml b/testData/completion/xml/ConstructorArgumentCompletionRegistrar/diXmlMustHaveCompletion/di.xml new file mode 100644 index 000000000..ead25fcc4 --- /dev/null +++ b/testData/completion/xml/ConstructorArgumentCompletionRegistrar/diXmlMustHaveCompletion/di.xml @@ -0,0 +1,14 @@ + + + + + + Foo\Bar\Model\Logger + + + diff --git a/tests/com/magento/idea/magento2plugin/completion/xml/ConstructorArgumentCompletionRegistrarTest.java b/tests/com/magento/idea/magento2plugin/completion/xml/ConstructorArgumentCompletionRegistrarTest.java new file mode 100644 index 000000000..478944226 --- /dev/null +++ b/tests/com/magento/idea/magento2plugin/completion/xml/ConstructorArgumentCompletionRegistrarTest.java @@ -0,0 +1,21 @@ +/** + * 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.ModuleDiXml; + +public class ConstructorArgumentCompletionRegistrarTest extends CompletionXmlFixtureTestCase { + + /** + * Tests for completion of constructor argument in di.xml. + */ + public void testDiXmlMustHaveCompletion() { + String filePath = this.getFixturePath(ModuleDiXml.FILE_NAME); + myFixture.copyFileToProject(filePath); + + assertFileContainsCompletions(filePath, "logger"); + } +} From 3ce846f4ec048dd33d128ee850ad2aa457a72037 Mon Sep 17 00:00:00 2001 From: Adarsh Manickam Date: Sun, 15 Nov 2020 10:44:11 +0530 Subject: [PATCH 2/2] Fixed PMD issues --- .../xml/ConstructorArgumentCompletionRegistrarTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/com/magento/idea/magento2plugin/completion/xml/ConstructorArgumentCompletionRegistrarTest.java b/tests/com/magento/idea/magento2plugin/completion/xml/ConstructorArgumentCompletionRegistrarTest.java index 478944226..10dded7f7 100644 --- a/tests/com/magento/idea/magento2plugin/completion/xml/ConstructorArgumentCompletionRegistrarTest.java +++ b/tests/com/magento/idea/magento2plugin/completion/xml/ConstructorArgumentCompletionRegistrarTest.java @@ -13,7 +13,7 @@ public class ConstructorArgumentCompletionRegistrarTest extends CompletionXmlFix * Tests for completion of constructor argument in di.xml. */ public void testDiXmlMustHaveCompletion() { - String filePath = this.getFixturePath(ModuleDiXml.FILE_NAME); + final String filePath = this.getFixturePath(ModuleDiXml.FILE_NAME); myFixture.copyFileToProject(filePath); assertFileContainsCompletions(filePath, "logger");