Skip to content

Commit 8aa7118

Browse files
committed
Added test for PluginLineMarkerProvider
1 parent d96d03c commit 8aa7118

File tree

5 files changed

+80
-0
lines changed

5 files changed

+80
-0
lines changed
Lines changed: 14 additions & 0 deletions
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;
8+
9+
class PluginClass
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\Catalog\Model;
8+
9+
class RegularClass
10+
{
11+
public function someMethod()
12+
{
13+
}
14+
}
Lines changed: 14 additions & 0 deletions
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\Plugin;
8+
9+
class PluginClass
10+
{
11+
public function beforeSomeMethod()
12+
{
13+
}
14+
}

testData/project/magento2/vendor/magento/module-catalog/etc/di.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
11
<?xml version="1.0"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
28
<config>
39
<type name="Magento\Theme\Block\Html\Topmenu">
410
<plugin name="catalogTopmenu" type="Magento\Catalog\Plugin\Block\Topmenu" />
511
</type>
12+
<type name="Magento\Theme\Block\PluginClass">
13+
<plugin name="pluginClass" type="Magento\Catalog\Plugin\PluginClass" />
14+
</type>
615
<type name="Magento\Framework\Mview\View\StateInterface">
716
<plugin name="setStatusForMview"
817
type="Magento\Catalog\Model\Indexer\Category\Product\Plugin\MviewState"/>
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* Copyright © Magento, Inc. All rights reserved.
3+
* See COPYING.txt for license details.
4+
*/
5+
6+
package com.magento.idea.magento2plugin.linemarker.php;
7+
8+
import com.magento.idea.magento2plugin.linemarker.LinemarkerFixtureTestCase;
9+
10+
public class PluginLinemarkerRegistrarTest extends LinemarkerFixtureTestCase {
11+
12+
/**
13+
* Tests linemarker in a class which has plugins.
14+
*/
15+
public void testClassWithPluginShouldHaveLinemarker() {
16+
myFixture.configureByFile(this.getFixturePath("PluginClass.php", "php"));
17+
18+
assertHasLinemarkerWithTooltipAndIcon("Navigate to plugins", "/nodes/plugin.svg");
19+
}
20+
21+
/**
22+
* Tests linemarker in a class which does not have plugins.
23+
*/
24+
public void testClassWithoutPluginShouldNotHaveLinemarker() {
25+
myFixture.configureByFile(this.getFixturePath("RegularClass.php", "php"));
26+
27+
assertHasNoLinemarkerWithTooltipAndIcon("Navigate to plugins", "/nodes/plugin.svg");
28+
}
29+
}

0 commit comments

Comments
 (0)