* Added configuration and checks for creation of default Umbraco data. * Fixed configuration binding issues. * Updated comments. * Added DefaultDataCreationSettings to the JSON schema. * Removed option to not install default relation types as Umbraco relies on (and will recreate) them if they aren't there. * Renamed configuration class used for install of default data and converted to named optios. * Fix to failing unit tests. * Fixes for integration tests. * Apply suggestions from code review Co-authored-by: Elitsa Marinovska <21998037+elit0451@users.noreply.github.com> * Further fix from code review. * Updated naming as per PR review suggestions. * Update src/Umbraco.Infrastructure/Migrations/Install/DatabaseDataCreator.cs Co-authored-by: Elitsa Marinovska <21998037+elit0451@users.noreply.github.com> Co-authored-by: Elitsa Marinovska <21998037+elit0451@users.noreply.github.com>
37 lines
1.5 KiB
C#
37 lines
1.5 KiB
C#
using Microsoft.Extensions.Logging;
|
|
using Microsoft.Extensions.Options;
|
|
using Moq;
|
|
using NUnit.Framework;
|
|
using Umbraco.Cms.Core.Configuration;
|
|
using Umbraco.Cms.Core.Configuration.Models;
|
|
using Umbraco.Cms.Core.Events;
|
|
using Umbraco.Cms.Infrastructure.Migrations.Install;
|
|
using Umbraco.Cms.Tests.Common.Testing;
|
|
using Umbraco.Cms.Tests.Integration.Testing;
|
|
|
|
namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Persistence
|
|
{
|
|
[TestFixture]
|
|
[UmbracoTest(Database = UmbracoTestOptions.Database.NewSchemaPerFixture)]
|
|
public class SchemaValidationTest : UmbracoIntegrationTest
|
|
{
|
|
private IUmbracoVersion UmbracoVersion => GetRequiredService<IUmbracoVersion>();
|
|
private IEventAggregator EventAggregator => GetRequiredService<IEventAggregator>();
|
|
|
|
[Test]
|
|
public void DatabaseSchemaCreation_Produces_DatabaseSchemaResult_With_Zero_Errors()
|
|
{
|
|
DatabaseSchemaResult result;
|
|
|
|
using (var scope = ScopeProvider.CreateScope())
|
|
{
|
|
var schema = new DatabaseSchemaCreator(scope.Database, LoggerFactory.CreateLogger<DatabaseSchemaCreator>(), LoggerFactory, UmbracoVersion, EventAggregator, Mock.Of<IOptionsMonitor<InstallDefaultDataSettings>>(x => x.CurrentValue == new InstallDefaultDataSettings()));
|
|
result = schema.ValidateSchema(DatabaseSchemaCreator.OrderedTables);
|
|
}
|
|
|
|
// Assert
|
|
Assert.That(result.Errors.Count, Is.EqualTo(0));
|
|
}
|
|
}
|
|
}
|