Merge branch 'v13/dev' into v14/dev
# Conflicts: # Directory.Packages.props # build/azure-pipelines.yml # src/Umbraco.Cms.Api.Common/DependencyInjection/UmbracoBuilderAuthExtensions.cs # src/Umbraco.Cms.Persistence.EFCore/Locking/SqlServerEFCoreDistributedLockingMechanism.cs # src/Umbraco.Core/Configuration/Models/RichTextEditorSettings.cs # src/Umbraco.Core/EmbeddedResources/Lang/da.xml # src/Umbraco.Core/EmbeddedResources/Lang/en.xml # src/Umbraco.Core/EmbeddedResources/Lang/en_us.xml # src/Umbraco.Core/Services/ContentService.cs # src/Umbraco.Web.BackOffice/Authorization/ContentPermissionsQueryStringHandler.cs # src/Umbraco.Web.BackOffice/Authorization/ContentPermissionsResourceHandler.cs # src/Umbraco.Web.BackOffice/Controllers/ContentController.cs # src/Umbraco.Web.BackOffice/Controllers/ExamineManagementController.cs # src/Umbraco.Web.BackOffice/Controllers/MediaController.cs # src/Umbraco.Web.BackOffice/Trees/StaticFilesTreeController.cs # src/Umbraco.Web.UI.Client/package-lock.json # src/Umbraco.Web.UI.Client/package.json # src/Umbraco.Web.UI.Client/src/common/directives/components/buttons/umbbuttongroup.directive.js # src/Umbraco.Web.UI.Client/src/common/directives/components/content/edit.controller.js # src/Umbraco.Web.UI.Client/src/common/filters/simpleMarkdown.filter.js # src/Umbraco.Web.UI.Client/src/common/filters/simpleMarkdown.filter.js.js # src/Umbraco.Web.UI.Client/src/common/services/tinymce.service.js # src/Umbraco.Web.UI.Client/src/less/components/umb-group-builder.less # src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/mediaentryeditor/mediaentryeditor.less # src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/propertysettings/propertysettings.html # src/Umbraco.Web.UI.Client/src/views/common/overlays/ysod/ysod.controller.js # src/Umbraco.Web.UI.Client/src/views/common/overlays/ysod/ysod.html # src/Umbraco.Web.UI.Client/src/views/components/buttons/umb-button-group.html # src/Umbraco.Web.UI.Client/src/views/content/overlays/sendtopublish.controller.js # src/Umbraco.Web.UI.Client/src/views/propertyeditors/blockgrid/prevalue/blockgrid.blockconfiguration.overlay.controller.js # src/Umbraco.Web.UI.Client/src/views/propertyeditors/blockgrid/prevalue/blockgrid.blockconfiguration.overlay.html # src/Umbraco.Web.UI.Client/src/views/propertyeditors/blocklist/prevalue/blocklist.blockconfiguration.overlay.controller.js # src/Umbraco.Web.UI.Client/src/views/propertyeditors/blocklist/prevalue/blocklist.blockconfiguration.overlay.html # src/Umbraco.Web.UI.Client/src/views/propertyeditors/rte/rte.component.js # src/Umbraco.Web.UI.Client~HEAD # src/Umbraco.Web.UI.Login/package-lock.json # src/Umbraco.Web.UI.Login/package.json # tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/BlockGridEditor/Content/blockGridEditorContent.spec.ts # tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/ContentServiceNotificationTests.cs # tests/Umbraco.Tests.UnitTests/Umbraco.Web.BackOffice/Controllers/ContentControllerTests.cs # tools/Umbraco.JsonSchema/UmbracoCmsSchema.cs # version.json
This commit is contained in:
@@ -84,7 +84,11 @@ public abstract class UmbracoIntegrationTest : UmbracoIntegrationTestBase
|
||||
}
|
||||
|
||||
[TearDown]
|
||||
public void TearDownAsync() => _host.StopAsync();
|
||||
public void TearDownAsync()
|
||||
{
|
||||
_host.StopAsync();
|
||||
Services.DisposeIfDisposable();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create the Generic Host and execute startup ConfigureServices/Configure calls
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -54,7 +54,8 @@ public class ContentServiceNotificationTests : UmbracoIntegrationTest
|
||||
.AddNotificationHandler<ContentPublishingNotification, ContentNotificationHandler>()
|
||||
.AddNotificationHandler<ContentPublishedNotification, ContentNotificationHandler>()
|
||||
.AddNotificationHandler<ContentUnpublishingNotification, ContentNotificationHandler>()
|
||||
.AddNotificationHandler<ContentUnpublishedNotification, ContentNotificationHandler>();
|
||||
.AddNotificationHandler<ContentUnpublishedNotification, ContentNotificationHandler>()
|
||||
.AddNotificationHandler<ContentTreeChangeNotification, ContentNotificationHandler>();
|
||||
|
||||
private void CreateTestData()
|
||||
{
|
||||
@@ -176,6 +177,69 @@ public class ContentServiceNotificationTests : UmbracoIntegrationTest
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Publishing_Invariant()
|
||||
{
|
||||
IContent document = new Content("content", -1, _contentType);
|
||||
ContentService.Save(document);
|
||||
|
||||
var treeChangeWasCalled = false;
|
||||
|
||||
ContentNotificationHandler.TreeChange += notification =>
|
||||
{
|
||||
var change = notification.Changes.FirstOrDefault();
|
||||
var publishedCultures = change?.PublishedCultures?.ToArray();
|
||||
Assert.IsNotNull(publishedCultures);
|
||||
Assert.AreEqual(1, publishedCultures.Length);
|
||||
Assert.IsTrue(publishedCultures.InvariantContains("*"));
|
||||
Assert.IsNull(change.UnpublishedCultures);
|
||||
|
||||
treeChangeWasCalled = true;
|
||||
};
|
||||
|
||||
try
|
||||
{
|
||||
ContentService.Publish(document, ["*"]);
|
||||
Assert.IsTrue(treeChangeWasCalled);
|
||||
}
|
||||
finally
|
||||
{
|
||||
ContentNotificationHandler.TreeChange = null;
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Unpublishing_Invariant()
|
||||
{
|
||||
IContent document = new Content("content", -1, _contentType);
|
||||
ContentService.Save(document);
|
||||
ContentService.Publish(document, ["*"]);
|
||||
|
||||
var treeChangeWasCalled = false;
|
||||
|
||||
ContentNotificationHandler.TreeChange += notification =>
|
||||
{
|
||||
var change = notification.Changes.FirstOrDefault();
|
||||
Assert.IsNull(change?.PublishedCultures);
|
||||
var unpublishedCultures = change?.UnpublishedCultures?.ToArray();
|
||||
Assert.IsNotNull(unpublishedCultures);
|
||||
Assert.AreEqual(1, unpublishedCultures.Length);
|
||||
Assert.IsTrue(unpublishedCultures.InvariantContains("*"));
|
||||
|
||||
treeChangeWasCalled = true;
|
||||
};
|
||||
|
||||
try
|
||||
{
|
||||
ContentService.Unpublish(document);
|
||||
Assert.IsTrue(treeChangeWasCalled);
|
||||
}
|
||||
finally
|
||||
{
|
||||
ContentNotificationHandler.TreeChange = null;
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task Publishing_Culture()
|
||||
{
|
||||
@@ -202,6 +266,7 @@ public class ContentServiceNotificationTests : UmbracoIntegrationTest
|
||||
|
||||
var publishingWasCalled = false;
|
||||
var publishedWasCalled = false;
|
||||
var treeChangeWasCalled = false;
|
||||
|
||||
ContentNotificationHandler.PublishingContent += notification =>
|
||||
{
|
||||
@@ -227,16 +292,30 @@ public class ContentServiceNotificationTests : UmbracoIntegrationTest
|
||||
publishedWasCalled = true;
|
||||
};
|
||||
|
||||
ContentNotificationHandler.TreeChange += notification =>
|
||||
{
|
||||
var change = notification.Changes.FirstOrDefault();
|
||||
var publishedCultures = change?.PublishedCultures?.ToArray();
|
||||
Assert.IsNotNull(publishedCultures);
|
||||
Assert.AreEqual(1, publishedCultures.Length);
|
||||
Assert.IsTrue(publishedCultures.InvariantContains("fr-FR"));
|
||||
Assert.IsNull(change.UnpublishedCultures);
|
||||
|
||||
treeChangeWasCalled = true;
|
||||
};
|
||||
|
||||
try
|
||||
{
|
||||
ContentService.Publish(document, new[] { "fr-FR" });
|
||||
Assert.IsTrue(publishingWasCalled);
|
||||
Assert.IsTrue(publishedWasCalled);
|
||||
Assert.IsTrue(treeChangeWasCalled);
|
||||
}
|
||||
finally
|
||||
{
|
||||
ContentNotificationHandler.PublishingContent = null;
|
||||
ContentNotificationHandler.PublishedContent = null;
|
||||
ContentNotificationHandler.TreeChange = null;
|
||||
}
|
||||
|
||||
document = ContentService.GetById(document.Id);
|
||||
@@ -399,6 +478,7 @@ public class ContentServiceNotificationTests : UmbracoIntegrationTest
|
||||
|
||||
var publishingWasCalled = false;
|
||||
var publishedWasCalled = false;
|
||||
var treeChangeWasCalled = false;
|
||||
|
||||
// TODO: revisit this - it was migrated when removing static events, but the expected result seems illogic - why does this test bind to Published and not Unpublished?
|
||||
|
||||
@@ -432,16 +512,30 @@ public class ContentServiceNotificationTests : UmbracoIntegrationTest
|
||||
publishedWasCalled = true;
|
||||
};
|
||||
|
||||
ContentNotificationHandler.TreeChange += notification =>
|
||||
{
|
||||
var change = notification.Changes.FirstOrDefault();
|
||||
var unpublishedCultures = change?.UnpublishedCultures?.ToArray();
|
||||
Assert.IsNotNull(unpublishedCultures);
|
||||
Assert.AreEqual(1, unpublishedCultures.Length);
|
||||
Assert.IsTrue(unpublishedCultures.InvariantContains("fr-FR"));
|
||||
Assert.IsNull(change.PublishedCultures);
|
||||
|
||||
treeChangeWasCalled = true;
|
||||
};
|
||||
|
||||
try
|
||||
{
|
||||
ContentService.CommitDocumentChanges(document);
|
||||
Assert.IsTrue(publishingWasCalled);
|
||||
Assert.IsTrue(publishedWasCalled);
|
||||
Assert.IsTrue(treeChangeWasCalled);
|
||||
}
|
||||
finally
|
||||
{
|
||||
ContentNotificationHandler.PublishingContent = null;
|
||||
ContentNotificationHandler.PublishedContent = null;
|
||||
ContentNotificationHandler.TreeChange = null;
|
||||
}
|
||||
|
||||
document = ContentService.GetById(document.Id);
|
||||
@@ -456,7 +550,8 @@ public class ContentServiceNotificationTests : UmbracoIntegrationTest
|
||||
INotificationHandler<ContentPublishingNotification>,
|
||||
INotificationHandler<ContentPublishedNotification>,
|
||||
INotificationHandler<ContentUnpublishingNotification>,
|
||||
INotificationHandler<ContentUnpublishedNotification>
|
||||
INotificationHandler<ContentUnpublishedNotification>,
|
||||
INotificationHandler<ContentTreeChangeNotification>
|
||||
{
|
||||
public static Action<ContentSavingNotification> SavingContent { get; set; }
|
||||
|
||||
@@ -470,6 +565,8 @@ public class ContentServiceNotificationTests : UmbracoIntegrationTest
|
||||
|
||||
public static Action<ContentUnpublishedNotification> UnpublishedContent { get; set; }
|
||||
|
||||
public static Action<ContentTreeChangeNotification> TreeChange { get; set; }
|
||||
|
||||
public void Handle(ContentPublishedNotification notification) => PublishedContent?.Invoke(notification);
|
||||
|
||||
public void Handle(ContentPublishingNotification notification) => PublishingContent?.Invoke(notification);
|
||||
@@ -480,5 +577,7 @@ public class ContentServiceNotificationTests : UmbracoIntegrationTest
|
||||
public void Handle(ContentUnpublishedNotification notification) => UnpublishedContent?.Invoke(notification);
|
||||
|
||||
public void Handle(ContentUnpublishingNotification notification) => UnpublishingContent?.Invoke(notification);
|
||||
|
||||
public void Handle(ContentTreeChangeNotification notification) => TreeChange?.Invoke(notification);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user