|
| 1 | +package fr.adrienbrault.idea.symfony2plugin.tests.stubs.indexes; |
| 2 | + |
| 3 | +import com.intellij.ide.highlighter.XmlFileType; |
| 4 | +import fr.adrienbrault.idea.symfony2plugin.stubs.indexes.RoutesStubIndex; |
| 5 | +import fr.adrienbrault.idea.symfony2plugin.tests.SymfonyLightCodeInsightFixtureTestCase; |
| 6 | +import org.jetbrains.yaml.YAMLFileType; |
| 7 | + |
| 8 | +/** |
| 9 | + * @author Daniel Espendiller <daniel@espendiller.net> |
| 10 | + * @see fr.adrienbrault.idea.symfony2plugin.stubs.indexes.RoutesStubIndex |
| 11 | + */ |
| 12 | +public class RoutesStubIndexTestTest extends SymfonyLightCodeInsightFixtureTestCase { |
| 13 | + |
| 14 | + public void setUp() throws Exception { |
| 15 | + super.setUp(); |
| 16 | + |
| 17 | + myFixture.configureByText(YAMLFileType.YML, "" + |
| 18 | + "foo_yaml_pattern:\n" + |
| 19 | + " pattern: /\n" + |
| 20 | + " defaults: { _controller: foo_controller }" + |
| 21 | + "\n" + |
| 22 | + "foo_yaml_path:\n" + |
| 23 | + " path: /\n" + |
| 24 | + " defaults: { _controller: foo_controller }" + |
| 25 | + "\n" + |
| 26 | + "foo_yaml_path_only:\n" + |
| 27 | + " path: /\n" + |
| 28 | + "foo_yaml_invalid:\n" + |
| 29 | + " path_invalid: /\n" |
| 30 | + ); |
| 31 | + |
| 32 | + myFixture.configureByText(XmlFileType.INSTANCE, "" + |
| 33 | + "<routes>\n" + |
| 34 | + " <route id=\"foo_xml_pattern\" pattern=\"/blog/{slug}\"/>\n" + |
| 35 | + " <route id=\"foo_xml_path\" path=\"/blog/{slug}\">\n" + |
| 36 | + " <default key=\"_controller\">Foo</default>\n" + |
| 37 | + " </route>\n" + |
| 38 | + " <route id=\"foo_xml_id_only\"/>\n" + |
| 39 | + "</routes>" |
| 40 | + ); |
| 41 | + } |
| 42 | + |
| 43 | + /** |
| 44 | + * @see fr.adrienbrault.idea.symfony2plugin.stubs.indexes.RoutesStubIndex#getIndexer() |
| 45 | + */ |
| 46 | + public void testRouteIdIndex() { |
| 47 | + assertIndexContains(RoutesStubIndex.KEY, |
| 48 | + "foo_yaml_pattern", "foo_yaml_path", "foo_yaml_path_only", |
| 49 | + "foo_xml_pattern", "foo_xml_path", "foo_xml_id_only" |
| 50 | + ); |
| 51 | + |
| 52 | + assertIndexNotContains(RoutesStubIndex.KEY, |
| 53 | + "foo_yaml_invalid" |
| 54 | + ); |
| 55 | + } |
| 56 | +} |
0 commit comments