File tree Expand file tree Collapse file tree 2 files changed +53
-0
lines changed
src/test/java/fr/adrienbrault/idea/symfony2plugin/tests/config/yaml Expand file tree Collapse file tree 2 files changed +53
-0
lines changed Original file line number Diff line number Diff line change 1+ package fr .adrienbrault .idea .symfony2plugin .tests .config .yaml ;
2+
3+ import com .intellij .patterns .PlatformPatterns ;
4+ import com .jetbrains .php .lang .psi .elements .Field ;
5+ import com .jetbrains .php .lang .psi .elements .PhpDefine ;
6+ import fr .adrienbrault .idea .symfony2plugin .tests .SymfonyLightCodeInsightFixtureTestCase ;
7+ import org .jetbrains .yaml .YAMLFileType ;
8+
9+ public class YamlReferenceContributorTest extends SymfonyLightCodeInsightFixtureTestCase {
10+
11+ public void setUp () throws Exception {
12+ super .setUp ();
13+ myFixture .copyFileToProject ("YamlReferenceContributor.php" );
14+ }
15+
16+ public String getTestDataPath () {
17+ return "src/test/java/fr/adrienbrault/idea/symfony2plugin/tests/config/yaml/fixtures" ;
18+ }
19+
20+ public void testConstantProvidesReferences () {
21+ assertReferenceMatchOnParent (
22+ YAMLFileType .YML ,
23+ "services:\n " +
24+ " app.service.example:\n " +
25+ " arguments:\n " +
26+ " - !php/const CONST_<caret>FOO\n " ,
27+ PlatformPatterns .psiElement (PhpDefine .class ).withName ("CONST_FOO" )
28+ );
29+
30+ assertReferenceMatchOnParent (
31+ YAMLFileType .YML ,
32+ "services:\n " +
33+ " app.service.example:\n " +
34+ " arguments:\n " +
35+ " - !php/const Foo\\ Bar::F<caret>OO\n " ,
36+ PlatformPatterns .psiElement (Field .class ).withName ("FOO" )
37+ );
38+ }
39+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace
4+ {
5+ define ('CONST_FOO ' , 'CONST_FOO ' );
6+ }
7+
8+ namespace Foo
9+ {
10+ class Bar
11+ {
12+ const FOO = 'foo ' ;
13+ }
14+ }
You can’t perform that action at this time.
0 commit comments