-
-
Notifications
You must be signed in to change notification settings - Fork 138
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Impl. Expression Language Injections for YAML (tests)
- Loading branch information
Showing
1 changed file
with
63 additions
and
0 deletions.
There are no files selected for viewing
63 changes: 63 additions & 0 deletions
63
.../java/fr/adrienbrault/idea/symfony2plugin/tests/config/yaml/YamlLanguageInjectorTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package fr.adrienbrault.idea.symfony2plugin.tests.config.yaml; | ||
|
||
import com.intellij.testFramework.fixtures.InjectionTestFixture; | ||
import fr.adrienbrault.idea.symfony2plugin.tests.SymfonyLightCodeInsightFixtureTestCase; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
public class YamlLanguageInjectorTest extends SymfonyLightCodeInsightFixtureTestCase { | ||
|
||
private InjectionTestFixture injectionTestFixture; | ||
|
||
@Override | ||
public void setUp() throws Exception { | ||
super.setUp(); | ||
|
||
injectionTestFixture = new InjectionTestFixture(myFixture); | ||
} | ||
|
||
public void testLanguageInjections() { | ||
assertExpressionLanguageIsInjectedAtCaret( | ||
"services.yaml", | ||
"services:\n" + | ||
" App\\Service\\ExampleService:\n" + | ||
" arguments:\n" + | ||
" $example: '@=service(<caret>'\n" | ||
); | ||
|
||
assertExpressionLanguageIsInjectedAtCaret( | ||
"services.yaml", | ||
"services:\n" + | ||
" App\\Service\\ExampleService:\n" + | ||
" calls:\n" + | ||
" - example: ['@=service(<caret>']\n" | ||
); | ||
|
||
assertExpressionLanguageIsInjectedAtCaret( | ||
"services.yaml", | ||
"services:\n" + | ||
" App\\Service\\ExampleService:\n" + | ||
" properties:\n" + | ||
" example: '@=service(<caret>']\n" | ||
); | ||
|
||
assertExpressionLanguageIsInjectedAtCaret( | ||
"services.yaml", | ||
"services:\n" + | ||
" App\\Service\\ExampleService:\n" + | ||
" configurator: ['@=service(<caret>', 'configure']\n" | ||
); | ||
|
||
assertExpressionLanguageIsInjectedAtCaret( | ||
"routing.yaml", | ||
"app.contact:\n" + | ||
" path: /contact\n" + | ||
" controller: 'App\\Controller\\DefaultController::contact'\n" + | ||
" condition: 'context.getMethod() in <caret>'\n" | ||
); | ||
} | ||
|
||
private void assertExpressionLanguageIsInjectedAtCaret(@NotNull String fileName, @NotNull String text) { | ||
myFixture.configureByText(fileName, text); | ||
injectionTestFixture.assertInjectedLangAtCaret("Symfony Expression Language"); | ||
} | ||
} |