66import com .intellij .util .indexing .FileBasedIndex ;
77import fr .adrienbrault .idea .symfony2plugin .stubs .indexes .TranslationStubIndex ;
88import fr .adrienbrault .idea .symfony2plugin .tests .SymfonyLightCodeInsightFixtureTestCase ;
9+ import org .apache .commons .lang .StringUtils ;
910import org .jetbrains .annotations .NotNull ;
1011
1112import java .util .Set ;
@@ -32,6 +33,9 @@ public void setUp() throws Exception {
3233 myFixture .copyFileToProject ("car.de.yml" , "Resources/translations/car.de.yml" );
3334 myFixture .copyFileToProject ("car.de.yml" , "translations/car_flex_yml.de.yml" );
3435 myFixture .copyFileToProject ("car.de.yml" , "translations/car_flex_yaml.de.yaml" );
36+
37+ myFixture .copyFileToProject ("fr.xlf" , "+intl-icu.fr.xlf" );
38+ myFixture .copyFileToProject ("fr.xlf" , " .fr.xlf" );
3539 }
3640
3741 public String getTestDataPath () {
@@ -99,10 +103,19 @@ public void testThatTranslationsInRootForSymfonyFlexIsInIndex() {
99103 assertContainsElements (getDomainKeys ("car_flex_yaml" ), "foo_yaml.symfony.great" );
100104 assertContainsElements (getDomainKeys ("car_xlf_flex" ), "Symfony is great" );
101105 }
106+
102107 public void testThatIcuMessagesAreInIndex () {
103108 assertContainsElements (getDomainKeys ("messages" ), "Hello {name}" );
104109 assertContainsElements (getDomainKeys ("messages" ), "resname.hello" );
105110 }
111+
112+ public void testThatEmptyDomainAreNotAdded () {
113+ assertFalse (FileBasedIndex .getInstance ()
114+ .getAllKeys (TranslationStubIndex .KEY , getProject ())
115+ .stream ()
116+ .anyMatch (StringUtils ::isBlank )
117+ );
118+ }
106119
107120 @ NotNull
108121 private Set <String > getDomainKeys (@ NotNull String domain ) {
0 commit comments