Skip to content

Commit 3cc35fd

Browse files
author
m.mezhensky
committed
magento#132 Test coverage for type name attribute completion, linemarker and reference in the di
1 parent 2c96624 commit 3cc35fd

File tree

7 files changed

+110
-0
lines changed

7 files changed

+110
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<config>
9+
<type name="YesNo<caret>">
10+
</type>
11+
</config>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Catalog\Model;
8+
9+
class TestNotLineMarker
10+
{
11+
public function someMethod()
12+
{
13+
}
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Theme\Block\Html;
8+
9+
class Topmenu extends \Magento\Framework\View\Element\Template implements \Magento\Framework\DataObject\IdentityInterface
10+
{
11+
public function someMethod()
12+
{
13+
}
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<config>
9+
<type name="Magento\Backend\Model\Source\YesNo<caret>">
10+
</type>
11+
</config>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
* Copyright © Magento, Inc. All rights reserved.
3+
* See COPYING.txt for license details.
4+
*/
5+
package com.magento.idea.magento2plugin.completion.xml;
6+
7+
import com.magento.idea.magento2plugin.magento.files.ModuleDiXml;
8+
9+
public class ConfigurationTypeCompletionRegistrarTest extends CompletionXmlFixtureTestCase {
10+
11+
private static final String[] lookupStringsTypeName = new String[] {
12+
"Magento\\Backend\\Model\\Source\\YesNo"
13+
};
14+
15+
public void testDiXmlTypeNameMustHaveCompletion() {
16+
String filePath = this.getFixturePath(ModuleDiXml.FILE_NAME);
17+
myFixture.copyFileToProject(filePath);
18+
19+
assertFileContainsCompletions(filePath, lookupStringsTypeName);
20+
}
21+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
* Copyright © Magento, Inc. All rights reserved.
3+
* See COPYING.txt for license details.
4+
*/
5+
package com.magento.idea.magento2plugin.linemarker.php;
6+
7+
public class ConfigurationTypeClassLinemarkerRegistrarTest extends LinemarkerPhpFixtureTestCase {
8+
9+
public void testTypeNameClassShouldHaveLinemarker() {
10+
String filePath = this.getFixturePath("Topmenu.php");
11+
myFixture.configureByFile(filePath);
12+
13+
assertHasLinemarkerWithTooltipAndIcon("Navigate to configuration", "/fileTypes/xml.svg");
14+
}
15+
16+
public void testRegularPhpClassShouldNotHaveLinemarker() {
17+
String filePath = this.getFixturePath("TestNotLineMarker.php");
18+
myFixture.configureByFile(filePath);
19+
20+
assertHasNoLinemarkerWithTooltipAndIcon("Navigate to configuration", "/fileTypes/xml.svg");
21+
}
22+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/*
2+
* Copyright © Magento, Inc. All rights reserved.
3+
* See COPYING.txt for license details.
4+
*/
5+
package com.magento.idea.magento2plugin.reference.xml;
6+
7+
import com.magento.idea.magento2plugin.magento.files.ModuleDiXml;
8+
9+
public class ConfigurationTypeReferenceRegistrarTest extends ReferenceXmlFixtureTestCase {
10+
11+
public void testDiXmlTypeNameMustHaveReference() {
12+
String filePath = this.getFixturePath(ModuleDiXml.FILE_NAME);
13+
myFixture.configureByFile(filePath);
14+
15+
assertHasReferencePhpClass("Magento\\Backend\\Model\\Source\\YesNo");
16+
}
17+
}

0 commit comments

Comments
 (0)