2024-02-21 08:10:48 +00:00
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
|
using Umbraco.Cms.Core;
|
2025-08-28 12:09:59 +02:00
|
|
|
|
using Umbraco.Cms.Core.Models.ContentPublishing;
|
2024-02-21 08:10:48 +00:00
|
|
|
|
using Umbraco.Cms.Core.Services.OperationStatus;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Services;
|
|
|
|
|
|
|
|
|
|
|
|
public partial class ContentPublishingServiceTests
|
|
|
|
|
|
{
|
|
|
|
|
|
[Test]
|
|
|
|
|
|
public async Task Can_Publish_Root_In_The_Future()
|
|
|
|
|
|
{
|
|
|
|
|
|
VerifyIsNotPublished(Textpage.Key);
|
|
|
|
|
|
|
|
|
|
|
|
var result = await ContentPublishingService.PublishAsync(
|
|
|
|
|
|
Textpage.Key,
|
2025-08-28 12:09:59 +02:00
|
|
|
|
_allCultures.Select(culture => new CulturePublishScheduleModel { Culture = culture, Schedule = new ContentScheduleModel { PublishDate = DateTimeOffset.Now.AddDays(1) } }).ToArray(),
|
2024-02-21 08:10:48 +00:00
|
|
|
|
Constants.Security.SuperUserKey);
|
|
|
|
|
|
|
|
|
|
|
|
Assert.IsTrue(result.Success);
|
|
|
|
|
|
Assert.AreEqual(ContentPublishingOperationStatus.Success, result.Status);
|
|
|
|
|
|
VerifyIsNotPublished(Textpage.Key);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
|
public async Task Publish_Single_Item_Does_Not_Publish_Children_In_The_Future()
|
|
|
|
|
|
{
|
2025-08-28 12:09:59 +02:00
|
|
|
|
await ContentPublishingService.PublishAsync(
|
|
|
|
|
|
Textpage.Key,
|
|
|
|
|
|
_allCultures.Select(culture => new CulturePublishScheduleModel { Culture = culture, Schedule = new ContentScheduleModel { PublishDate = DateTimeOffset.Now.AddDays(1) } }).ToArray(),
|
|
|
|
|
|
Constants.Security.SuperUserKey);
|
2024-02-21 08:10:48 +00:00
|
|
|
|
|
|
|
|
|
|
VerifyIsNotPublished(Textpage.Key);
|
|
|
|
|
|
VerifyIsNotPublished(Subpage.Key);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
|
public async Task Can_Publish_Child_Of_Root_In_The_Future()
|
|
|
|
|
|
{
|
2025-08-28 12:09:59 +02:00
|
|
|
|
await ContentPublishingService.PublishAsync(
|
|
|
|
|
|
Textpage.Key,
|
|
|
|
|
|
_allCultures.Select(culture => new CulturePublishScheduleModel { Culture = culture }).ToArray(),
|
|
|
|
|
|
Constants.Security.SuperUserKey);
|
2024-02-21 08:10:48 +00:00
|
|
|
|
|
2025-08-28 12:09:59 +02:00
|
|
|
|
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);
|
2024-02-21 08:10:48 +00:00
|
|
|
|
|
|
|
|
|
|
Assert.IsTrue(result.Success);
|
|
|
|
|
|
Assert.AreEqual(ContentPublishingOperationStatus.Success, result.Status);
|
|
|
|
|
|
VerifyIsPublished(Textpage.Key);
|
|
|
|
|
|
VerifyIsNotPublished(Subpage.Key);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|