diff --git a/src/Umbraco.Core/Services/ContentVersionService.cs b/src/Umbraco.Core/Services/ContentVersionService.cs index f0c92db28f..6f1c28deb8 100644 --- a/src/Umbraco.Core/Services/ContentVersionService.cs +++ b/src/Umbraco.Core/Services/ContentVersionService.cs @@ -66,7 +66,7 @@ internal class ContentVersionService : IContentVersionService } /// - public void SetPreventCleanup(int versionId, bool preventCleanup, int userId = -1) + public void SetPreventCleanup(int versionId, bool preventCleanup, int userId = Constants.Security.SuperUserId) { using (ICoreScope scope = _scopeProvider.CreateCoreScope(autoComplete: true)) { diff --git a/src/Umbraco.Core/Services/MediaServiceExtensions.cs b/src/Umbraco.Core/Services/MediaServiceExtensions.cs index 8d45367e61..e7d01f122e 100644 --- a/src/Umbraco.Core/Services/MediaServiceExtensions.cs +++ b/src/Umbraco.Core/Services/MediaServiceExtensions.cs @@ -1,4 +1,4 @@ -// Copyright (c) Umbraco. +// Copyright (c) Umbraco. // See LICENSE for more details. using Umbraco.Cms.Core; @@ -34,7 +34,7 @@ public static class MediaServiceExtensions return mediaService.GetByIds(guids.Select(x => x.Guid)); } - public static IMedia CreateMedia(this IMediaService mediaService, string name, Udi parentId, string mediaTypeAlias, int userId = 0) + public static IMedia CreateMedia(this IMediaService mediaService, string name, Udi parentId, string mediaTypeAlias, int userId = Constants.Security.SuperUserId) { if (parentId is not GuidUdi guidUdi) { diff --git a/tests/Umbraco.Tests.Integration/Testing/UmbracoIntegrationTestWithContent.cs b/tests/Umbraco.Tests.Integration/Testing/UmbracoIntegrationTestWithContent.cs index 274f93125c..37673b1c2e 100644 --- a/tests/Umbraco.Tests.Integration/Testing/UmbracoIntegrationTestWithContent.cs +++ b/tests/Umbraco.Tests.Integration/Testing/UmbracoIntegrationTestWithContent.cs @@ -46,24 +46,24 @@ public abstract class UmbracoIntegrationTestWithContent : UmbracoIntegrationTest // Create and Save Content "Homepage" based on "umbTextpage" -> 1053 Textpage = ContentBuilder.CreateSimpleContent(ContentType); Textpage.Key = new Guid("B58B3AD4-62C2-4E27-B1BE-837BD7C533E0"); - ContentService.Save(Textpage, 0); + ContentService.Save(Textpage, -1); // Create and Save Content "Text Page 1" based on "umbTextpage" -> 1054 Subpage = ContentBuilder.CreateSimpleContent(ContentType, "Text Page 1", Textpage.Id); var contentSchedule = ContentScheduleCollection.CreateWithEntry(DateTime.Now.AddMinutes(-5), null); - ContentService.Save(Subpage, 0, contentSchedule); + ContentService.Save(Subpage, -1, contentSchedule); // Create and Save Content "Text Page 1" based on "umbTextpage" -> 1055 Subpage2 = ContentBuilder.CreateSimpleContent(ContentType, "Text Page 2", Textpage.Id); - ContentService.Save(Subpage2, 0); + ContentService.Save(Subpage2, -1); Subpage3 = ContentBuilder.CreateSimpleContent(ContentType, "Text Page 3", Textpage.Id); - ContentService.Save(Subpage3, 0); + ContentService.Save(Subpage3, -1); // Create and Save Content "Text Page Deleted" based on "umbTextpage" -> 1056 Trashed = ContentBuilder.CreateSimpleContent(ContentType, "Text Page Deleted", -20); Trashed.Trashed = true; - ContentService.Save(Trashed, 0); + ContentService.Save(Trashed, -1); } } diff --git a/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Packaging/PackageDataInstallationTests.cs b/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Packaging/PackageDataInstallationTests.cs index 765eea85c6..7eb0d07da9 100644 --- a/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Packaging/PackageDataInstallationTests.cs +++ b/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Packaging/PackageDataInstallationTests.cs @@ -90,9 +90,9 @@ public class PackageDataInstallationTests : UmbracoIntegrationTestWithContent var docTypeElement = xml.Descendants("DocumentTypes").First(); // Act - var dataTypes = PackageDataInstallation.ImportDataTypes(dataTypeElement.Elements("DataType").ToList(), 0); - var templates = PackageDataInstallation.ImportTemplates(templateElement.Elements("Template").ToList(), 0); - var contentTypes = PackageDataInstallation.ImportDocumentTypes(docTypeElement.Elements("DocumentType"), 0); + var dataTypes = PackageDataInstallation.ImportDataTypes(dataTypeElement.Elements("DataType").ToList(), -1); + var templates = PackageDataInstallation.ImportTemplates(templateElement.Elements("Template").ToList(), -1); + var contentTypes = PackageDataInstallation.ImportDocumentTypes(docTypeElement.Elements("DocumentType"), -1); var numberOfTemplates = (from doc in templateElement.Elements("Template") select doc).Count(); var numberOfDocTypes = (from doc in docTypeElement.Elements("DocumentType") select doc).Count(); @@ -137,9 +137,9 @@ public class PackageDataInstallationTests : UmbracoIntegrationTestWithContent var docTypeElement = xml.Descendants("DocumentTypes").First(); // Act - var dataTypes = PackageDataInstallation.ImportDataTypes(dataTypeElement.Elements("DataType").ToList(), 0); - var templates = PackageDataInstallation.ImportTemplates(templateElement.Elements("Template").ToList(), 0); - var contentTypes = PackageDataInstallation.ImportDocumentTypes(docTypeElement.Elements("DocumentType"), 0); + var dataTypes = PackageDataInstallation.ImportDataTypes(dataTypeElement.Elements("DataType").ToList(), -1); + var templates = PackageDataInstallation.ImportTemplates(templateElement.Elements("Template").ToList(), -1); + var contentTypes = PackageDataInstallation.ImportDocumentTypes(docTypeElement.Elements("DocumentType"), -1); // Assert var mRBasePage = contentTypes.First(x => x.Alias == "MRBasePage"); @@ -163,9 +163,9 @@ public class PackageDataInstallationTests : UmbracoIntegrationTestWithContent var docTypeElement = xml.Descendants("DocumentTypes").First(); // Act - var dataTypes = PackageDataInstallation.ImportDataTypes(dataTypeElement.Elements("DataType").ToList(), 0); - var templates = PackageDataInstallation.ImportTemplates(templateElement.Elements("Template").ToList(), 0); - var contentTypes = PackageDataInstallation.ImportDocumentTypes(docTypeElement.Elements("DocumentType"), 0); + var dataTypes = PackageDataInstallation.ImportDataTypes(dataTypeElement.Elements("DataType").ToList(), -1); + var templates = PackageDataInstallation.ImportTemplates(templateElement.Elements("Template").ToList(), -1); + var contentTypes = PackageDataInstallation.ImportDocumentTypes(docTypeElement.Elements("DocumentType"), -1); var numberOfDocTypes = (from doc in docTypeElement.Elements("DocumentType") select doc).Count(); @@ -202,7 +202,7 @@ public class PackageDataInstallationTests : UmbracoIntegrationTestWithContent var init = FileService.GetTemplates().Count(); // Act - var templates = PackageDataInstallation.ImportTemplates(element.Elements("Template").ToList(), 0); + var templates = PackageDataInstallation.ImportTemplates(element.Elements("Template").ToList(), -1); var numberOfTemplates = (from doc in element.Elements("Template") select doc).Count(); var allTemplates = FileService.GetTemplates(); @@ -224,7 +224,7 @@ public class PackageDataInstallationTests : UmbracoIntegrationTestWithContent var element = xml.Descendants("Templates").First(); // Act - var templates = PackageDataInstallation.ImportTemplate(element.Elements("Template").First(), 0); + var templates = PackageDataInstallation.ImportTemplate(element.Elements("Template").First(), -1); // Assert Assert.That(templates, Is.Not.Null); @@ -248,7 +248,7 @@ public class PackageDataInstallationTests : UmbracoIntegrationTestWithContent firstTemplateElement.Add(new XElement("Key", key)); // Act - var templates = PackageDataInstallation.ImportTemplate(firstTemplateElement, 0); + var templates = PackageDataInstallation.ImportTemplate(firstTemplateElement, -1); // Assert Assert.That(templates, Is.Not.Null); @@ -272,9 +272,9 @@ public class PackageDataInstallationTests : UmbracoIntegrationTestWithContent // Act var dataTypeDefinitions = - PackageDataInstallation.ImportDataTypes(dataTypeElement.Elements("DataType").ToList(), 0); - var templates = PackageDataInstallation.ImportTemplates(templateElement.Elements("Template").ToList(), 0); - var contentTypes = PackageDataInstallation.ImportDocumentTypes(docTypeElement.Elements("DocumentType"), 0); + PackageDataInstallation.ImportDataTypes(dataTypeElement.Elements("DataType").ToList(), -1); + var templates = PackageDataInstallation.ImportTemplates(templateElement.Elements("Template").ToList(), -1); + var contentTypes = PackageDataInstallation.ImportDocumentTypes(docTypeElement.Elements("DocumentType"), -1); var numberOfDocTypes = (from doc in docTypeElement.Elements("DocumentType") select doc).Count(); // Assert @@ -310,14 +310,14 @@ public class PackageDataInstallationTests : UmbracoIntegrationTestWithContent // Act var dataTypeDefinitions = - PackageDataInstallation.ImportDataTypes(dataTypeElement.Elements("DataType").ToList(), 0); - var templates = PackageDataInstallation.ImportTemplates(templateElement.Elements("Template").ToList(), 0); - var contentTypes = PackageDataInstallation.ImportDocumentTypes(docTypeElement.Elements("DocumentType"), 0); + PackageDataInstallation.ImportDataTypes(dataTypeElement.Elements("DataType").ToList(), -1); + var templates = PackageDataInstallation.ImportTemplates(templateElement.Elements("Template").ToList(), -1); + var contentTypes = PackageDataInstallation.ImportDocumentTypes(docTypeElement.Elements("DocumentType"), -1); var numberOfDocTypes = (from doc in docTypeElement.Elements("DocumentType") select doc).Count(); // Assert - Re-Import contenttypes doesn't throw Assert.DoesNotThrow(() => - PackageDataInstallation.ImportDocumentTypes(docTypeElement.Elements("DocumentType"), 0)); + PackageDataInstallation.ImportDocumentTypes(docTypeElement.Elements("DocumentType"), -1)); Assert.That(contentTypes.Count(), Is.EqualTo(numberOfDocTypes)); Assert.That(dataTypeDefinitions, Is.Not.Null); Assert.That(dataTypeDefinitions.Any(), Is.True); @@ -336,14 +336,14 @@ public class PackageDataInstallationTests : UmbracoIntegrationTestWithContent // Act var dataTypeDefinitions = - PackageDataInstallation.ImportDataTypes(dataTypeElement.Elements("DataType").ToList(), 0); - var templates = PackageDataInstallation.ImportTemplates(templateElement.Elements("Template").ToList(), 0); - var contentTypes = PackageDataInstallation.ImportDocumentTypes(docTypeElement.Elements("DocumentType"), 0); + PackageDataInstallation.ImportDataTypes(dataTypeElement.Elements("DataType").ToList(), -1); + var templates = PackageDataInstallation.ImportTemplates(templateElement.Elements("Template").ToList(), -1); + var contentTypes = PackageDataInstallation.ImportDocumentTypes(docTypeElement.Elements("DocumentType"), -1); var numberOfDocTypes = (from doc in docTypeElement.Elements("DocumentType") select doc).Count(); // Assert - Re-Import contenttypes doesn't throw Assert.DoesNotThrow(() => - PackageDataInstallation.ImportDocumentTypes(docTypeElement.Elements("DocumentType"), 0)); + PackageDataInstallation.ImportDocumentTypes(docTypeElement.Elements("DocumentType"), -1)); Assert.That(contentTypes.Count(), Is.EqualTo(numberOfDocTypes)); Assert.That(dataTypeDefinitions, Is.Not.Null); Assert.That(dataTypeDefinitions.Any(), Is.True); @@ -363,10 +363,10 @@ public class PackageDataInstallationTests : UmbracoIntegrationTestWithContent // Act var dataTypeDefinitions = - PackageDataInstallation.ImportDataTypes(dataTypeElement.Elements("DataType").ToList(), 0); - var contentTypes = PackageDataInstallation.ImportDocumentTypes(docTypesElement.Elements("DocumentType"), 0); + PackageDataInstallation.ImportDataTypes(dataTypeElement.Elements("DataType").ToList(), -1); + var contentTypes = PackageDataInstallation.ImportDocumentTypes(docTypesElement.Elements("DocumentType"), -1); var importedContentTypes = contentTypes.ToDictionary(x => x.Alias, x => x); - var contents = PackageDataInstallation.ImportContentBase(packageDocument.Yield(), importedContentTypes, 0, ContentTypeService, ContentService); + var contents = PackageDataInstallation.ImportContentBase(packageDocument.Yield(), importedContentTypes, -1, ContentTypeService, ContentService); var numberOfDocs = (from doc in element.Descendants() where (string)doc.Attribute("isDoc") == string.Empty select doc).Count(); @@ -390,9 +390,9 @@ public class PackageDataInstallationTests : UmbracoIntegrationTestWithContent var packageMedia = CompiledPackageContentBase.Create(element); // Act - var mediaTypes = PackageDataInstallation.ImportMediaTypes(mediaTypesElement.Elements("MediaType"), 0); + var mediaTypes = PackageDataInstallation.ImportMediaTypes(mediaTypesElement.Elements("MediaType"), -1); var importedMediaTypes = mediaTypes.ToDictionary(x => x.Alias, x => x); - var medias = PackageDataInstallation.ImportContentBase(packageMedia.Yield(), importedMediaTypes, 0, MediaTypeService, MediaService); + var medias = PackageDataInstallation.ImportContentBase(packageMedia.Yield(), importedMediaTypes, -1, MediaTypeService, MediaService); var numberOfDocs = (from doc in element.Descendants() where (string)doc.Attribute("isDoc") == string.Empty select doc).Count(); @@ -419,10 +419,10 @@ public class PackageDataInstallationTests : UmbracoIntegrationTestWithContent // Act var dataTypeDefinitions = - PackageDataInstallation.ImportDataTypes(dataTypeElement.Elements("DataType").ToList(), 0); - var contentTypes = PackageDataInstallation.ImportDocumentTypes(docTypesElement.Elements("DocumentType"), 0); + PackageDataInstallation.ImportDataTypes(dataTypeElement.Elements("DataType").ToList(), -1); + var contentTypes = PackageDataInstallation.ImportDocumentTypes(docTypesElement.Elements("DocumentType"), -1); var importedContentTypes = contentTypes.ToDictionary(x => x.Alias, x => x); - var contents = PackageDataInstallation.ImportContentBase(packageDocument.Yield(), importedContentTypes, 0, ContentTypeService, ContentService); + var contents = PackageDataInstallation.ImportContentBase(packageDocument.Yield(), importedContentTypes, -1, ContentTypeService, ContentService); var numberOfDocs = (from doc in element.Descendants() where (string)doc.Attribute("isDoc") == string.Empty select doc).Count(); @@ -456,7 +456,7 @@ public class PackageDataInstallationTests : UmbracoIntegrationTestWithContent var templateElement = xml.Descendants("Templates").First(); // Act - var templates = PackageDataInstallation.ImportTemplates(templateElement.Elements("Template").ToList(), 0); + var templates = PackageDataInstallation.ImportTemplates(templateElement.Elements("Template").ToList(), -1); var numberOfTemplates = (from doc in templateElement.Elements("Template") select doc).Count(); // Assert @@ -472,7 +472,7 @@ public class PackageDataInstallationTests : UmbracoIntegrationTestWithContent var docTypeElement = XElement.Parse(strXml); // Act - var contentTypes = PackageDataInstallation.ImportDocumentType(docTypeElement, 0); + var contentTypes = PackageDataInstallation.ImportDocumentType(docTypeElement, -1); // Assert Assert.That(contentTypes.Any(), Is.True); @@ -490,7 +490,7 @@ public class PackageDataInstallationTests : UmbracoIntegrationTestWithContent var serializer = GetRequiredService(); // Act - var contentTypes = PackageDataInstallation.ImportDocumentType(docTypeElement, 0); + var contentTypes = PackageDataInstallation.ImportDocumentType(docTypeElement, -1); var contentType = contentTypes.FirstOrDefault(); var element = serializer.Serialize(contentType); @@ -513,8 +513,8 @@ public class PackageDataInstallationTests : UmbracoIntegrationTestWithContent var docTypeElement = XElement.Parse(strXml); // Act - var contentTypes = PackageDataInstallation.ImportDocumentType(docTypeElement, 0); - var contentTypesUpdated = PackageDataInstallation.ImportDocumentType(docTypeElement, 0); + var contentTypes = PackageDataInstallation.ImportDocumentType(docTypeElement, -1); + var contentTypesUpdated = PackageDataInstallation.ImportDocumentType(docTypeElement, -1); // Assert Assert.That(contentTypes.Any(), Is.True); @@ -544,9 +544,9 @@ public class PackageDataInstallationTests : UmbracoIntegrationTestWithContent // Act var numberOfTemplates = (from doc in templateElement.Elements("Template") select doc).Count(); - var templates = PackageDataInstallation.ImportTemplates(templateElement.Elements("Template").ToList(), 0); + var templates = PackageDataInstallation.ImportTemplates(templateElement.Elements("Template").ToList(), -1); var templatesAfterUpdate = - PackageDataInstallation.ImportTemplates(templateElementUpdated.Elements("Template").ToList(), 0); + PackageDataInstallation.ImportTemplates(templateElementUpdated.Elements("Template").ToList(), -1); var allTemplates = fileService.GetTemplates(); // Assert @@ -572,7 +572,7 @@ public class PackageDataInstallationTests : UmbracoIntegrationTestWithContent AddLanguages(); // Act - PackageDataInstallation.ImportDictionaryItems(dictionaryItemsElement.Elements("DictionaryItem"), 0); + PackageDataInstallation.ImportDictionaryItems(dictionaryItemsElement.Elements("DictionaryItem"), -1); // Assert AssertDictionaryItem("Parent", expectedEnglishParentValue, "en-GB"); @@ -595,7 +595,7 @@ public class PackageDataInstallationTests : UmbracoIntegrationTestWithContent // Act var dictionaryItems = - PackageDataInstallation.ImportDictionaryItems(dictionaryItemsElement.Elements("DictionaryItem"), 0); + PackageDataInstallation.ImportDictionaryItems(dictionaryItemsElement.Elements("DictionaryItem"), -1); // Assert Assert.That(LocalizationService.DictionaryItemExists(parentKey), "DictionaryItem parentKey does not exist"); @@ -624,7 +624,7 @@ public class PackageDataInstallationTests : UmbracoIntegrationTestWithContent AddExistingEnglishAndNorwegianParentDictionaryItem(expectedEnglishParentValue, expectedNorwegianParentValue); // Act - PackageDataInstallation.ImportDictionaryItems(dictionaryItemsElement.Elements("DictionaryItem"), 0); + PackageDataInstallation.ImportDictionaryItems(dictionaryItemsElement.Elements("DictionaryItem"), -1); // Assert AssertDictionaryItem("Parent", expectedEnglishParentValue, "en-GB"); @@ -649,7 +649,7 @@ public class PackageDataInstallationTests : UmbracoIntegrationTestWithContent AddExistingEnglishParentDictionaryItem(expectedEnglishParentValue); // Act - PackageDataInstallation.ImportDictionaryItems(dictionaryItemsElement.Elements("DictionaryItem"), 0); + PackageDataInstallation.ImportDictionaryItems(dictionaryItemsElement.Elements("DictionaryItem"), -1); // Assert AssertDictionaryItem("Parent", expectedEnglishParentValue, "en-GB"); @@ -666,7 +666,7 @@ public class PackageDataInstallationTests : UmbracoIntegrationTestWithContent var languageItemsElement = newPackageXml.Elements("Languages").First(); // Act - var languages = PackageDataInstallation.ImportLanguages(languageItemsElement.Elements("Language"), 0); + var languages = PackageDataInstallation.ImportLanguages(languageItemsElement.Elements("Language"), -1); var allLanguages = LocalizationService.GetAllLanguages(); // Assert @@ -688,7 +688,7 @@ public class PackageDataInstallationTests : UmbracoIntegrationTestWithContent // Act var macros = PackageDataInstallation.ImportMacros( macrosElement.Elements("macro"), - 0).ToList(); + -1).ToList(); // Assert Assert.That(macros.Any(), Is.True); @@ -711,7 +711,7 @@ public class PackageDataInstallationTests : UmbracoIntegrationTestWithContent // Act var macros = PackageDataInstallation.ImportMacros( macrosElement.Elements("macro"), - 0).ToList(); + -1).ToList(); // Assert Assert.That(macros.Any(), Is.True); @@ -734,8 +734,8 @@ public class PackageDataInstallationTests : UmbracoIntegrationTestWithContent var docTypeElement = xml.Descendants("DocumentTypes").First(); // Act - var templates = PackageDataInstallation.ImportTemplates(templateElement.Elements("Template").ToList(), 0); - var contentTypes = PackageDataInstallation.ImportDocumentTypes(docTypeElement.Elements("DocumentType"), 0); + var templates = PackageDataInstallation.ImportTemplates(templateElement.Elements("Template").ToList(), -1); + var contentTypes = PackageDataInstallation.ImportDocumentTypes(docTypeElement.Elements("DocumentType"), -1); var numberOfDocTypes = (from doc in docTypeElement.Elements("DocumentType") select doc).Count(); // Assert @@ -761,7 +761,7 @@ public class PackageDataInstallationTests : UmbracoIntegrationTestWithContent var docTypeElement = xml.Descendants("DocumentTypes").First(); // Act - var contentTypes = PackageDataInstallation.ImportDocumentTypes(docTypeElement.Elements("DocumentType"), 0); + var contentTypes = PackageDataInstallation.ImportDocumentTypes(docTypeElement.Elements("DocumentType"), -1); var numberOfDocTypes = (from doc in docTypeElement.Elements("DocumentType") select doc).Count(); // Assert @@ -784,7 +784,7 @@ public class PackageDataInstallationTests : UmbracoIntegrationTestWithContent // Act var contentTypes = PackageDataInstallation - .ImportDocumentType(withoutCleanupPolicy, 0) + .ImportDocumentType(withoutCleanupPolicy, -1) .OfType(); // Assert @@ -803,7 +803,7 @@ public class PackageDataInstallationTests : UmbracoIntegrationTestWithContent // Act var contentTypes = PackageDataInstallation - .ImportDocumentType(docTypeElement, 0) + .ImportDocumentType(docTypeElement, -1) .OfType(); // Assert @@ -825,11 +825,11 @@ public class PackageDataInstallationTests : UmbracoIntegrationTestWithContent // Act var contentTypes = PackageDataInstallation - .ImportDocumentType(withCleanupPolicy, 0) + .ImportDocumentType(withCleanupPolicy, -1) .OfType(); var contentTypesUpdated = PackageDataInstallation - .ImportDocumentType(withoutCleanupPolicy, 0) + .ImportDocumentType(withoutCleanupPolicy, -1) .OfType(); // Assert @@ -851,8 +851,8 @@ public class PackageDataInstallationTests : UmbracoIntegrationTestWithContent { var norwegian = new Language("nb-NO", "Norwegian Bokmål (Norway)"); var english = new Language("en-GB", "English (United Kingdom)"); - LocalizationService.Save(norwegian, 0); - LocalizationService.Save(english, 0); + LocalizationService.Save(norwegian, -1); + LocalizationService.Save(english, -1); } private void AssertDictionaryItem(string dictionaryItemName, string expectedValue, string cultureCode) diff --git a/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Persistence/Repositories/DocumentRepositoryTest.cs b/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Persistence/Repositories/DocumentRepositoryTest.cs index 51a1a92376..7ee763e863 100644 --- a/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Persistence/Repositories/DocumentRepositoryTest.cs +++ b/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Persistence/Repositories/DocumentRepositoryTest.cs @@ -76,21 +76,21 @@ public class DocumentRepositoryTest : UmbracoIntegrationTest // Create and Save Content "Homepage" based on "umbTextpage" -> (_textpage.Id) _textpage = ContentBuilder.CreateSimpleContent(_contentType); _textpage.Key = new Guid("B58B3AD4-62C2-4E27-B1BE-837BD7C533E0"); - ContentService.Save(_textpage, 0); + ContentService.Save(_textpage, -1); // Create and Save Content "Text Page 1" based on "umbTextpage" -> (_subpage.Id) _subpage = ContentBuilder.CreateSimpleContent(_contentType, "Text Page 1", _textpage.Id); _subpage.Key = new Guid("FF11402B-7E53-4654-81A7-462AC2108059"); - ContentService.Save(_subpage, 0); + ContentService.Save(_subpage, -1); // Create and Save Content "Text Page 1" based on "umbTextpage" -> (_subpage2.Id) _subpage2 = ContentBuilder.CreateSimpleContent(_contentType, "Text Page 2", _textpage.Id); - ContentService.Save(_subpage2, 0); + ContentService.Save(_subpage2, -1); // Create and Save Content "Text Page Deleted" based on "umbTextpage" -> (_trashed.Id) _trashed = ContentBuilder.CreateSimpleContent(_contentType, "Text Page Deleted", -20); _trashed.Trashed = true; - ContentService.Save(_trashed, 0); + ContentService.Save(_trashed, -1); } private DocumentRepository CreateRepository(IScopeAccessor scopeAccessor, out ContentTypeRepository contentTypeRepository, out DataTypeRepository dtdRepository, AppCaches appCaches = null) diff --git a/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Persistence/Repositories/MediaRepositoryTest.cs b/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Persistence/Repositories/MediaRepositoryTest.cs index ce60146635..595e881f28 100644 --- a/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Persistence/Repositories/MediaRepositoryTest.cs +++ b/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Persistence/Repositories/MediaRepositoryTest.cs @@ -585,16 +585,16 @@ public class MediaRepositoryTest : UmbracoIntegrationTest // Create and Save folder-Media -> (1051) var folderMediaType = MediaTypeService.Get(1031); _testFolder = MediaBuilder.CreateMediaFolder(folderMediaType, -1); - MediaService.Save(_testFolder, 0); + MediaService.Save(_testFolder, -1); // Create and Save image-Media -> (1052) var imageMediaType = MediaTypeService.Get(1032); _testImage = MediaBuilder.CreateMediaImage(imageMediaType, _testFolder.Id); - MediaService.Save(_testImage, 0); + MediaService.Save(_testImage, -1); // Create and Save file-Media -> (1053) var fileMediaType = MediaTypeService.Get(1033); _testFile = MediaBuilder.CreateMediaFile(fileMediaType, _testFolder.Id); - MediaService.Save(_testFile, 0); + MediaService.Save(_testFile, -1); } } diff --git a/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Persistence/Repositories/RelationRepositoryTest.cs b/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Persistence/Repositories/RelationRepositoryTest.cs index 402aa0b653..def5d3cafc 100644 --- a/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Persistence/Repositories/RelationRepositoryTest.cs +++ b/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Persistence/Repositories/RelationRepositoryTest.cs @@ -526,7 +526,7 @@ public class RelationRepositoryTest : UmbracoIntegrationTest var repository = CreateRepository(ScopeProvider, out var repositoryType); var content = ContentService.GetById(_subpage.Id); - ContentService.Delete(content, 0); + ContentService.Delete(content, -1); // Act var shouldntExist = repository.Exists(1); @@ -577,15 +577,15 @@ public class RelationRepositoryTest : UmbracoIntegrationTest // Create and Save Content "Homepage" based on "umbTextpage" -> (NodeDto.NodeIdSeed + 1) _textpage = ContentBuilder.CreateSimpleContent(_contentType); - ContentService.Save(_textpage, 0); + ContentService.Save(_textpage, -1); // Create and Save Content "Text Page 1" based on "umbTextpage" -> (NodeDto.NodeIdSeed + 2) _subpage = ContentBuilder.CreateSimpleContent(_contentType, "Text Page 1", _textpage.Id); - ContentService.Save(_subpage, 0); + ContentService.Save(_subpage, -1); // Create and Save Content "Text Page 1" based on "umbTextpage" -> (NodeDto.NodeIdSeed + 3) _subpage2 = ContentBuilder.CreateSimpleContent(_contentType, "Text Page 2", _textpage.Id); - ContentService.Save(_subpage2, 0); + ContentService.Save(_subpage2, -1); _relation = new Relation(_textpage.Id, _subpage.Id, _relateContent) { Comment = string.Empty }; _relation2 = new Relation(_textpage.Id, _subpage2.Id, _relateContent) { Comment = string.Empty }; diff --git a/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/ContentServicePerformanceTest.cs b/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/ContentServicePerformanceTest.cs index b2507bf4f5..54cb06ef04 100644 --- a/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/ContentServicePerformanceTest.cs +++ b/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/ContentServicePerformanceTest.cs @@ -120,7 +120,7 @@ public class ContentServicePerformanceTest : UmbracoIntegrationTest // Act var watch = Stopwatch.StartNew(); - ContentService.Save(pages, 0); + ContentService.Save(pages, -1); watch.Stop(); var elapsed = watch.ElapsedMilliseconds; @@ -139,7 +139,7 @@ public class ContentServicePerformanceTest : UmbracoIntegrationTest // Act var watch = Stopwatch.StartNew(); - ContentService.Save(pages, 0); + ContentService.Save(pages, -1); watch.Stop(); var elapsed = watch.ElapsedMilliseconds; @@ -155,7 +155,7 @@ public class ContentServicePerformanceTest : UmbracoIntegrationTest // Arrange var contentType = ContentTypeService.Get(ContentType.Id); var pages = ContentBuilder.CreateTextpageContent(contentType, -1, 100); - ContentService.Save(pages, 0); + ContentService.Save(pages, -1); var provider = ScopeProvider; using (var scope = provider.CreateScope()) @@ -182,7 +182,7 @@ public class ContentServicePerformanceTest : UmbracoIntegrationTest // Arrange var contentType = ContentTypeService.Get(ContentType.Id); var pages = ContentBuilder.CreateTextpageContent(contentType, -1, 1000); - ContentService.Save(pages, 0); + ContentService.Save(pages, -1); using (var scope = ScopeProvider.CreateScope()) { @@ -208,7 +208,7 @@ public class ContentServicePerformanceTest : UmbracoIntegrationTest // Arrange var contentType = ContentTypeService.Get(ContentType.Id); var pages = ContentBuilder.CreateTextpageContent(contentType, -1, 100); - ContentService.Save(pages, 0); + ContentService.Save(pages, -1); using (var scope = ScopeProvider.CreateScope()) { @@ -237,7 +237,7 @@ public class ContentServicePerformanceTest : UmbracoIntegrationTest // Arrange var contentType = ContentTypeService.Get(ContentType.Id); var pages = ContentBuilder.CreateTextpageContent(contentType, -1, 1000); - ContentService.Save(pages, 0); + ContentService.Save(pages, -1); using (var scope = ScopeProvider.CreateScope()) { diff --git a/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/ContentServiceTests.cs b/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/ContentServiceTests.cs index f399a00a3d..0f399f771d 100644 --- a/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/ContentServiceTests.cs +++ b/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/ContentServiceTests.cs @@ -360,7 +360,7 @@ public class ContentServiceTests : UmbracoIntegrationTestWithContent var results = new List(); for (var i = 0; i < 20; i++) { - results.Add(ContentService.CreateAndSave("Test", Constants.System.Root, "umbTextpage", 0)); + results.Add(ContentService.CreateAndSave("Test", Constants.System.Root, "umbTextpage", -1)); } var sortedGet = ContentService.GetByIds(new[] { results[10].Id, results[5].Id, results[12].Id }) @@ -706,10 +706,10 @@ public class ContentServiceTests : UmbracoIntegrationTestWithContent { // Arrange var content = ContentService.GetById(Textpage.Id); - var published = ContentService.SaveAndPublish(content, userId: 0); + var published = ContentService.SaveAndPublish(content, userId: -1); // Act - var unpublished = ContentService.Unpublish(content, userId: 0); + var unpublished = ContentService.Unpublish(content, userId: -1); // Assert Assert.That(published.Success, Is.True); @@ -1082,7 +1082,7 @@ public class ContentServiceTests : UmbracoIntegrationTestWithContent var content = ContentService.GetById(Textpage.Id); // Act - var published = ContentService.SaveAndPublish(content, userId: 0); + var published = ContentService.SaveAndPublish(content, userId: -1); // Assert Assert.That(published.Success, Is.True); @@ -1965,12 +1965,12 @@ public class ContentServiceTests : UmbracoIntegrationTestWithContent content1.PropertyValues(obj); content1.ResetDirtyProperties(false); ContentService.Save(content1); - Assert.IsTrue(ContentService.SaveAndPublish(content1, userId: 0).Success); + Assert.IsTrue(ContentService.SaveAndPublish(content1, userId: -1).Success); var content2 = ContentBuilder.CreateBasicContent(contentType); content2.PropertyValues(obj); content2.ResetDirtyProperties(false); ContentService.Save(content2); - Assert.IsTrue(ContentService.SaveAndPublish(content2, userId: 0).Success); + Assert.IsTrue(ContentService.SaveAndPublish(content2, userId: -1).Success); var editorGroup = UserService.GetUserGroupByAlias(Constants.Security.EditorGroupAlias); editorGroup.StartContentId = content1.Id; diff --git a/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/ContentTypeServiceTests.cs b/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/ContentTypeServiceTests.cs index bb24410e7b..056f65947e 100644 --- a/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/ContentTypeServiceTests.cs +++ b/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/ContentTypeServiceTests.cs @@ -262,7 +262,7 @@ public class ContentTypeServiceTests : UmbracoIntegrationTest // Arrange var contentTypeService = ContentTypeService; var hierarchy = CreateContentTypeHierarchy(); - contentTypeService.Save(hierarchy, 0); // ensure they are saved! + contentTypeService.Save(hierarchy, -1); // ensure they are saved! var master = hierarchy.First(); // Act @@ -278,7 +278,7 @@ public class ContentTypeServiceTests : UmbracoIntegrationTest // Arrange var contentTypeService = ContentTypeService; var hierarchy = CreateContentTypeHierarchy(); - contentTypeService.Save(hierarchy, 0); // ensure they are saved! + contentTypeService.Save(hierarchy, -1); // ensure they are saved! var master = hierarchy.First(); // Act @@ -296,7 +296,7 @@ public class ContentTypeServiceTests : UmbracoIntegrationTest var hierarchy = CreateContentTypeHierarchy(); // Act - contentTypeService.Save(hierarchy, 0); + contentTypeService.Save(hierarchy, -1); Assert.That(hierarchy.Any(), Is.True); Assert.That(hierarchy.Any(x => x.HasIdentity == false), Is.False); diff --git a/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/EntityServiceTests.cs b/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/EntityServiceTests.cs index f19f86a6fc..f1b47e81c4 100644 --- a/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/EntityServiceTests.cs +++ b/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/EntityServiceTests.cs @@ -898,45 +898,45 @@ public class EntityServiceTests : UmbracoIntegrationTest // Create and Save Content "Homepage" based on "umbTextpage" -> 1053 _textpage = ContentBuilder.CreateSimpleContent(_contentType); _textpage.Key = new Guid("B58B3AD4-62C2-4E27-B1BE-837BD7C533E0"); - ContentService.Save(_textpage, 0); + ContentService.Save(_textpage, -1); // Create and Save Content "Text Page 1" based on "umbTextpage" -> 1054 _subpage = ContentBuilder.CreateSimpleContent(_contentType, "Text Page 1", _textpage.Id); var contentSchedule = ContentScheduleCollection.CreateWithEntry(DateTime.Now.AddMinutes(-5), null); - ContentService.Save(_subpage, 0, contentSchedule); + ContentService.Save(_subpage, -1, contentSchedule); // Create and Save Content "Text Page 2" based on "umbTextpage" -> 1055 _subpage2 = ContentBuilder.CreateSimpleContent(_contentType, "Text Page 2", _textpage.Id); - ContentService.Save(_subpage2, 0); + ContentService.Save(_subpage2, -1); // Create and Save Content "Text Page Deleted" based on "umbTextpage" -> 1056 _trashed = ContentBuilder.CreateSimpleContent(_contentType, "Text Page Deleted", -20); _trashed.Trashed = true; - ContentService.Save(_trashed, 0); + ContentService.Save(_trashed, -1); // Create and Save folder-Media -> 1057 _folderMediaType = MediaTypeService.Get(1031); _folder = MediaBuilder.CreateMediaFolder(_folderMediaType, -1); - MediaService.Save(_folder, 0); + MediaService.Save(_folder, -1); _folderId = _folder.Id; // Create and Save image-Media -> 1058 _imageMediaType = MediaTypeService.Get(1032); _image = MediaBuilder.CreateMediaImage(_imageMediaType, _folder.Id); - MediaService.Save(_image, 0); + MediaService.Save(_image, -1); // Create and Save file-Media -> 1059 var fileMediaType = MediaTypeService.Get(1033); var file = MediaBuilder.CreateMediaFile(fileMediaType, _folder.Id); - MediaService.Save(file, 0); + MediaService.Save(file, -1); // Create and save sub folder -> 1060 _subfolder = MediaBuilder.CreateMediaFolder(_folderMediaType, _folder.Id); - MediaService.Save(_subfolder, 0); + MediaService.Save(_subfolder, -1); // Create and save sub folder -> 1061 _subfolder2 = MediaBuilder.CreateMediaFolder(_folderMediaType, _subfolder.Id); - MediaService.Save(_subfolder2, 0); + MediaService.Save(_subfolder2, -1); } } } diff --git a/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/LocalizationServiceTests.cs b/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/LocalizationServiceTests.cs index 4924ee51f7..14b24b434c 100644 --- a/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/LocalizationServiceTests.cs +++ b/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/LocalizationServiceTests.cs @@ -209,7 +209,7 @@ public class LocalizationServiceTests : UmbracoIntegrationTest var languageNbNo = new LanguageBuilder() .WithCultureInfo("nb-NO") .Build(); - LocalizationService.Save(languageNbNo, 0); + LocalizationService.Save(languageNbNo, -1); Assert.That(languageNbNo.HasIdentity, Is.True); var languageId = languageNbNo.Id; @@ -227,7 +227,7 @@ public class LocalizationServiceTests : UmbracoIntegrationTest .WithCultureInfo("nb-NO") .WithFallbackLanguageId(languageDaDk.Id) .Build(); - LocalizationService.Save(languageNbNo, 0); + LocalizationService.Save(languageNbNo, -1); var languageId = languageDaDk.Id; LocalizationService.Delete(languageDaDk); @@ -445,8 +445,8 @@ public class LocalizationServiceTests : UmbracoIntegrationTest .WithCultureInfo("en-GB") .Build(); - LocalizationService.Save(languageDaDk, 0); - LocalizationService.Save(languageEnGb, 0); + LocalizationService.Save(languageDaDk, -1); + LocalizationService.Save(languageEnGb, -1); _danishLangId = languageDaDk.Id; _englishLangId = languageEnGb.Id;