This commit is contained in:
Shannon Deminick
2013-02-21 22:38:38 +06:00
6 changed files with 38 additions and 14 deletions

View File

@@ -221,7 +221,7 @@ namespace Umbraco.Core.Configuration
/// <value>The fullpath to root.</value>
public static string FullpathToRoot
{
get { return HttpRuntime.AppDomainAppPath; }
get { return IOHelper.GetRootDirectorySafe(); }
}
/// <summary>

View File

@@ -1062,7 +1062,7 @@ namespace Umbraco.Core.Configuration
get
{
// default: true
return _useLegacySchema ?? GetKeyValue("/settings/content/UseLegacyXmlSchema", true);
return _useLegacySchema ?? GetKeyValue("/settings/content/UseLegacyXmlSchema", false);
}
internal set
{

View File

@@ -2,6 +2,7 @@ using System.Linq;
using System.Xml;
using NUnit.Framework;
using Umbraco.Core;
using Umbraco.Core.Configuration;
using Umbraco.Tests.TestHelpers;
using Umbraco.Web;
using Umbraco.Web.Routing;
@@ -65,7 +66,7 @@ namespace Umbraco.Tests.ContentStores
public void SetUp()
{
TestHelper.SetupLog4NetForTests();
Umbraco.Core.Configuration.UmbracoSettings.UseLegacyXmlSchema = false;
_httpContextFactory = new FakeHttpContextFactory("~/Home");
//ensure the StateHelper is using our custom context
StateHelper.HttpContext = _httpContextFactory.HttpContext;
@@ -105,9 +106,7 @@ namespace Umbraco.Tests.ContentStores
[TearDown]
public void TearDown()
{
//TODO: need to reset everything!
Umbraco.Core.Configuration.UmbracoSettings.UseLegacyXmlSchema = false;
UmbracoSettings.ResetSetters();
}
[Test]

View File

@@ -17,13 +17,11 @@ namespace Umbraco.Tests.PublishedContent
public override void Initialize()
{
base.Initialize();
UmbracoSettings.UseLegacyXmlSchema = false;
}
public override void TearDown()
{
base.TearDown();
UmbracoSettings.ResetSetters();
}
protected override bool RequiresDbSetup

View File

@@ -1,5 +1,6 @@
using System.Configuration;
using NUnit.Framework;
using Umbraco.Core.Configuration;
using Umbraco.Tests.TestHelpers;
using Umbraco.Web.Routing;
using umbraco.BusinessLogic;
@@ -10,6 +11,16 @@ namespace Umbraco.Tests.Routing
[TestFixture]
public class LookupByNiceUrlTests : BaseRoutingTest
{
public override void Initialize()
{
base.Initialize();
}
public override void TearDown()
{
base.TearDown();
}
/// <summary>
/// We don't need a db for this test, will run faster without one
/// </summary>
@@ -18,7 +29,7 @@ namespace Umbraco.Tests.Routing
get { return false; }
}
[Ignore]
[TestCase("/", 1046)]
[TestCase("/default.aspx", 1046)] //this one is actually rather important since this is the path that comes through when we are running in pre-IIS 7 for the root document '/' !
[TestCase("/Sub1", 1173)]
@@ -35,7 +46,7 @@ namespace Umbraco.Tests.Routing
var routingContext = GetRoutingContext(urlString);
var url = routingContext.UmbracoContext.CleanedUmbracoUrl; //very important to use the cleaned up umbraco url
var docreq = new PublishedContentRequest(url, routingContext);
var lookup = new LookupByNiceUrl();
var lookup = new LookupByNiceUrl(false);
SettingsForTests.HideTopLevelNodeFromPath = true;
var result = lookup.TrySetDocument(docreq);
@@ -51,7 +62,7 @@ namespace Umbraco.Tests.Routing
}
}
[Ignore]
[TestCase("/", 1046)]
[TestCase("/default.aspx", 1046)] //this one is actually rather important since this is the path that comes through when we are running in pre-IIS 7 for the root document '/' !
[TestCase("/home", 1046)]
@@ -63,7 +74,7 @@ namespace Umbraco.Tests.Routing
var routingContext = GetRoutingContext(urlString);
var url = routingContext.UmbracoContext.CleanedUmbracoUrl; //very important to use the cleaned up umbraco url
var docreq = new PublishedContentRequest(url, routingContext);
var lookup = new LookupByNiceUrl();
var lookup = new LookupByNiceUrl(false);
SettingsForTests.HideTopLevelNodeFromPath = false;
var result = lookup.TrySetDocument(docreq);

View File

@@ -16,7 +16,23 @@ namespace Umbraco.Web.Routing
//[ResolutionWeight(10)]
internal class LookupByNiceUrl : IPublishedContentLookup
{
/// <summary>
private readonly bool _doDomainLookup;
public LookupByNiceUrl()
{
_doDomainLookup = true;
}
/// <summary>
/// Constructor to specify whether we also want to lookup domains stored in the repository
/// </summary>
/// <param name="doDomainLookup"></param>
internal LookupByNiceUrl(bool doDomainLookup)
{
_doDomainLookup = doDomainLookup;
}
/// <summary>
/// Tries to find and assign an Umbraco document to a <c>PublishedContentRequest</c>.
/// </summary>
/// <param name="docRequest">The <c>PublishedContentRequest</c>.</param>
@@ -82,7 +98,7 @@ namespace Umbraco.Web.Routing
docreq.PublishedContent = node;
LogHelper.Debug<LookupByNiceUrl>("Query matches, id={0}", () => docreq.DocumentId);
var iscanon = !DomainHelper.ExistsDomainInPath(docreq.Domain, node.Path);
var iscanon = _doDomainLookup && !DomainHelper.ExistsDomainInPath(docreq.Domain, node.Path);
if (!iscanon)
LogHelper.Debug<LookupByNiceUrl>("Non canonical url");