Skip to content

Commit 76a8d4c

Browse files
committed
Added logging in test
1 parent 7379387 commit 76a8d4c

File tree

3 files changed

+10
-12
lines changed

3 files changed

+10
-12
lines changed

src/Umbraco.Tests.Integration/Umbraco.Web.BackOffice/Controllers/ContentControllerTests.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,8 +444,12 @@ public async Task PostSave_Validates_Domains_Exist()
444444
body = body.TrimStart(AngularJsonMediaTypeFormatter.XsrfPrefix);
445445
ContentItemDisplay display = JsonConvert.DeserializeObject<ContentItemDisplay>(body);
446446

447-
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
447+
TestContext.Progress.Write($"======CURRENT THREAD CULTURE IN TEST======{Thread.CurrentThread.CurrentCulture.Name}");
448448
ILocalizedTextService localizedTextService = GetRequiredService<ILocalizedTextService>();
449+
foreach (var culture in localizedTextService.GetSupportedCultures())
450+
{
451+
TestContext.Progress.Write($"======SUPPORTED CULTURES IN TEXT SERVICE======{culture.Name}");
452+
}
449453
var expectedMessage = localizedTextService.Localize("speechBubbles", "publishWithNoDomains", new []{"en-US"});
450454

451455
Assert.Multiple(() =>
@@ -507,6 +511,7 @@ public async Task PostSave_Validates_All_Cultures_Has_Domains()
507511
body = body.TrimStart(AngularJsonMediaTypeFormatter.XsrfPrefix);
508512
ContentItemDisplay display = JsonConvert.DeserializeObject<ContentItemDisplay>(body);
509513

514+
510515
ILocalizedTextService localizedTextService = GetRequiredService<ILocalizedTextService>();
511516
var expectedMessage = localizedTextService.Localize("speechBubbles", "publishWithMissingDomain", new []{"en-US"});
512517

src/Umbraco.Tests.UnitTests/Umbraco.Web.BackOffice/Controllers/ContentControllerTests.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,8 +261,7 @@ private ContentController CreateContentController(IDomainService domainService)
261261
Mock.Of<ISqlContext>(),
262262
Mock.Of<IJsonSerializer>(),
263263
Mock.Of<IScopeProvider>(),
264-
Mock.Of<IAuthorizationService>(),
265-
Mock.Of<IUserDataService>()
264+
Mock.Of<IAuthorizationService>()
266265
);
267266

268267
return controller;

src/Umbraco.Web.BackOffice/Controllers/ContentController.cs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ public class ContentController : ContentControllerBase
6565
private readonly Lazy<IDictionary<string, ILanguage>> _allLangs;
6666
private readonly ILogger<ContentController> _logger;
6767
private readonly IScopeProvider _scopeProvider;
68-
private readonly IUserDataService _userDataService;
6968

7069
public object Domains { get; private set; }
7170

@@ -91,8 +90,7 @@ public ContentController(
9190
ISqlContext sqlContext,
9291
IJsonSerializer serializer,
9392
IScopeProvider scopeProvider,
94-
IAuthorizationService authorizationService,
95-
IUserDataService userDataService)
93+
IAuthorizationService authorizationService)
9694
: base(cultureDictionary, loggerFactory, shortStringHelper, eventMessages, localizedTextService, serializer)
9795
{
9896
_propertyEditors = propertyEditors;
@@ -114,7 +112,6 @@ public ContentController(
114112
_logger = loggerFactory.CreateLogger<ContentController>();
115113
_scopeProvider = scopeProvider;
116114
_allLangs = new Lazy<IDictionary<string, ILanguage>>(() => _localizationService.GetAllLanguages().ToDictionary(x => x.IsoCode, x => x, StringComparer.InvariantCultureIgnoreCase));
117-
_userDataService = userDataService;
118115
}
119116

120117
/// <summary>
@@ -1473,17 +1470,14 @@ internal void AddDomainWarnings(IContent persistedContent, string[] culturesPubl
14731470
{
14741471
assignedDomains.UnionWith(_domainService.GetAssignedDomains(ancestorID, true));
14751472
}
1476-
foreach (var data in _userDataService.GetUserData())
1477-
{
1478-
_logger.LogWarning($"{data.Name} : {data.Data}");
1479-
}
1473+
14801474
// No domains at all, add a warning, to add domains.
14811475
if (assignedDomains.Count == 0)
14821476
{
14831477
globalNotifications.AddWarningNotification(
14841478
_localizedTextService.Localize("auditTrails", "publish"),
14851479
_localizedTextService.Localize("speechBubbles", "publishWithNoDomains"));
1486-
_logger.LogWarning("NOT REGISTRED DOMAIN FOR: {Cultures}");
1480+
14871481
_logger.LogWarning("The root node {RootNodeName} was published with multiple cultures, but no domains are configured, this will cause routing and caching issues, please register domains for: {Cultures}",
14881482
persistedContent.Name, string.Join(", ", publishedCultures));
14891483
return;

0 commit comments

Comments
 (0)