Skip to content

Commit

Permalink
Update development with fixes from v9.4.0-rc (#2941)
Browse files Browse the repository at this point in the history
* Fix error running unit tests (#2940)

When running tests, the following error occurs:
	VSTest: Could not locate executable.

cake-build/cake#1522 (comment)
indicates that there's an issue using VS 2019, and presents a workaround
to find the correct path

* DNN-31366 - Deleted page can still be selected as parent page (#2925)

* DNN-31366 - TabController HasChildren returns false if all children are deleted

* Simplify HasChildren condition
  • Loading branch information
valadas authored and mitchelsellers committed Aug 15, 2019
1 parent 10d80ce commit 94b73c2
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 14 deletions.
32 changes: 21 additions & 11 deletions Build/Cake/unit-tests.cake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Task("EnsureAllProjectsBuilt")
.IsDependentOn("UpdateDnnManifests")
.IsDependentOn("Restore-NuGet-Packages")
.Does(() =>
.Does(() =>
{
MSBuild("DNN_Platform.sln", new MSBuildSettings {
Verbosity = Verbosity.Minimal,
Expand All @@ -13,21 +13,31 @@ Task("EnsureAllProjectsBuilt")

Task("UnitTests")
.IsDependentOn("EnsureAllProjectsBuilt")
.Does(() =>
.Does(() =>
{
var testAssemblies = GetFiles($@"**\bin\{configuration}\DotNetNuke.Tests.*.dll");
testAssemblies -= GetFiles(@"**\DotNetNuke.Tests.Data.dll");
testAssemblies -= GetFiles(@"**\DotNetNuke.Tests.Integration.dll");
testAssemblies -= GetFiles(@"**\DotNetNuke.Tests.Utilities.dll");
testAssemblies -= GetFiles(@"**\DotNetNuke.Tests.Urls.dll");
foreach(var file in testAssemblies) {
VSTest(file.FullPath, new VSTestSettings() {
Logger = $"trx;LogFileName={file.GetFilename()}.xml",
Parallel = true,
EnableCodeCoverage = true,
FrameworkVersion = VSTestFrameworkVersion.NET45,
TestAdapterPath = @"tools\NUnitTestAdapter.2.1.1\tools"
});

foreach (var file in testAssemblies) {
VSTest(file.FullPath, FixToolPath(new VSTestSettings() {
Logger = $"trx;LogFileName={file.GetFilename()}.xml",
Parallel = true,
EnableCodeCoverage = true,
FrameworkVersion = VSTestFrameworkVersion.NET45,
TestAdapterPath = @"tools\NUnitTestAdapter.2.1.1\tools"
}));
}
});

// https://github.com/cake-build/cake/issues/1522
VSTestSettings FixToolPath(VSTestSettings settings)
{
#tool vswhere
settings.ToolPath =
VSWhereLatest(new VSWhereLatestSettings { Requires = "Microsoft.VisualStudio.PackageGroup.TestTools.Core" })
.CombineWithFilePath(File(@"Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe"));
return settings;
}
51 changes: 48 additions & 3 deletions DNN Platform/Library/Entities/Tabs/TabController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2473,7 +2473,8 @@ public static List<TabInfo> GetPortalTabs(int portalId, int excludeTabId, bool i
false,
false,
false,
false);
false,
true);
}

/// <summary>
Expand All @@ -2497,7 +2498,8 @@ public static List<TabInfo> GetPortalTabs(int portalId, int excludeTabId, bool i
includeDeleted,
includeURL,
false,
false);
false,
true);
}

/// <summary>
Expand Down Expand Up @@ -2525,7 +2527,8 @@ public static List<TabInfo> GetPortalTabs(int portalId, int excludeTabId, bool i
includeDeleted,
includeURL,
checkViewPermisison,
checkEditPermission);
checkEditPermission,
true);
}

/// <summary>
Expand All @@ -2544,6 +2547,45 @@ public static List<TabInfo> GetPortalTabs(int portalId, int excludeTabId, bool i
public static List<TabInfo> GetPortalTabs(List<TabInfo> tabs, int excludeTabId, bool includeNoneSpecified,
string noneSpecifiedText, bool includeHidden, bool includeDeleted, bool includeURL,
bool checkViewPermisison, bool checkEditPermission)
{
return GetPortalTabs(
tabs,
excludeTabId,
includeNoneSpecified,
noneSpecifiedText,
includeHidden,
includeDeleted,
includeURL,
checkViewPermisison,
checkEditPermission,
true);
}

/// <summary>
/// Gets the portal tabs.
/// </summary>
/// <param name="tabs">The tabs.</param>
/// <param name="excludeTabId">The exclude tab id.</param>
/// <param name="includeNoneSpecified">if set to <c>true</c> [include none specified].</param>
/// <param name="noneSpecifiedText">The none specified text.</param>
/// <param name="includeHidden">if set to <c>true</c> [include hidden].</param>
/// <param name="includeDeleted">if set to <c>true</c> [include deleted].</param>
/// <param name="includeURL">if set to <c>true</c> [include URL].</param>
/// <param name="checkViewPermisison">if set to <c>true</c> [check view permisison].</param>
/// <param name="checkEditPermission">if set to <c>true</c> [check edit permission].</param>
/// <param name="includeDeletedChildren">The value of this parameter affects <see cref="TabInfo.HasChildren"></see> property.</param>
/// <returns></returns>
public static List<TabInfo> GetPortalTabs(
List<TabInfo> tabs,
int excludeTabId,
bool includeNoneSpecified,
string noneSpecifiedText,
bool includeHidden,
bool includeDeleted,
bool includeURL,
bool checkViewPermisison,
bool checkEditPermission,
bool includeDeletedChildren)
{
var listTabs = new List<TabInfo>();
if (includeNoneSpecified)
Expand Down Expand Up @@ -2580,6 +2622,9 @@ public static List<TabInfo> GetPortalTabs(List<TabInfo> tabs, int excludeTabId,
listTabs.Add(tab);
}
}

// HasChildren should be true in case there is at least one not deleted child
tab.HasChildren = tab.HasChildren && (includeDeletedChildren || GetTabsByParent(tab.TabID, tab.PortalID).Any(a => !a.IsDeleted));
}
}
return listTabs;
Expand Down

0 comments on commit 94b73c2

Please sign in to comment.