V17 - Removing obsoleted code from Umbraco.Core (#20009)
* Removing obsoleted code from ApiMediaQueryService.cs * Removing obsoleted code from ApiRichTextMarkupParserTests.cs * Removing obsoleted code from ContentCacheRefresher.cs * Removing obsoleted code from ContentFinderByUrlAlias.cs and adjusting its tests to use the new logic * Removing obsoleted code from ContentFinderByUrl.cs & its dependencies * Removing obsoleted code from ApiRichTextMarkupParserTests.cs * Removing obsoleted code from DocumentCache.cs & its dependencies * Removing obsoleted code from MediaCache.cs & its dependencies * Removing obsoleted code from PublishedCacheBase.cs & its dependencies * Removing obsoleted code from RenderNoContentController.cs and its tests * Removing obsoleted code from UmbracoRouteValueTransformer.cs * Removing obsoleted constructors from DefaultUrlProvider.cs * Removing accidental bookmark * Introducing a helper method to get the root keys in ApiMediaQueryService.cs * Removing obsoleted code from Cache classes * Removing unused imports * Refactoring to meet the CR * Added attribute to controller * Fixing missing using statement * Removing obsoleted constructor from ExternalLoginService.cs and making usages fit * Removing obsoleted method from IContentTypeFilter.cs * Removing obsoleted methods from IContentEditingService.cs * Removing obosoleted code from DocumentUrlService.cs * Removed obsoleted code from DataTypeService.cs * Removed obsoleted code from PublishStatusService.cs * Removing obsoleted code from the IContentPublishingService.cs and its dependencies. Also implementing a TODO in the service implementation * Removing obsoleted code from IRelationService.cs * Removing obsoleted code from ContentPublishingService.cs * Removing obsoleted code from ContentEditingService.cs * Removing obsoleted code from Constants-DataTypes.cs * Removing obsoleted code from IAction.cs and its implementations * Removing obsoleted code from IContentService.cs * Removing obsoleted code from DomainUtilities.cs * Removing obsoleted code from IIndexedEntitySearchService.cs and dependencies * Removing obsoleted code from UrlProvider.cs * Removing obsoleted code from AliasUrlProvider.cs * Removing obsoleted code from ApiContentRouteBuilder.cs * Removing obsoleted code from ApiPublishedContentCache.cs * Removing obsoleted class TemplateQueryResult.cs * Removing obsoleted code from ApiContentBuilder.cs * Removing obsoleted code from HealthCheck.cs * Removing obsoleted code from ContentTypeEditingService.cs * Removing obsoleted code from NewDefaultUrlProvider.cs * Removing obsoleted code from PublishedElementPropertyBase.cs * Removing obsoleted code from WebhookRequestService.cs * Bumping to obsolete in V18, due to usage in class that will be removed in V18 * Removing obsoleted code from PropertyValidationService.cs * Removing obsoleted code from AddUnroutableContentWarningsWhenPublishingNotificationHandler.cs * Removing obsoleted code from IMemberService.cs * Removing obsoleted code from DocumentCache.cs
This commit is contained in:
@@ -112,7 +112,7 @@ public abstract class UmbracoIntegrationTestWithContentEditing : UmbracoIntegrat
|
||||
PublishedTextPageId = createContentResultPublishPage.Result.Content.Id;
|
||||
}
|
||||
|
||||
var publishResult = await ContentPublishingService.PublishAsync(PublishedTextPage.Key.Value, CultureAndSchedule, Constants.Security.SuperUserKey);
|
||||
var publishResult = await ContentPublishingService.PublishAsync(PublishedTextPage.Key.Value, [new CulturePublishScheduleModel()], Constants.Security.SuperUserKey);
|
||||
Assert.IsTrue(publishResult.Success);
|
||||
|
||||
// Create and Save Content "Text Page 1" based on "umbTextpage" -> 1055
|
||||
|
||||
@@ -2,10 +2,12 @@
|
||||
// See LICENSE for more details.
|
||||
|
||||
using System.Diagnostics;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Cms.Core;
|
||||
using Umbraco.Cms.Core.Cache;
|
||||
using Umbraco.Cms.Core.Configuration.Models;
|
||||
using Umbraco.Cms.Core.Dictionary;
|
||||
using Umbraco.Cms.Core.Events;
|
||||
using Umbraco.Cms.Core.Models;
|
||||
@@ -1268,7 +1270,7 @@ internal sealed class ContentServiceTests : UmbracoIntegrationTestWithContent
|
||||
Assert.IsFalse(content.HasIdentity);
|
||||
|
||||
// content cannot publish values because they are invalid
|
||||
var propertyValidationService = new PropertyValidationService(PropertyEditorCollection, DataTypeService, LocalizedTextService, ValueEditorCache, Mock.Of<ICultureDictionary>());
|
||||
var propertyValidationService = new PropertyValidationService(PropertyEditorCollection, DataTypeService, LocalizedTextService, ValueEditorCache, Mock.Of<ICultureDictionary>(), Mock.Of<ILanguageService>(), Mock.Of<IOptions<ContentSettings>>());
|
||||
var isValid = propertyValidationService.IsPropertyDataValid(content, out var invalidProperties,
|
||||
CultureImpact.Invariant);
|
||||
Assert.IsFalse(isValid);
|
||||
|
||||
@@ -17,7 +17,7 @@ public partial class ContentPublishingServiceTests
|
||||
{
|
||||
VerifyIsNotPublished(Textpage.Key);
|
||||
|
||||
var result = await ContentPublishingService.PublishAsync(Textpage.Key, MakeModel(_allCultures), Constants.Security.SuperUserKey);
|
||||
var result = await ContentPublishingService.PublishAsync(Textpage.Key, [new CulturePublishScheduleModel()], Constants.Security.SuperUserKey);
|
||||
|
||||
Assert.IsTrue(result.Success);
|
||||
Assert.AreEqual(ContentPublishingOperationStatus.Success, result.Status);
|
||||
@@ -27,7 +27,7 @@ public partial class ContentPublishingServiceTests
|
||||
[Test]
|
||||
public async Task Publish_Single_Item_Does_Not_Publish_Children()
|
||||
{
|
||||
await ContentPublishingService.PublishAsync(Textpage.Key, MakeModel(_allCultures), Constants.Security.SuperUserKey);
|
||||
await ContentPublishingService.PublishAsync(Textpage.Key, [new CulturePublishScheduleModel()], Constants.Security.SuperUserKey);
|
||||
|
||||
VerifyIsPublished(Textpage.Key);
|
||||
VerifyIsNotPublished(Subpage.Key);
|
||||
@@ -36,9 +36,9 @@ public partial class ContentPublishingServiceTests
|
||||
[Test]
|
||||
public async Task Can_Publish_Child_Of_Root()
|
||||
{
|
||||
await ContentPublishingService.PublishAsync(Textpage.Key, MakeModel(_allCultures), Constants.Security.SuperUserKey);
|
||||
await ContentPublishingService.PublishAsync(Textpage.Key, [new CulturePublishScheduleModel()], Constants.Security.SuperUserKey);
|
||||
|
||||
var result = await ContentPublishingService.PublishAsync(Subpage.Key, MakeModel(_allCultures), Constants.Security.SuperUserKey);
|
||||
var result = await ContentPublishingService.PublishAsync(Subpage.Key, [new CulturePublishScheduleModel()], Constants.Security.SuperUserKey);
|
||||
|
||||
Assert.IsTrue(result.Success);
|
||||
Assert.AreEqual(ContentPublishingOperationStatus.Success, result.Status);
|
||||
@@ -76,7 +76,7 @@ public partial class ContentPublishingServiceTests
|
||||
[Test]
|
||||
public async Task Can_Publish_Branch_Beneath_Root()
|
||||
{
|
||||
await ContentPublishingService.PublishAsync(Textpage.Key, MakeModel(_allCultures), Constants.Security.SuperUserKey);
|
||||
await ContentPublishingService.PublishAsync(Textpage.Key, [new CulturePublishScheduleModel()], Constants.Security.SuperUserKey);
|
||||
var subpage2Subpage = ContentBuilder.CreateSimpleContent(ContentType, "Text Page 2-2", Subpage2.Id);
|
||||
ContentService.Save(subpage2Subpage, -1);
|
||||
|
||||
@@ -95,7 +95,7 @@ public partial class ContentPublishingServiceTests
|
||||
{
|
||||
ContentNotificationHandler.PublishingContent = notification => notification.Cancel = true;
|
||||
|
||||
var result = await ContentPublishingService.PublishAsync(Textpage.Key, MakeModel(_allCultures), Constants.Security.SuperUserKey);
|
||||
var result = await ContentPublishingService.PublishAsync(Textpage.Key, [new CulturePublishScheduleModel()], Constants.Security.SuperUserKey);
|
||||
|
||||
Assert.IsFalse(result.Success);
|
||||
Assert.AreEqual(ContentPublishingOperationStatus.CancelledByEvent, result.Status);
|
||||
@@ -115,7 +115,9 @@ public partial class ContentPublishingServiceTests
|
||||
content.SetValue("title", "DA title", culture: langDa.IsoCode);
|
||||
ContentService.Save(content);
|
||||
|
||||
var result = await ContentPublishingService.PublishAsync(content.Key, MakeModel(new HashSet<string>() { langEn.IsoCode, langDa.IsoCode }), Constants.Security.SuperUserKey);
|
||||
var result = await ContentPublishingService.PublishAsync(content.Key, [
|
||||
new CulturePublishScheduleModel { Culture = langEn.IsoCode },
|
||||
new CulturePublishScheduleModel { Culture = langDa.IsoCode }], Constants.Security.SuperUserKey);
|
||||
|
||||
Assert.IsTrue(result.Success);
|
||||
Assert.AreEqual(ContentPublishingOperationStatus.Success, result.Status);
|
||||
@@ -140,7 +142,9 @@ public partial class ContentPublishingServiceTests
|
||||
content.SetValue("title", "DA title", culture: langDa.IsoCode);
|
||||
ContentService.Save(content);
|
||||
|
||||
var publishResult = await ContentPublishingService.PublishAsync(content.Key, MakeModel(new HashSet<string>() { langEn.IsoCode, langDa.IsoCode }), Constants.Security.SuperUserKey);
|
||||
var publishResult = await ContentPublishingService.PublishAsync(content.Key, [
|
||||
new CulturePublishScheduleModel { Culture = langEn.IsoCode },
|
||||
new CulturePublishScheduleModel { Culture = langDa.IsoCode }], Constants.Security.SuperUserKey);
|
||||
|
||||
Assert.IsTrue(publishResult.Success);
|
||||
Assert.AreEqual(ContentPublishingOperationStatus.Success, publishResult.Status);
|
||||
@@ -158,8 +162,8 @@ public partial class ContentPublishingServiceTests
|
||||
content = ContentService.GetById(content.Key)!;
|
||||
Assert.AreEqual(0, content.PublishedCultures.Count());
|
||||
|
||||
publishResult = await ContentPublishingService.PublishAsync(content.Key, MakeModel(new HashSet<string>() { langDa.IsoCode }), Constants.Security.SuperUserKey);
|
||||
|
||||
publishResult = await ContentPublishingService.PublishAsync(content.Key, [
|
||||
new CulturePublishScheduleModel { Culture = langDa.IsoCode }], Constants.Security.SuperUserKey);
|
||||
Assert.IsTrue(publishResult.Success);
|
||||
Assert.AreEqual(ContentPublishingOperationStatus.Success, publishResult.Status);
|
||||
|
||||
@@ -221,7 +225,8 @@ public partial class ContentPublishingServiceTests
|
||||
content.SetValue("title", null, culture: langDa.IsoCode);
|
||||
ContentService.Save(content);
|
||||
|
||||
var result = await ContentPublishingService.PublishAsync(content.Key, MakeModel(new HashSet<string>() { langEn.IsoCode }), Constants.Security.SuperUserKey);
|
||||
var result = await ContentPublishingService.PublishAsync(content.Key, [new CulturePublishScheduleModel { Culture = langEn.IsoCode }], Constants.Security.SuperUserKey);
|
||||
|
||||
Assert.IsTrue(result.Success);
|
||||
Assert.AreEqual(ContentPublishingOperationStatus.Success, result.Status);
|
||||
|
||||
@@ -320,7 +325,9 @@ public partial class ContentPublishingServiceTests
|
||||
content.SetValue("title", "DA title", culture: langDa.IsoCode);
|
||||
ContentService.Save(content);
|
||||
|
||||
var result = await ContentPublishingService.PublishAsync(content.Key, MakeModel(new HashSet<string>() { langEn.IsoCode, langDa.IsoCode }), Constants.Security.SuperUserKey);
|
||||
var result = await ContentPublishingService.PublishAsync(content.Key, [
|
||||
new CulturePublishScheduleModel { Culture = langEn.IsoCode },
|
||||
new CulturePublishScheduleModel { Culture = langDa.IsoCode }], Constants.Security.SuperUserKey);
|
||||
Assert.IsTrue(result.Success);
|
||||
Assert.AreEqual(ContentPublishingOperationStatus.Success, result.Status);
|
||||
|
||||
@@ -355,7 +362,10 @@ public partial class ContentPublishingServiceTests
|
||||
content.SetValue("invariantValue", "Invariant value");
|
||||
ContentService.Save(content);
|
||||
|
||||
var result = await ContentPublishingService.PublishAsync(content.Key, MakeModel(new HashSet<string> { "en-US", "da-DK" }), Constants.Security.SuperUserKey);
|
||||
var result = await ContentPublishingService.PublishAsync(content.Key, [
|
||||
new CulturePublishScheduleModel { Culture = "en-US" },
|
||||
new CulturePublishScheduleModel { Culture = "da-DK" }], Constants.Security.SuperUserKey);
|
||||
|
||||
Assert.IsTrue(result.Success);
|
||||
|
||||
content = ContentService.GetById(content.Key)!;
|
||||
@@ -364,7 +374,7 @@ public partial class ContentPublishingServiceTests
|
||||
content.SetValue("invariantValue", null);
|
||||
ContentService.Save(content);
|
||||
|
||||
result = await ContentPublishingService.PublishAsync(content.Key, MakeModel(new HashSet<string>(culturesToRepublish)), Constants.Security.SuperUserKey);
|
||||
result = await ContentPublishingService.PublishAsync(content.Key, culturesToRepublish.Select(culture => new CulturePublishScheduleModel { Culture = culture }).ToArray(), Constants.Security.SuperUserKey);
|
||||
|
||||
content = ContentService.GetById(content.Key)!;
|
||||
|
||||
@@ -407,7 +417,7 @@ public partial class ContentPublishingServiceTests
|
||||
[Test]
|
||||
public async Task Cannot_Publish_Non_Existing_Content()
|
||||
{
|
||||
var result = await ContentPublishingService.PublishAsync(Guid.NewGuid(), MakeModel(_allCultures), Constants.Security.SuperUserKey);
|
||||
var result = await ContentPublishingService.PublishAsync(Guid.NewGuid(), _allCultures.Select(culture => new CulturePublishScheduleModel { Culture = culture }).ToArray(), Constants.Security.SuperUserKey);
|
||||
Assert.IsFalse(result.Success);
|
||||
Assert.AreEqual(ContentPublishingOperationStatus.ContentNotFound, result.Status);
|
||||
}
|
||||
@@ -426,7 +436,7 @@ public partial class ContentPublishingServiceTests
|
||||
{
|
||||
var content = await CreateInvalidContent();
|
||||
|
||||
var result = await ContentPublishingService.PublishAsync(content.Key, MakeModel(_allCultures), Constants.Security.SuperUserKey);
|
||||
var result = await ContentPublishingService.PublishAsync(content.Key, _allCultures.Select(culture => new CulturePublishScheduleModel { Culture = culture }).ToArray(), Constants.Security.SuperUserKey);
|
||||
|
||||
Assert.IsFalse(result);
|
||||
Assert.AreEqual(ContentPublishingOperationStatus.ContentInvalid, result.Status);
|
||||
@@ -475,7 +485,9 @@ public partial class ContentPublishingServiceTests
|
||||
content.SetValue("title", null, culture: langDa.IsoCode);
|
||||
ContentService.Save(content);
|
||||
|
||||
var result = await ContentPublishingService.PublishAsync(content.Key, MakeModel(new HashSet<string>() { langEn.IsoCode, langDa.IsoCode }), Constants.Security.SuperUserKey);
|
||||
var result = await ContentPublishingService.PublishAsync(content.Key, [
|
||||
new CulturePublishScheduleModel { Culture = langEn.IsoCode },
|
||||
new CulturePublishScheduleModel { Culture = langDa.IsoCode }], Constants.Security.SuperUserKey);
|
||||
Assert.IsFalse(result.Success);
|
||||
Assert.AreEqual(ContentPublishingOperationStatus.ContentInvalid, result.Status);
|
||||
|
||||
@@ -497,7 +509,9 @@ public partial class ContentPublishingServiceTests
|
||||
content.SetValue("title", "DA title", culture: langDa.IsoCode);
|
||||
ContentService.Save(content);
|
||||
|
||||
var result = await ContentPublishingService.PublishAsync(content.Key, MakeModel(new HashSet<string>() { langDa.IsoCode }), Constants.Security.SuperUserKey);
|
||||
var result = await ContentPublishingService.PublishAsync(content.Key, [
|
||||
new CulturePublishScheduleModel { Culture = langDa.IsoCode }], Constants.Security.SuperUserKey);
|
||||
|
||||
Assert.IsFalse(result.Success);
|
||||
Assert.AreEqual(ContentPublishingOperationStatus.MandatoryCultureMissing, result.Status);
|
||||
|
||||
@@ -545,7 +559,7 @@ public partial class ContentPublishingServiceTests
|
||||
{
|
||||
VerifyIsNotPublished(Textpage.Key);
|
||||
|
||||
var result = await ContentPublishingService.PublishAsync(Subpage.Key, MakeModel(_allCultures), Constants.Security.SuperUserKey);
|
||||
var result = await ContentPublishingService.PublishAsync(Subpage.Key, [new CulturePublishScheduleModel()], Constants.Security.SuperUserKey);
|
||||
|
||||
Assert.IsFalse(result.Success);
|
||||
Assert.AreEqual(ContentPublishingOperationStatus.PathNotPublished, result.Status);
|
||||
@@ -558,7 +572,7 @@ public partial class ContentPublishingServiceTests
|
||||
ContentService.MoveToRecycleBin(Subpage);
|
||||
Assert.IsTrue(ContentService.GetById(Subpage.Key)!.Trashed);
|
||||
|
||||
var result = await ContentPublishingService.PublishAsync(Subpage.Key, MakeModel(_allCultures), Constants.Security.SuperUserKey);
|
||||
var result = await ContentPublishingService.PublishAsync(Subpage.Key, [new CulturePublishScheduleModel()], Constants.Security.SuperUserKey);
|
||||
|
||||
Assert.IsFalse(result.Success);
|
||||
Assert.AreEqual(ContentPublishingOperationStatus.InTrash, result.Status);
|
||||
@@ -572,7 +586,7 @@ public partial class ContentPublishingServiceTests
|
||||
Textpage.SetValue("author", "This is not a number");
|
||||
ContentService.Save(Textpage);
|
||||
|
||||
var result = await ContentPublishingService.PublishAsync(Textpage.Key, MakeModel(_allCultures), Constants.Security.SuperUserKey);
|
||||
var result = await ContentPublishingService.PublishAsync(Textpage.Key, [new CulturePublishScheduleModel()], Constants.Security.SuperUserKey);
|
||||
Assert.IsTrue(result.Success);
|
||||
VerifyIsPublished(Textpage.Key);
|
||||
|
||||
@@ -580,7 +594,7 @@ public partial class ContentPublishingServiceTests
|
||||
ContentType.PropertyTypes.First(pt => pt.Alias == "author").ValidationRegExp = "^\\d*$";
|
||||
await ContentTypeService.SaveAsync(ContentType, Constants.Security.SuperUserKey);
|
||||
|
||||
result = await ContentPublishingService.PublishAsync(Textpage.Key, MakeModel(_allCultures), Constants.Security.SuperUserKey);
|
||||
result = await ContentPublishingService.PublishAsync(Textpage.Key, [new CulturePublishScheduleModel()], Constants.Security.SuperUserKey);
|
||||
Assert.IsFalse(result.Success);
|
||||
Assert.AreEqual(ContentPublishingOperationStatus.ContentInvalid, result.Status);
|
||||
|
||||
@@ -596,7 +610,7 @@ public partial class ContentPublishingServiceTests
|
||||
[Test]
|
||||
public async Task Cannot_Republish_Content_After_Adding_Mandatory_Property()
|
||||
{
|
||||
var result = await ContentPublishingService.PublishAsync(Textpage.Key, MakeModel(_allCultures), Constants.Security.SuperUserKey);
|
||||
var result = await ContentPublishingService.PublishAsync(Textpage.Key, [new CulturePublishScheduleModel()], Constants.Security.SuperUserKey);
|
||||
Assert.IsTrue(result.Success);
|
||||
VerifyIsPublished(Textpage.Key);
|
||||
|
||||
@@ -607,7 +621,7 @@ public partial class ContentPublishingServiceTests
|
||||
});
|
||||
await ContentTypeService.SaveAsync(ContentType, Constants.Security.SuperUserKey);
|
||||
|
||||
result = await ContentPublishingService.PublishAsync(Textpage.Key, MakeModel(_allCultures), Constants.Security.SuperUserKey);
|
||||
result = await ContentPublishingService.PublishAsync(Textpage.Key, [new CulturePublishScheduleModel()], Constants.Security.SuperUserKey);
|
||||
Assert.IsFalse(result.Success);
|
||||
Assert.AreEqual(ContentPublishingOperationStatus.ContentInvalid, result.Status);
|
||||
|
||||
@@ -684,7 +698,7 @@ public partial class ContentPublishingServiceTests
|
||||
content.SetValue("title", "DA title", culture: langDa.IsoCode);
|
||||
ContentService.Save(content);
|
||||
|
||||
var result = await ContentPublishingService.PublishAsync(content.Key, MakeModel(new HashSet<string>() { cultureCode }), Constants.Security.SuperUserKey);
|
||||
var result = await ContentPublishingService.PublishAsync(content.Key, [new CulturePublishScheduleModel { Culture = cultureCode }], Constants.Security.SuperUserKey);
|
||||
|
||||
Assert.IsFalse(result.Success);
|
||||
Assert.AreEqual(ContentPublishingOperationStatus.InvalidCulture, result.Status);
|
||||
@@ -705,7 +719,7 @@ public partial class ContentPublishingServiceTests
|
||||
content.SetValue("title", "DA title", culture: langDa.IsoCode);
|
||||
ContentService.Save(content);
|
||||
|
||||
var result = await ContentPublishingService.PublishAsync(content.Key, MakeModel(new HashSet<string>() { cultureCode }), Constants.Security.SuperUserKey);
|
||||
var result = await ContentPublishingService.PublishAsync(content.Key, [new CulturePublishScheduleModel { Culture = cultureCode }], Constants.Security.SuperUserKey);
|
||||
|
||||
Assert.IsFalse(result.Success);
|
||||
Assert.AreEqual(ContentPublishingOperationStatus.InvalidCulture, result.Status);
|
||||
@@ -714,21 +728,30 @@ public partial class ContentPublishingServiceTests
|
||||
[Test]
|
||||
public async Task Can_Publish_Invariant_Content_With_Cultures_Provided_If_The_Default_Culture_Is_Exclusively_Provided()
|
||||
{
|
||||
var result = await ContentPublishingService.PublishAsync(Textpage.Key, MakeModel(new HashSet<string>() { "en-US" }), Constants.Security.SuperUserKey);
|
||||
var result = await ContentPublishingService.PublishAsync(Textpage.Key, [new CulturePublishScheduleModel { Culture = "en-US" }], Constants.Security.SuperUserKey);
|
||||
Assert.IsTrue(result.Success);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task Can_Publish_Invariant_Content_With_Cultures_Provided_If_The_Default_Culture_Is_Provided_With_Other_Cultures()
|
||||
{
|
||||
var result = await ContentPublishingService.PublishAsync(Textpage.Key, MakeModel(new HashSet<string>() { "en-US", "da-DK" }), Constants.Security.SuperUserKey);
|
||||
var result = await ContentPublishingService.PublishAsync(
|
||||
Textpage.Key, [
|
||||
new CulturePublishScheduleModel { Culture = "en-US" },
|
||||
new CulturePublishScheduleModel { Culture = "da-DK" }],
|
||||
Constants.Security.SuperUserKey);
|
||||
|
||||
Assert.IsTrue(result.Success);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task Cannot_Publish_Invariant_Content_With_Cultures_Provided_That_Do_Not_Include_The_Default_Culture()
|
||||
{
|
||||
var result = await ContentPublishingService.PublishAsync(Textpage.Key, MakeModel(new HashSet<string>() { "da-DK" }), Constants.Security.SuperUserKey);
|
||||
var result = await ContentPublishingService.PublishAsync(
|
||||
Textpage.Key,
|
||||
[new CulturePublishScheduleModel { Culture = "da-DK" }],
|
||||
Constants.Security.SuperUserKey);
|
||||
|
||||
Assert.IsFalse(result.Success);
|
||||
Assert.AreEqual(ContentPublishingOperationStatus.InvalidCulture, result.Status);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Cms.Core;
|
||||
using Umbraco.Cms.Core.Models;
|
||||
using Umbraco.Cms.Core.Models.ContentPublishing;
|
||||
using Umbraco.Cms.Core.Services.OperationStatus;
|
||||
|
||||
namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Services;
|
||||
@@ -14,7 +14,7 @@ public partial class ContentPublishingServiceTests
|
||||
|
||||
var result = await ContentPublishingService.PublishAsync(
|
||||
Textpage.Key,
|
||||
MakeModel(ContentScheduleCollection.CreateWithEntry("*", DateTime.UtcNow.AddDays(1), null)),
|
||||
_allCultures.Select(culture => new CulturePublishScheduleModel { Culture = culture, Schedule = new ContentScheduleModel { PublishDate = DateTimeOffset.Now.AddDays(1) } }).ToArray(),
|
||||
Constants.Security.SuperUserKey);
|
||||
|
||||
Assert.IsTrue(result.Success);
|
||||
@@ -25,7 +25,10 @@ public partial class ContentPublishingServiceTests
|
||||
[Test]
|
||||
public async Task Publish_Single_Item_Does_Not_Publish_Children_In_The_Future()
|
||||
{
|
||||
await ContentPublishingService.PublishAsync(Textpage.Key, MakeModel(ContentScheduleCollection.CreateWithEntry("*", DateTime.UtcNow.AddDays(1), null)), Constants.Security.SuperUserKey);
|
||||
await ContentPublishingService.PublishAsync(
|
||||
Textpage.Key,
|
||||
_allCultures.Select(culture => new CulturePublishScheduleModel { Culture = culture, Schedule = new ContentScheduleModel { PublishDate = DateTimeOffset.Now.AddDays(1) } }).ToArray(),
|
||||
Constants.Security.SuperUserKey);
|
||||
|
||||
VerifyIsNotPublished(Textpage.Key);
|
||||
VerifyIsNotPublished(Subpage.Key);
|
||||
@@ -34,9 +37,15 @@ public partial class ContentPublishingServiceTests
|
||||
[Test]
|
||||
public async Task Can_Publish_Child_Of_Root_In_The_Future()
|
||||
{
|
||||
await ContentPublishingService.PublishAsync(Textpage.Key, MakeModel(_allCultures), Constants.Security.SuperUserKey);
|
||||
await ContentPublishingService.PublishAsync(
|
||||
Textpage.Key,
|
||||
_allCultures.Select(culture => new CulturePublishScheduleModel { Culture = culture }).ToArray(),
|
||||
Constants.Security.SuperUserKey);
|
||||
|
||||
var result = await ContentPublishingService.PublishAsync(Subpage.Key, MakeModel(ContentScheduleCollection.CreateWithEntry("*", DateTime.UtcNow.AddDays(1), null)), Constants.Security.SuperUserKey);
|
||||
var result = await ContentPublishingService.PublishAsync(
|
||||
Subpage.Key,
|
||||
_allCultures.Select(culture => new CulturePublishScheduleModel { Culture = culture, Schedule = new ContentScheduleModel { PublishDate = DateTimeOffset.Now.AddDays(1) } }).ToArray(),
|
||||
Constants.Security.SuperUserKey);
|
||||
|
||||
Assert.IsTrue(result.Success);
|
||||
Assert.AreEqual(ContentPublishingOperationStatus.Success, result.Status);
|
||||
|
||||
@@ -3,6 +3,7 @@ using NUnit.Framework;
|
||||
using Umbraco.Cms.Core;
|
||||
using Umbraco.Cms.Core.Configuration.Models;
|
||||
using Umbraco.Cms.Core.Models;
|
||||
using Umbraco.Cms.Core.Models.ContentPublishing;
|
||||
using Umbraco.Cms.Core.Services;
|
||||
using Umbraco.Cms.Core.Services.OperationStatus;
|
||||
using Umbraco.Cms.Tests.Common.Builders;
|
||||
@@ -20,7 +21,7 @@ public partial class ContentPublishingServiceTests
|
||||
[Test]
|
||||
public async Task Can_Unpublish_Root()
|
||||
{
|
||||
await ContentPublishingService.PublishAsync(Textpage.Key, MakeModel(_allCultures), Constants.Security.SuperUserKey);
|
||||
await ContentPublishingService.PublishAsync(Textpage.Key, _allCultures.Select(culture => new CulturePublishScheduleModel { Culture = culture }).ToArray(), Constants.Security.SuperUserKey);
|
||||
VerifyIsPublished(Textpage.Key);
|
||||
|
||||
var result = await ContentPublishingService.UnpublishAsync(Textpage.Key, null, Constants.Security.SuperUserKey);
|
||||
@@ -33,8 +34,8 @@ public partial class ContentPublishingServiceTests
|
||||
[Test]
|
||||
public async Task Can_Unpublish_Child()
|
||||
{
|
||||
await ContentPublishingService.PublishAsync(Textpage.Key, MakeModel(_allCultures), Constants.Security.SuperUserKey);
|
||||
await ContentPublishingService.PublishAsync(Subpage.Key, MakeModel(_allCultures), Constants.Security.SuperUserKey);
|
||||
await ContentPublishingService.PublishAsync(Textpage.Key, _allCultures.Select(culture => new CulturePublishScheduleModel { Culture = culture }).ToArray(), Constants.Security.SuperUserKey);
|
||||
await ContentPublishingService.PublishAsync(Subpage.Key, _allCultures.Select(culture => new CulturePublishScheduleModel { Culture = culture }).ToArray(), Constants.Security.SuperUserKey);
|
||||
VerifyIsPublished(Textpage.Key);
|
||||
VerifyIsPublished(Subpage.Key);
|
||||
|
||||
@@ -49,10 +50,10 @@ public partial class ContentPublishingServiceTests
|
||||
[Test]
|
||||
public async Task Can_Unpublish_Structure()
|
||||
{
|
||||
await ContentPublishingService.PublishAsync(Textpage.Key, MakeModel(_allCultures), Constants.Security.SuperUserKey);
|
||||
await ContentPublishingService.PublishAsync(Subpage.Key, MakeModel(_allCultures), Constants.Security.SuperUserKey);
|
||||
await ContentPublishingService.PublishAsync(Subpage2.Key, MakeModel(_allCultures), Constants.Security.SuperUserKey);
|
||||
await ContentPublishingService.PublishAsync(Subpage3.Key, MakeModel(_allCultures), Constants.Security.SuperUserKey);
|
||||
await ContentPublishingService.PublishAsync(Textpage.Key, _allCultures.Select(culture => new CulturePublishScheduleModel { Culture = culture }).ToArray(), Constants.Security.SuperUserKey);
|
||||
await ContentPublishingService.PublishAsync(Subpage.Key, _allCultures.Select(culture => new CulturePublishScheduleModel { Culture = culture }).ToArray(), Constants.Security.SuperUserKey);
|
||||
await ContentPublishingService.PublishAsync(Subpage2.Key, _allCultures.Select(culture => new CulturePublishScheduleModel { Culture = culture }).ToArray(), Constants.Security.SuperUserKey);
|
||||
await ContentPublishingService.PublishAsync(Subpage3.Key, _allCultures.Select(culture => new CulturePublishScheduleModel { Culture = culture }).ToArray(), Constants.Security.SuperUserKey);
|
||||
VerifyIsPublished(Textpage.Key);
|
||||
VerifyIsPublished(Subpage.Key);
|
||||
VerifyIsPublished(Subpage2.Key);
|
||||
@@ -88,7 +89,7 @@ public partial class ContentPublishingServiceTests
|
||||
[Test]
|
||||
public async Task Can_Cancel_Unpublishing_With_Notification()
|
||||
{
|
||||
await ContentPublishingService.PublishAsync(Textpage.Key, MakeModel(_allCultures), Constants.Security.SuperUserKey);
|
||||
await ContentPublishingService.PublishAsync(Textpage.Key, _allCultures.Select(culture => new CulturePublishScheduleModel { Culture = culture }).ToArray(), Constants.Security.SuperUserKey);
|
||||
VerifyIsPublished(Textpage.Key);
|
||||
|
||||
ContentNotificationHandler.UnpublishingContent = notification => notification.Cancel = true;
|
||||
@@ -104,7 +105,7 @@ public partial class ContentPublishingServiceTests
|
||||
[ConfigureBuilder(ActionName = nameof(ConfigureDisableUnpublishWhenReferencedTrue))]
|
||||
public async Task Cannot_Unpublish_When_Content_Is_Related_As_A_Child_And_Configured_To_Disable_When_Related()
|
||||
{
|
||||
await ContentPublishingService.PublishAsync(Textpage.Key, MakeModel(_allCultures), Constants.Security.SuperUserKey);
|
||||
await ContentPublishingService.PublishAsync(Textpage.Key, _allCultures.Select(culture => new CulturePublishScheduleModel { Culture = culture }).ToArray(), Constants.Security.SuperUserKey);
|
||||
VerifyIsPublished(Textpage.Key);
|
||||
|
||||
// Setup a relation where the page being unpublished is related to another page as a child (e.g. the other page has a picker and has selected this page).
|
||||
@@ -121,7 +122,7 @@ public partial class ContentPublishingServiceTests
|
||||
[ConfigureBuilder(ActionName = nameof(ConfigureDisableUnpublishWhenReferencedTrue))]
|
||||
public async Task Can_Unpublish_When_Content_Is_Related_As_A_Parent_And_Configured_To_Disable_When_Related()
|
||||
{
|
||||
await ContentPublishingService.PublishAsync(Textpage.Key, MakeModel(_allCultures), Constants.Security.SuperUserKey);
|
||||
await ContentPublishingService.PublishAsync(Textpage.Key, _allCultures.Select(culture => new CulturePublishScheduleModel { Culture = culture }).ToArray(), Constants.Security.SuperUserKey);
|
||||
VerifyIsPublished(Textpage.Key);
|
||||
|
||||
// Setup a relation where the page being unpublished is related to another page as a parent (e.g. this page has a picker and has selected the other page).
|
||||
@@ -147,7 +148,9 @@ public partial class ContentPublishingServiceTests
|
||||
content.SetValue("title", "EN title", culture: langEn.IsoCode);
|
||||
content.SetValue("title", "DA title", culture: langDa.IsoCode);
|
||||
ContentService.Save(content);
|
||||
await ContentPublishingService.PublishAsync(content.Key, MakeModel(new HashSet<string>() { langEn.IsoCode, langDa.IsoCode }), Constants.Security.SuperUserKey);
|
||||
await ContentPublishingService.PublishAsync(content.Key, [
|
||||
new CulturePublishScheduleModel { Culture = langEn.IsoCode },
|
||||
new CulturePublishScheduleModel { Culture = langDa.IsoCode }], Constants.Security.SuperUserKey);
|
||||
VerifyIsPublished(content.Key);
|
||||
|
||||
var result = await ContentPublishingService.UnpublishAsync(content.Key, new HashSet<string> { langEn.IsoCode }, Constants.Security.SuperUserKey);
|
||||
@@ -173,7 +176,9 @@ public partial class ContentPublishingServiceTests
|
||||
content.SetValue("title", "EN title", culture: langEn.IsoCode);
|
||||
content.SetValue("title", "DA title", culture: langDa.IsoCode);
|
||||
ContentService.Save(content);
|
||||
await ContentPublishingService.PublishAsync(content.Key, MakeModel(new HashSet<string>() { langEn.IsoCode, langDa.IsoCode }), Constants.Security.SuperUserKey);
|
||||
await ContentPublishingService.PublishAsync(content.Key, [
|
||||
new CulturePublishScheduleModel { Culture = langEn.IsoCode },
|
||||
new CulturePublishScheduleModel { Culture = langDa.IsoCode }], Constants.Security.SuperUserKey);
|
||||
VerifyIsPublished(content.Key);
|
||||
|
||||
var result = await ContentPublishingService.UnpublishAsync(content.Key, new HashSet<string>(){"*"}, Constants.Security.SuperUserKey);
|
||||
@@ -198,7 +203,9 @@ public partial class ContentPublishingServiceTests
|
||||
content.SetValue("title", "EN title", culture: langEn.IsoCode);
|
||||
content.SetValue("title", "DA title", culture: langDa.IsoCode);
|
||||
ContentService.Save(content);
|
||||
await ContentPublishingService.PublishAsync(content.Key, MakeModel(new HashSet<string>() { langEn.IsoCode, langDa.IsoCode }), Constants.Security.SuperUserKey);
|
||||
await ContentPublishingService.PublishAsync(content.Key, [
|
||||
new CulturePublishScheduleModel { Culture = langEn.IsoCode },
|
||||
new CulturePublishScheduleModel { Culture = langDa.IsoCode }], Constants.Security.SuperUserKey);
|
||||
VerifyIsPublished(content.Key);
|
||||
|
||||
var result = await ContentPublishingService.UnpublishAsync(content.Key, new HashSet<string>() { langEn.IsoCode, langDa.IsoCode }, Constants.Security.SuperUserKey);
|
||||
@@ -230,7 +237,15 @@ public partial class ContentPublishingServiceTests
|
||||
content.SetValue("title", "DA title", culture: langDa.IsoCode);
|
||||
content.SetValue("title", "SE title", culture: langSe.IsoCode);
|
||||
ContentService.Save(content);
|
||||
await ContentPublishingService.PublishAsync(content.Key, MakeModel(new HashSet<string>() { langEn.IsoCode, langDa.IsoCode, langSe.IsoCode }), Constants.Security.SuperUserKey);
|
||||
await ContentPublishingService.PublishAsync(
|
||||
content.Key,
|
||||
[
|
||||
new CulturePublishScheduleModel { Culture = langEn.IsoCode },
|
||||
new CulturePublishScheduleModel { Culture = langDa.IsoCode },
|
||||
new CulturePublishScheduleModel { Culture = langSe.IsoCode }
|
||||
],
|
||||
Constants.Security.SuperUserKey);
|
||||
|
||||
VerifyIsPublished(content.Key);
|
||||
content = ContentService.GetById(content.Key)!;
|
||||
Assert.AreEqual(3, content.PublishedCultures.Count());
|
||||
@@ -256,7 +271,14 @@ public partial class ContentPublishingServiceTests
|
||||
content.SetValue("title", "EN title", culture: langEn.IsoCode);
|
||||
content.SetValue("title", "DA title", culture: langDa.IsoCode);
|
||||
ContentService.Save(content);
|
||||
await ContentPublishingService.PublishAsync(content.Key, MakeModel(new HashSet<string>() { langEn.IsoCode, langDa.IsoCode }), Constants.Security.SuperUserKey);
|
||||
await ContentPublishingService.PublishAsync(
|
||||
content.Key,
|
||||
[
|
||||
new CulturePublishScheduleModel { Culture = langEn.IsoCode },
|
||||
new CulturePublishScheduleModel { Culture = langDa.IsoCode }
|
||||
],
|
||||
Constants.Security.SuperUserKey);
|
||||
|
||||
VerifyIsPublished(content.Key);
|
||||
|
||||
content = ContentService.GetById(content.Key)!;
|
||||
@@ -284,7 +306,9 @@ public partial class ContentPublishingServiceTests
|
||||
content.SetValue("title", "EN title", culture: langEn.IsoCode);
|
||||
content.SetValue("title", "DA title", culture: langDa.IsoCode);
|
||||
ContentService.Save(content);
|
||||
await ContentPublishingService.PublishAsync(content.Key, MakeModel(new HashSet<string>() { langEn.IsoCode, langDa.IsoCode }), Constants.Security.SuperUserKey);
|
||||
await ContentPublishingService.PublishAsync(content.Key, [
|
||||
new CulturePublishScheduleModel { Culture = langEn.IsoCode },
|
||||
new CulturePublishScheduleModel { Culture = langDa.IsoCode }], Constants.Security.SuperUserKey);
|
||||
VerifyIsPublished(content.Key);
|
||||
|
||||
content = ContentService.GetById(content.Key)!;
|
||||
@@ -326,7 +350,9 @@ public partial class ContentPublishingServiceTests
|
||||
content.SetValue("title", "EN title", culture: langEn.IsoCode);
|
||||
content.SetValue("title", "DA title", culture: langDa.IsoCode);
|
||||
ContentService.Save(content);
|
||||
await ContentPublishingService.PublishAsync(content.Key, MakeModel(new HashSet<string>() { langEn.IsoCode, langDa.IsoCode }), Constants.Security.SuperUserKey);
|
||||
await ContentPublishingService.PublishAsync(content.Key, [
|
||||
new CulturePublishScheduleModel { Culture = langEn.IsoCode },
|
||||
new CulturePublishScheduleModel { Culture = langDa.IsoCode }], Constants.Security.SuperUserKey);
|
||||
VerifyIsPublished(content.Key);
|
||||
|
||||
var result = await ContentPublishingService.UnpublishAsync(content.Key, new HashSet<string>() { cultureCode }, Constants.Security.SuperUserKey);
|
||||
@@ -352,7 +378,11 @@ public partial class ContentPublishingServiceTests
|
||||
content.SetValue("title", "EN title", culture: langEn.IsoCode);
|
||||
content.SetValue("title", "DA title", culture: langDa.IsoCode);
|
||||
ContentService.Save(content);
|
||||
await ContentPublishingService.PublishAsync(content.Key, MakeModel(new HashSet<string>() { langEn.IsoCode, langDa.IsoCode }), Constants.Security.SuperUserKey);
|
||||
await ContentPublishingService.PublishAsync(content.Key, [
|
||||
new CulturePublishScheduleModel { Culture = langEn.IsoCode },
|
||||
new CulturePublishScheduleModel { Culture = langDa.IsoCode }
|
||||
], Constants.Security.SuperUserKey);
|
||||
|
||||
VerifyIsPublished(content.Key);
|
||||
|
||||
var result = await ContentPublishingService.UnpublishAsync(content.Key, new HashSet<string>() { cultureCode }, Constants.Security.SuperUserKey);
|
||||
|
||||
@@ -48,7 +48,7 @@ internal sealed class DocumentHybridCacheAncestryTests : UmbracoIntegrationTestW
|
||||
// Text Page
|
||||
// Sub Page <-- Unpublished
|
||||
// Sub Sub Page
|
||||
await ContentPublishingService.PublishBranchAsync(Textpage.Key, Array.Empty<string>(), true, Constants.Security.SuperUserKey);
|
||||
await ContentPublishingService.PublishBranchAsync(Textpage.Key, Array.Empty<string>(), PublishBranchFilter.All, Constants.Security.SuperUserKey, false);
|
||||
await ContentPublishingService.UnpublishAsync(Subpage.Key, null, Constants.Security.SuperUserKey);
|
||||
|
||||
var published = await PublishedContentCache.GetByIdAsync(SubSubPage.Key);
|
||||
@@ -58,7 +58,7 @@ internal sealed class DocumentHybridCacheAncestryTests : UmbracoIntegrationTestW
|
||||
[Test]
|
||||
public async Task CanGetPublishedContentIfParentIsPublished()
|
||||
{
|
||||
await ContentPublishingService.PublishBranchAsync(Textpage.Key, Array.Empty<string>(), true, Constants.Security.SuperUserKey);
|
||||
await ContentPublishingService.PublishBranchAsync(Textpage.Key, Array.Empty<string>(), PublishBranchFilter.All, Constants.Security.SuperUserKey, false);
|
||||
|
||||
var published = await PublishedContentCache.GetByIdAsync(SubSubPage.Key);
|
||||
CacheTestsHelper.AssertPage(SubSubPage, published);
|
||||
@@ -70,7 +70,7 @@ internal sealed class DocumentHybridCacheAncestryTests : UmbracoIntegrationTestW
|
||||
// Text Page
|
||||
// Sub Page <-- Unpublished
|
||||
// Sub Sub Page
|
||||
await ContentPublishingService.PublishBranchAsync(Textpage.Key, Array.Empty<string>(), true, Constants.Security.SuperUserKey);
|
||||
await ContentPublishingService.PublishBranchAsync(Textpage.Key, Array.Empty<string>(), PublishBranchFilter.Default, Constants.Security.SuperUserKey, false);
|
||||
await ContentPublishingService.UnpublishAsync(Subpage.Key, null, Constants.Security.SuperUserKey);
|
||||
|
||||
// Clear cache also seeds, but we have to reset the seed keys first since these are cached from test startup
|
||||
|
||||
@@ -57,7 +57,7 @@ internal sealed class DocumentHybridCacheAncestryVariantTests : UmbracoIntegrati
|
||||
public async Task AllCulturesUnpublished(bool preview)
|
||||
{
|
||||
// Publish branch in all cultures
|
||||
var publishAttempt = await ContentPublishingService.PublishBranchAsync(rootContent.Key, [_englishIsoCode, _danishIsoCode], true, Constants.Security.SuperUserKey);
|
||||
var publishAttempt = await ContentPublishingService.PublishBranchAsync(rootContent.Key, [_englishIsoCode, _danishIsoCode], PublishBranchFilter.IncludeUnpublished, Constants.Security.SuperUserKey, false);
|
||||
Assert.IsTrue(publishAttempt.Success);
|
||||
Assert.That(publishAttempt.Result.SucceededItems.Count(), Is.EqualTo(3));
|
||||
|
||||
@@ -80,7 +80,7 @@ internal sealed class DocumentHybridCacheAncestryVariantTests : UmbracoIntegrati
|
||||
[Test]
|
||||
public async Task SingleCultureUnpublished()
|
||||
{
|
||||
var publishAttempt = await ContentPublishingService.PublishBranchAsync(rootContent.Key, [_englishIsoCode, _danishIsoCode], true, Constants.Security.SuperUserKey);
|
||||
var publishAttempt = await ContentPublishingService.PublishBranchAsync(rootContent.Key, [_englishIsoCode, _danishIsoCode], PublishBranchFilter.All, Constants.Security.SuperUserKey, false);
|
||||
Assert.IsTrue(publishAttempt.Success);
|
||||
Assert.That(publishAttempt.Result.SucceededItems.Count(), Is.EqualTo(3));
|
||||
|
||||
|
||||
@@ -89,11 +89,7 @@ internal sealed class DocumentHybridCachePropertyTest : UmbracoIntegrationTest
|
||||
|
||||
var publishResult = await ContentPublishingService.PublishAsync(
|
||||
updateResult.Result.Content!.Key,
|
||||
new CultureAndScheduleModel()
|
||||
{
|
||||
CulturesToPublishImmediately = new HashSet<string> { "*" },
|
||||
Schedules = new ContentScheduleCollection(),
|
||||
},
|
||||
[new CulturePublishScheduleModel { Culture = "*" }],
|
||||
Constants.Security.SuperUserKey);
|
||||
|
||||
Assert.IsTrue(publishResult);
|
||||
@@ -123,11 +119,7 @@ internal sealed class DocumentHybridCachePropertyTest : UmbracoIntegrationTest
|
||||
|
||||
var publishResult = await ContentPublishingService.PublishAsync(
|
||||
result.Result.Content!.Key,
|
||||
new CultureAndScheduleModel()
|
||||
{
|
||||
CulturesToPublishImmediately = new HashSet<string> { "*" },
|
||||
Schedules = new ContentScheduleCollection(),
|
||||
},
|
||||
[new CulturePublishScheduleModel { Culture = "*" }],
|
||||
Constants.Security.SuperUserKey);
|
||||
|
||||
Assert.IsTrue(publishResult.Success);
|
||||
@@ -148,11 +140,7 @@ internal sealed class DocumentHybridCachePropertyTest : UmbracoIntegrationTest
|
||||
|
||||
var publishResult = await ContentPublishingService.PublishAsync(
|
||||
createResult.Result.Content!.Key,
|
||||
new CultureAndScheduleModel()
|
||||
{
|
||||
CulturesToPublishImmediately = new HashSet<string> { "*" },
|
||||
Schedules = new ContentScheduleCollection(),
|
||||
},
|
||||
[new CulturePublishScheduleModel { Culture = "*" }],
|
||||
Constants.Security.SuperUserKey);
|
||||
|
||||
Assert.IsTrue(publishResult.Success);
|
||||
|
||||
@@ -34,7 +34,10 @@ internal sealed class DocumentHybridCacheScopeTests : UmbracoIntegrationTestWith
|
||||
{
|
||||
using (CoreScopeProvider.CreateCoreScope())
|
||||
{
|
||||
await ContentPublishingService.PublishAsync(Textpage.Key.Value, CultureAndSchedule, Constants.Security.SuperUserKey);
|
||||
await ContentPublishingService.PublishAsync(
|
||||
Textpage.Key.Value,
|
||||
[new CulturePublishScheduleModel { Culture = "*" }],
|
||||
Constants.Security.SuperUserKey);
|
||||
}
|
||||
|
||||
// Act
|
||||
@@ -49,7 +52,9 @@ internal sealed class DocumentHybridCacheScopeTests : UmbracoIntegrationTestWith
|
||||
{
|
||||
using (CoreScopeProvider.CreateCoreScope())
|
||||
{
|
||||
await ContentPublishingService.PublishAsync(Textpage.Key.Value, CultureAndSchedule, Constants.Security.SuperUserKey);
|
||||
await ContentPublishingService.PublishAsync(Textpage.Key.Value,
|
||||
[new CulturePublishScheduleModel { Culture = "*" }],
|
||||
Constants.Security.SuperUserKey);
|
||||
}
|
||||
|
||||
// Act
|
||||
@@ -64,7 +69,10 @@ internal sealed class DocumentHybridCacheScopeTests : UmbracoIntegrationTestWith
|
||||
{
|
||||
using (var scope = CoreScopeProvider.CreateCoreScope())
|
||||
{
|
||||
await ContentPublishingService.PublishAsync(Textpage.Key.Value, CultureAndSchedule, Constants.Security.SuperUserKey);
|
||||
await ContentPublishingService.PublishAsync(
|
||||
Textpage.Key.Value,
|
||||
[new CulturePublishScheduleModel { Culture = "*" }],
|
||||
Constants.Security.SuperUserKey);
|
||||
scope.Complete();
|
||||
}
|
||||
|
||||
@@ -80,7 +88,10 @@ internal sealed class DocumentHybridCacheScopeTests : UmbracoIntegrationTestWith
|
||||
{
|
||||
using (var scope = CoreScopeProvider.CreateCoreScope())
|
||||
{
|
||||
await ContentPublishingService.PublishAsync(Textpage.Key.Value, CultureAndSchedule, Constants.Security.SuperUserKey);
|
||||
await ContentPublishingService.PublishAsync(
|
||||
Textpage.Key.Value,
|
||||
[new CulturePublishScheduleModel { Culture = "*" }],
|
||||
Constants.Security.SuperUserKey);
|
||||
scope.Complete();
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ using NUnit.Framework;
|
||||
using Umbraco.Cms.Core;
|
||||
using Umbraco.Cms.Core.Cache;
|
||||
using Umbraco.Cms.Core.Models.ContentEditing;
|
||||
using Umbraco.Cms.Core.Models.ContentPublishing;
|
||||
using Umbraco.Cms.Core.Models.PublishedContent;
|
||||
using Umbraco.Cms.Core.Notifications;
|
||||
using Umbraco.Cms.Core.PublishedCache;
|
||||
@@ -323,7 +324,10 @@ internal sealed class DocumentHybridCacheTests : UmbracoIntegrationTestWithConte
|
||||
TemplateKey = PublishedTextPage.TemplateKey,
|
||||
};
|
||||
await ContentEditingService.UpdateAsync(PublishedTextPage.Key.Value, updateModel, Constants.Security.SuperUserKey);
|
||||
await ContentPublishingService.PublishAsync(PublishedTextPage.Key.Value, CultureAndSchedule, Constants.Security.SuperUserKey);
|
||||
await ContentPublishingService.PublishAsync(
|
||||
PublishedTextPage.Key.Value,
|
||||
[new CulturePublishScheduleModel { Culture = "*" }],
|
||||
Constants.Security.SuperUserKey);
|
||||
|
||||
// Act
|
||||
var textPage = await PublishedContentHybridCache.GetByIdAsync(PublishedTextPage.Key.Value, true);
|
||||
@@ -344,7 +348,10 @@ internal sealed class DocumentHybridCacheTests : UmbracoIntegrationTestWithConte
|
||||
TemplateKey = PublishedTextPage.TemplateKey,
|
||||
};
|
||||
await ContentEditingService.UpdateAsync(PublishedTextPage.Key.Value, updateModel, Constants.Security.SuperUserKey);
|
||||
await ContentPublishingService.PublishAsync(PublishedTextPage.Key.Value, CultureAndSchedule, Constants.Security.SuperUserKey);
|
||||
await ContentPublishingService.PublishAsync(
|
||||
PublishedTextPage.Key.Value,
|
||||
[new CulturePublishScheduleModel { Culture = "*" }],
|
||||
Constants.Security.SuperUserKey);
|
||||
|
||||
// Act
|
||||
var textPage = await PublishedContentHybridCache.GetByIdAsync(PublishedTextPage.Key.Value);
|
||||
|
||||
Reference in New Issue
Block a user