File tree Expand file tree Collapse file tree 1 file changed +46
-0
lines changed
src/test/java/fr/adrienbrault/idea/symfony2plugin/tests/config/xml Expand file tree Collapse file tree 1 file changed +46
-0
lines changed Original file line number Diff line number Diff line change 1+ package fr .adrienbrault .idea .symfony2plugin .tests .config .xml ;
2+
3+ import com .intellij .testFramework .fixtures .InjectionTestFixture ;
4+ import fr .adrienbrault .idea .symfony2plugin .tests .SymfonyLightCodeInsightFixtureTestCase ;
5+ import org .jetbrains .annotations .NotNull ;
6+
7+ public class XmlLanguageInjectorTest extends SymfonyLightCodeInsightFixtureTestCase {
8+
9+ private InjectionTestFixture injectionTestFixture ;
10+
11+ @ Override
12+ public void setUp () throws Exception {
13+ super .setUp ();
14+
15+ injectionTestFixture = new InjectionTestFixture (myFixture );
16+ }
17+
18+ public void testLanguageInjections () {
19+ assertExpressionLanguageIsInjectedAtCaret (
20+ "services.xml" ,
21+ "<?xml version=\" 1.0\" ?>\n " +
22+ "<container>\n " +
23+ " <services>\n " +
24+ " <service id=\" App\\ Service\\ ExampleService\" >\n " +
25+ " <argument type=\" expression\" >container.hasParameter('some_param') ?<caret></argument>\n " +
26+ " </service>\n " +
27+ " </services>\n " +
28+ "</container>"
29+ );
30+
31+ assertExpressionLanguageIsInjectedAtCaret (
32+ "routing.xml" ,
33+ "<?xml version=\" 1.0\" encoding=\" UTF-8\" ?>\n " +
34+ "<routes>\n " +
35+ " <route id=\" contact\" path=\" /contact\" controller=\" App\\ Controller\\ DefaultController::contact\" >\n " +
36+ " <condition>context.getMethod() in <caret></condition>\n " +
37+ " </route>\n " +
38+ "</routes>"
39+ );
40+ }
41+
42+ private void assertExpressionLanguageIsInjectedAtCaret (@ NotNull String fileName , @ NotNull String text ) {
43+ myFixture .configureByText (fileName , text );
44+ injectionTestFixture .assertInjectedLangAtCaret ("Symfony Expression Language" );
45+ }
46+ }
You can’t perform that action at this time.
0 commit comments