Skip to content

Commit

Permalink
Merge branch 'issue/8684' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
BenedekFarkas committed Mar 7, 2024
2 parents 417af34 + fcf960f commit e333952
Show file tree
Hide file tree
Showing 218 changed files with 3,287 additions and 2,018 deletions.
20 changes: 17 additions & 3 deletions .github/workflows/compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,29 @@ name: Compile

on:
workflow_dispatch:
pull_request:
push:
branches:
- dev
- 1.10.x

jobs:
compile:
name: Compile
defaults:
run:
shell: cmd
shell: pwsh
runs-on: windows-latest

steps:
- name: Test
run: echo Test
- name: Clone repository
uses: actions/[email protected]

- name: Restore NuGet packages
run: nuget restore src/Orchard.sln

- name: Add msbuild to PATH
uses: microsoft/[email protected]

- name: Compile
run: msbuild Orchard.proj /m /t:Compile /p:MvcBuildViews=true /p:TreatWarningsAsErrors=true -WarnAsError
2 changes: 1 addition & 1 deletion Orchard.proj
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@
<NUnit Assemblies="@(TestAssemblies)" ToolPath="@(NUnitPackageToolsFolder)" WorkingDirectory="$(CompileFolder)" OutputXmlFile="$(BuildFolder)\Orchard.Tests.xml" ExcludeCategory="longrunning" />
</Target>

<Target Name="Spec" DependsOnTargets="Package-Stage">
<Target Name="Spec" DependsOnTargets="Compile">
<!-- Running SpecFlow tests -->
<CreateItem Include="$(CompileFolder)\*.Specs.*dll">
<Output TaskParameter="Include" ItemName="SpecAssemblies" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,6 @@
<Compile Include="Visitors\WhereArgumentsVisitor.cs" />
</ItemGroup>
<ItemGroup>
<None Include="..\NH.Linq.snk">
<Link>NH.Linq.snk</Link>
</None>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public void PublishingShouldFailIfOwnerIsUnknown() {
contentManager.UpdateEditor(item.ContentItem, updateModel.Object);
}

class UpdatModelStub : IUpdateModel {
class UpdateModelStub : IUpdateModel {

ModelStateDictionary _modelState = new ModelStateDictionary();

Expand Down Expand Up @@ -215,11 +215,11 @@ public void PublishingShouldNotThrowExceptionIfOwnerIsNull() {

var user = contentManager.New<IUser>("User");
_authn.Setup(x => x.GetAuthenticatedUser()).Returns(user);
_authz.Setup(x => x.TryCheckAccess(StandardPermissions.SiteOwner, user, item)).Returns(true);
_authz.Setup(x => x.TryCheckAccess(OwnerEditorPermissions.MayEditContentOwner, user, item)).Returns(true);

item.Owner = user;

var updater = new UpdatModelStub() { Owner = null };
var updater = new UpdateModelStub() { Owner = null };

contentManager.UpdateEditor(item.ContentItem, updater);
}
Expand All @@ -232,11 +232,11 @@ public void PublishingShouldFailIfOwnerIsEmpty() {

var user = contentManager.New<IUser>("User");
_authn.Setup(x => x.GetAuthenticatedUser()).Returns(user);
_authz.Setup(x => x.TryCheckAccess(StandardPermissions.SiteOwner, user, item)).Returns(true);
_authz.Setup(x => x.TryCheckAccess(OwnerEditorPermissions.MayEditContentOwner, user, item)).Returns(true);

item.Owner = user;

var updater = new UpdatModelStub() { Owner = "" };
var updater = new UpdateModelStub() { Owner = "" };

_container.Resolve<DefaultShapeTableManagerTests.TestShapeProvider>().Discover =
b => b.Describe("Parts_Common_Owner_Edit").From(TestFeature())
Expand All @@ -255,11 +255,11 @@ public void PublishingShouldNotFailIfOwnerIsEmptyAndShapeIsHidden() {

var user = contentManager.New<IUser>("User");
_authn.Setup(x => x.GetAuthenticatedUser()).Returns(user);
_authz.Setup(x => x.TryCheckAccess(StandardPermissions.SiteOwner, user, item)).Returns(true);
_authz.Setup(x => x.TryCheckAccess(OwnerEditorPermissions.MayEditContentOwner, user, item)).Returns(true);

item.Owner = user;

var updater = new UpdatModelStub() { Owner = "" };
var updater = new UpdateModelStub() { Owner = "" };

_container.Resolve<DefaultShapeTableManagerTests.TestShapeProvider>().Discover =
b => b.Describe("Parts_Common_Owner_Edit").From(TestFeature())
Expand Down Expand Up @@ -384,7 +384,7 @@ public void EditingShouldSetModifiedUtc() {
_clock.Advance(TimeSpan.FromMinutes(1));
var editUtc = _clock.UtcNow;

var updater = new UpdatModelStub() { Owner = "" };
var updater = new UpdateModelStub() { Owner = "" };
contentManager.UpdateEditor(item.ContentItem, updater);

Assert.That(item.CreatedUtc, Is.EqualTo(createUtc));
Expand Down
4 changes: 1 addition & 3 deletions src/Orchard.Profile/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
<configSections>
<section name="specFlow" type="TechTalk.SpecFlow.Configuration.ConfigurationSectionHandler, TechTalk.SpecFlow" />
</configSections>


<specFlow>
<specFlow>
<!-- For additional details on SpecFlow configuration options see http://go.specflow.org/doc-config -->
</specFlow>
</configuration>
19 changes: 8 additions & 11 deletions src/Orchard.Specs/Bindings/Settings.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
using System;
using NUnit.Framework;
using Orchard.ContentManagement;
using Orchard.ContentManagement.Aspects;
using Orchard.Core.Contents;
using Orchard.Data;
using Orchard.Security;
using Orchard.Security.Permissions;
using System.Linq;
using Orchard.Localization.Services;
using Orchard.Specs.Hosting.Orchard.Web;
using TechTalk.SpecFlow;
using Orchard.Localization.Services;
using System.Linq;

namespace Orchard.Specs.Bindings {
[Binding]
Expand All @@ -20,7 +12,7 @@ public void DefineDefaultCulture(string cultureName) {

var webApp = Binding<WebAppHosting>();
webApp.Host.Execute(() => {
using ( var environment = MvcApplication.CreateStandaloneEnvironment("Default") ) {
using (var environment = MvcApplication.CreateStandaloneEnvironment("Default")) {
var orchardServices = environment.Resolve<IOrchardServices>();
var cultureManager = environment.Resolve<ICultureManager>();
Expand All @@ -30,6 +22,11 @@ public void DefineDefaultCulture(string cultureName) {
}
orchardServices.WorkContext.CurrentSite.SiteCulture = cultureName;
// Restarting the shell to reset the cache, because the cache entry storing the list of available
// cultures isn't invalidated by the signal in DefaultCultureManager.ListCultures when running
// inside the test webhost.
MvcApplication.RestartTenant("Default");
}
});
}
Expand Down
6 changes: 6 additions & 0 deletions src/Orchard.Specs/Bindings/WebAppHosting.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading;
using System.Web;
using Castle.Core.Logging;
using HtmlAgilityPack;
Expand Down Expand Up @@ -368,6 +369,11 @@ public void WhenIAmRedirected() {
}
}

[When(@"I wait ""(.*)""")]
public void WhenIWait(int waitMilliseconds) {
Thread.Sleep(waitMilliseconds);
}

[Then(@"the status should be (.*) ""(.*)""")]
public void ThenTheStatusShouldBe(int statusCode, string statusDescription) {
Assert.That(Details.StatusCode, Is.EqualTo(statusCode));
Expand Down
16 changes: 14 additions & 2 deletions src/Orchard.Specs/Blogs.feature
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ Scenario: I can create browse blog posts on several pages
And I go to "admin/blogs"
And I follow "My Blog"
And I follow "New Post" where class name has "primaryAction"
And I wait "1000"
And I fill in
| name | value |
| Title.Title | My Post 1 |
Expand All @@ -179,6 +180,7 @@ Scenario: I can create browse blog posts on several pages
And I go to "admin/blogs"
And I follow "My Blog"
And I follow "New Post" where class name has "primaryAction"
And I wait "1000"
And I fill in
| name | value |
| Title.Title | My Post 2 |
Expand All @@ -187,6 +189,7 @@ Scenario: I can create browse blog posts on several pages
And I go to "admin/blogs"
And I follow "My Blog"
And I follow "New Post" where class name has "primaryAction"
And I wait "1000"
And I fill in
| name | value |
| Title.Title | My Post 3 |
Expand All @@ -195,6 +198,7 @@ Scenario: I can create browse blog posts on several pages
And I go to "admin/blogs"
And I follow "My Blog"
And I follow "New Post" where class name has "primaryAction"
And I wait "1000"
And I fill in
| name | value |
| Title.Title | My Post 4 |
Expand All @@ -203,6 +207,7 @@ Scenario: I can create browse blog posts on several pages
And I go to "admin/blogs"
And I follow "My Blog"
And I follow "New Post" where class name has "primaryAction"
And I wait "1000"
And I fill in
| name | value |
| Title.Title | My Post 5 |
Expand All @@ -211,6 +216,7 @@ Scenario: I can create browse blog posts on several pages
And I go to "admin/blogs"
And I follow "My Blog"
And I follow "New Post" where class name has "primaryAction"
And I wait "1000"
And I fill in
| name | value |
| Title.Title | My Post 6 |
Expand All @@ -219,6 +225,7 @@ Scenario: I can create browse blog posts on several pages
And I go to "admin/blogs"
And I follow "My Blog"
And I follow "New Post" where class name has "primaryAction"
And I wait "1000"
And I fill in
| name | value |
| Title.Title | My Post 7 |
Expand All @@ -227,6 +234,7 @@ Scenario: I can create browse blog posts on several pages
And I go to "admin/blogs"
And I follow "My Blog"
And I follow "New Post" where class name has "primaryAction"
And I wait "1000"
And I fill in
| name | value |
| Title.Title | My Post 8 |
Expand All @@ -235,6 +243,7 @@ Scenario: I can create browse blog posts on several pages
And I go to "admin/blogs"
And I follow "My Blog"
And I follow "New Post" where class name has "primaryAction"
And I wait "1000"
And I fill in
| name | value |
| Title.Title | My Post 9 |
Expand All @@ -243,6 +252,7 @@ Scenario: I can create browse blog posts on several pages
And I go to "admin/blogs"
And I follow "My Blog"
And I follow "New Post" where class name has "primaryAction"
And I wait "1000"
And I fill in
| name | value |
| Title.Title | My Post 10 |
Expand All @@ -251,6 +261,7 @@ Scenario: I can create browse blog posts on several pages
And I go to "admin/blogs"
And I follow "My Blog"
And I follow "New Post" where class name has "primaryAction"
And I wait "1000"
And I fill in
| name | value |
| Title.Title | My Post 11 |
Expand All @@ -259,6 +270,7 @@ Scenario: I can create browse blog posts on several pages
And I go to "admin/blogs"
And I follow "My Blog"
And I follow "New Post" where class name has "primaryAction"
And I wait "1000"
And I fill in
| name | value |
| Title.Title | My Post 12 |
Expand All @@ -269,12 +281,12 @@ Scenario: I can create browse blog posts on several pages
Then I should see "<h1[^>]*>.*?My Blog.*?</h1>"
And I should see "<h1[^>]*>.*?My Post 12.*?</h1>"
And I should see "<h1[^>]*>.*?My Post 11.*?</h1>"
And I should not see "<h1[^>]*>.*?My Post 10.*?</h1>"
And I should not see "My Post 2"
When I go to "my-blog?page=2"
Then I should see "<h1[^>]*>.*?My Blog.*?</h1>"
And I should see "<h1[^>]*>.*?My Post 1.*?</h1>"
And I should see "<h1[^>]*>.*?My Post 2.*?</h1>"
And I should not see "<h1[^>]*>.*?My Post 3.*?</h1>"
And I should not see "My Post 3"
Scenario: I can create a new blog with a percent sign in the title and it gets stripped out of the slug
Given I have installed Orchard
Expand Down
Loading

0 comments on commit e333952

Please sign in to comment.