Updates test, fixes some other issues during testing

This commit is contained in:
Shannon
2019-01-15 23:46:58 +11:00
parent 56ab88983a
commit f6fdc9ae2d
5 changed files with 16 additions and 5 deletions

View File

@@ -9,6 +9,8 @@ namespace Umbraco.Core.Models.Packaging
{
public IEnumerable<string> UnsecureFiles { get; set; } = Enumerable.Empty<string>();
public IEnumerable<string> FilesReplaced { get; set; } = Enumerable.Empty<string>();
//TODO: Shouldn't we detect other conflicting entities too ?
public IEnumerable<IMacro> ConflictingMacros { get; set; } = Enumerable.Empty<IMacro>();
public IEnumerable<ITemplate> ConflictingTemplates { get; set; } = Enumerable.Empty<ITemplate>();
public IEnumerable<IFile> ConflictingStylesheets { get; set; } = Enumerable.Empty<IFile>();

View File

@@ -23,7 +23,7 @@ namespace Umbraco.Core.Packaging
return stylesheetNodes
.Select(n =>
{
var xElement = n.Element("Name");
var xElement = n.Element("Name") ?? n.Element("name"); ;
if (xElement == null)
throw new FormatException("Missing \"Name\" element");

View File

@@ -6,11 +6,13 @@ using Moq;
using NUnit.Framework;
using Umbraco.Core.Composing;
using Umbraco.Core.IO;
using Umbraco.Core.Models;
using Umbraco.Core.Models.Packaging;
using Umbraco.Core.Packaging;
using Umbraco.Core.PropertyEditors;
using Umbraco.Tests.TestHelpers;
using Umbraco.Tests.Testing;
using File = System.IO.File;
namespace Umbraco.Tests.Packaging
{
@@ -79,7 +81,11 @@ namespace Umbraco.Tests.Packaging
[Test]
public void Can_Read_Compiled_Package_Warnings()
{
//copy a file to the same path that the package will install so we can detect file conflicts
var path = IOHelper.MapPath("~/" + _testBaseFolder);
var filePath = Path.Combine(path, "bin", "Auros.DocumentTypePicker.dll");
Directory.CreateDirectory(Path.GetDirectoryName(filePath));
File.WriteAllText(filePath, "test");
var preInstallWarnings = PackageInstallation.ReadPackage(
//this is where our test zip file is
@@ -87,7 +93,10 @@ namespace Umbraco.Tests.Packaging
.Warnings;
Assert.IsNotNull(preInstallWarnings);
//TODO: Assert!
Assert.AreEqual(preInstallWarnings.FilesReplaced.Count(), 1);
Assert.AreEqual(preInstallWarnings.FilesReplaced.First(), "bin\\Auros.DocumentTypePicker.dll");
//TODO: More Asserts
}
[Test]

View File

@@ -25,7 +25,7 @@
var labelKeys = [
"packager_installStateUninstalling",
"packager_installStateComplete",
"packager_installStateComplete"
];
localizationService.localizeMany(labelKeys).then(function (values) {

View File

@@ -446,7 +446,7 @@ namespace Umbraco.Web.Search
while (page * pageSize < total)
{
//paging with examine, see https://shazwazza.com/post/paging-with-examine/
var results = searcher.CreateQuery().Field("nodeType", id).Execute(maxResults: pageSize * (page + 1));
var results = searcher.CreateQuery().Field("nodeType", id.ToInvariantString()).Execute(maxResults: pageSize * (page + 1));
total = results.TotalItemCount;
var paged = results.Skip(page * pageSize);