Integration tests for content publishing with ancestor unpublished (#18941)

* Resolved warnings in test class.

* Refactor regions into partial classes.

* Aligned test names.

* Variable name refactoring.

* Added tests for unpublished paths.

* Adjust tests to verify current behaviour.

* Cleaned up project file.
This commit is contained in:
Andy Butland
2025-04-07 10:04:11 +02:00
committed by GitHub
parent ae423decc3
commit 3d1e17b07f
10 changed files with 1517 additions and 1370 deletions

View File

@@ -1,8 +1,6 @@
// Copyright (c) Umbraco.
// See LICENSE for more details.
using System;
using System.Collections.Generic;
using Umbraco.Cms.Core.Models;
using Umbraco.Cms.Core.Strings;
using Umbraco.Cms.Tests.Common.Builders.Extensions;
@@ -29,7 +27,8 @@ public abstract class ContentTypeBaseBuilder<TParent, TType>
IWithIconBuilder,
IWithThumbnailBuilder,
IWithTrashedBuilder,
IWithIsContainerBuilder
IWithIsContainerBuilder,
IWithAllowAsRootBuilder
where TParent : IBuildContentTypes
{
private string _alias;
@@ -49,6 +48,7 @@ public abstract class ContentTypeBaseBuilder<TParent, TType>
private string _thumbnail;
private bool? _trashed;
private DateTime? _updateDate;
private bool? _allowedAtRoot;
public ContentTypeBaseBuilder(TParent parentBuilder)
: base(parentBuilder)
@@ -168,6 +168,12 @@ public abstract class ContentTypeBaseBuilder<TParent, TType>
set => _updateDate = value;
}
bool? IWithAllowAsRootBuilder.AllowAsRoot
{
get => _allowedAtRoot;
set => _allowedAtRoot = value;
}
protected int GetId() => _id ?? 0;
protected Guid GetKey() => _key ?? Guid.NewGuid();
@@ -202,6 +208,8 @@ public abstract class ContentTypeBaseBuilder<TParent, TType>
protected Guid? GetListView() => _listView;
protected bool GetAllowedAtRoot() => _allowedAtRoot ?? false;
protected void BuildPropertyGroups(ContentTypeCompositionBase contentType, IEnumerable<PropertyGroup> propertyGroups)
{
foreach (var propertyGroup in propertyGroups)

View File

@@ -1,8 +1,6 @@
// Copyright (c) Umbraco.
// See LICENSE for more details.
using System.Collections.Generic;
using System.Linq;
using Umbraco.Cms.Core;
using Umbraco.Cms.Core.Models;
using Umbraco.Cms.Core.Models.ContentEditing;
@@ -125,6 +123,7 @@ public class ContentTypeBuilder
contentType.Trashed = GetTrashed();
contentType.ListView = GetListView();
contentType.IsElement = _isElement ?? false;
contentType.AllowedAsRoot = GetAllowedAtRoot();
contentType.HistoryCleanup = new HistoryCleanup();
contentType.Variations = contentVariation;