Integration Tests: Use empty temp folder for legacy lang config when using integration tests outside core (closes #20888) (#20889)
* Use empty folder under temp as localized text source folder in non umbraco core integration tests. * Added clarifying comment to the GetLocalizedTextService override for tests
This commit is contained in:
@@ -125,18 +125,15 @@ public static class UmbracoBuilderExtensions
|
||||
|
||||
if (!currFolder.Exists)
|
||||
{
|
||||
currFolder = new DirectoryInfo(Path.GetTempPath());
|
||||
// When Umbraco.Integration.Tests is installed in a "consumer" Umbraco site, the src/tests path might not be there.
|
||||
// This replaces the folder reference with an empty folder under temp
|
||||
// such that the LocalizedTextServiceFileSources don't blow up from directory not found,
|
||||
// or reading random xml files from the base temp folder.
|
||||
var tempPath = Path.GetTempPath();
|
||||
currFolder = new DirectoryInfo(Path.GetFullPath("Umbraco.Integration.Tests.Fake.SrcRoot", tempPath));
|
||||
currFolder.Create();
|
||||
}
|
||||
|
||||
var uiProject = currFolder.GetDirectories("Umbraco.Web.UI", SearchOption.TopDirectoryOnly).FirstOrDefault();
|
||||
if (uiProject == null)
|
||||
{
|
||||
uiProject = new DirectoryInfo(Path.Combine(Path.GetTempPath(), "Umbraco.Web.UI"));
|
||||
uiProject.Create();
|
||||
}
|
||||
|
||||
var mainLangFolder = new DirectoryInfo(Path.Combine(uiProject.FullName, Constants.System.DefaultUmbracoPath.TrimStart(Constants.CharArrays.TildeForwardSlash), "config", "lang"));
|
||||
|
||||
return new LocalizedTextServiceFileSources(
|
||||
loggerFactory.CreateLogger<LocalizedTextServiceFileSources>(),
|
||||
appCaches,
|
||||
|
||||
Reference in New Issue
Block a user