From 4056cd344add94863b9b7bb2211b13820321aaeb Mon Sep 17 00:00:00 2001
From: Jesse Hofmann-Smith <jhofmann-smith@phase2technology.com>
Date: Fri, 7 Nov 2014 15:56:56 -0800
Subject: [PATCH] pathauto

---
 panopoly_test.features.user_permission.inc    | 74 +++++++++++++++++++++++++++
 panopoly_test.info                            |  6 +++
 tests/features/pathauto.feature               | 48 -----------------
 tests/features/pathauto_administrator.feature | 49 ++++++++++++++++++
 tests/features/pathauto_editor.feature        | 33 ++++++++++++
 5 files changed, 162 insertions(+), 48 deletions(-)
 create mode 100644 panopoly_test.features.user_permission.inc
 delete mode 100644 tests/features/pathauto.feature
 create mode 100644 tests/features/pathauto_administrator.feature
 create mode 100644 tests/features/pathauto_editor.feature

diff --git a/panopoly_test.features.user_permission.inc b/panopoly_test.features.user_permission.inc
new file mode 100644
index 0000000..f8542f5
--- /dev/null
+++ b/panopoly_test.features.user_permission.inc
@@ -0,0 +1,74 @@
+<?php
+/**
+ * @file
+ * panopoly_test.features.user_permission.inc
+ */
+
+/**
+ * Implements hook_user_default_permissions().
+ */
+function panopoly_test_user_default_permissions() {
+  $permissions = array();
+
+  // Exported permission: 'create panopoly_test_page content'.
+  $permissions['create panopoly_test_page content'] = array(
+    'name' => 'create panopoly_test_page content',
+    'roles' => array(
+      'administrator' => 'administrator',
+      'editor' => 'editor',
+    ),
+    'module' => 'node',
+  );
+
+  // Exported permission: 'delete any panopoly_test_page content'.
+  $permissions['delete any panopoly_test_page content'] = array(
+    'name' => 'delete any panopoly_test_page content',
+    'roles' => array(
+      'administrator' => 'administrator',
+      'editor' => 'editor',
+    ),
+    'module' => 'node',
+  );
+
+  // Exported permission: 'delete own panopoly_test_page content'.
+  $permissions['delete own panopoly_test_page content'] = array(
+    'name' => 'delete own panopoly_test_page content',
+    'roles' => array(
+      'administrator' => 'administrator',
+      'editor' => 'editor',
+    ),
+    'module' => 'node',
+  );
+
+  // Exported permission: 'edit any panopoly_test_page content'.
+  $permissions['edit any panopoly_test_page content'] = array(
+    'name' => 'edit any panopoly_test_page content',
+    'roles' => array(
+      'administrator' => 'administrator',
+      'editor' => 'editor',
+    ),
+    'module' => 'node',
+  );
+
+  // Exported permission: 'use text format panopoly_html_text'.
+  $permissions['use text format panopoly_html_text'] = array(
+    'name' => 'use text format panopoly_html_text',
+    'roles' => array(
+      'administrator' => 'administrator',
+      'editor' => 'editor',
+    ),
+    'module' => 'filter',
+  );
+
+  // Exported permission: 'use text format panopoly_wysiwyg_text'.
+  $permissions['use text format panopoly_wysiwyg_text'] = array(
+    'name' => 'use text format panopoly_wysiwyg_text',
+    'roles' => array(
+      'administrator' => 'administrator',
+      'editor' => 'editor',
+    ),
+    'module' => 'filter',
+  );
+
+  return $permissions;
+}
diff --git a/panopoly_test.info b/panopoly_test.info
index 8bd8298..3b04dd9 100644
--- a/panopoly_test.info
+++ b/panopoly_test.info
@@ -23,6 +23,12 @@ features[field_instance][] = node-panopoly_test_page-body
 features[field_instance][] = node-panopoly_test_page-field_featured_image
 features[node][] = panopoly_test_page
 features[panelizer_defaults][] = node:panopoly_test_page:default
+features[user_permission][] = create panopoly_test_page content
+features[user_permission][] = delete any panopoly_test_page content
+features[user_permission][] = delete own panopoly_test_page content
+features[user_permission][] = edit any panopoly_test_page content
+features[user_permission][] = use text format panopoly_html_text
+features[user_permission][] = use text format panopoly_wysiwyg_text
 features[variable][] = field_bundle_settings_node__panopoly_test_page
 features[variable][] = menu_options_panopoly_test_page
 features[variable][] = menu_parent_panopoly_test_page
diff --git a/tests/features/pathauto.feature b/tests/features/pathauto.feature
deleted file mode 100644
index 51fbe3c..0000000
--- a/tests/features/pathauto.feature
+++ /dev/null
@@ -1,48 +0,0 @@
-Feature: Test pathauto
-  In order to get nice urls
-  As a site administrator
-  I need to be able to trust that pathauto works consistently
-
-  Background:
-    Given I am logged in as a user with the "administrator" role
-      And Panopoly magic live previews are disabled
-    When I visit "/node/add/panopoly-test-page"
-      And I fill in the following:
-        | Title  | Testing title |
-        | Editor | plain_text    |
-        | Body   | Testing body  |
-    # Normally, here we'd press "Publish", however some child distribtions
-    # don't use 'save_draft', and this makes this test compatible with them.
-    #When I press "Publish"
-    When I press "edit-submit"
-    Then the "h1" element should contain "Testing title"
-
-  @api @panopoly_admin
-  Scenario: Pathauto should automatically assign an url
-    Then the url should match "testing-title"
-
-  @api @panopoly_admin
-  Scenario: Pathauto should automatically assign a new url when changing the title
-    When I click "Edit" in the "Tabs" region
-      And I fill in the following:
-        | Title               | Completely other title |
-      And I press "Save"
-    Then the url should match "completely-other-title"
-    # But visiting the old URL should continue to work
-    When I visit "/content/testing-title"
-    Then the "h1" element should contain "Completely other title"
-
-  @api @panopoly_admin
-  Scenario: My own permalink should be kept even if changing title
-    When I click "Edit" in the "Tabs" region
-      And I fill in the following:
-        | Permalink           | my-custom-permalink |
-      And I press "Save"
-    Then the url should match "my-custom-permalink"
-    When I click "Edit" in the "Tabs" region
-      And I fill in the following:
-        | Title               | Saving Title Again  |
-      And I press "Save"
-    Then the url should match "my-custom-permalink"
-    Given I go to "my-custom-permalink"
-    Then the response status code should be 200
diff --git a/tests/features/pathauto_administrator.feature b/tests/features/pathauto_administrator.feature
new file mode 100644
index 0000000..deadd93
--- /dev/null
+++ b/tests/features/pathauto_administrator.feature
@@ -0,0 +1,49 @@
+Feature: Test pathauto for administrator users
+  In order to get nice urls
+  As a site administrator
+  I need to be able to trust that pathauto works consistently
+
+  Background:
+    Given I am logged in as a user with the "administrator" role
+      And Panopoly magic live previews are disabled
+    When I visit "/node/add/panopoly-test-page"
+      And I fill in the following:
+        | Title  | Testing title |
+        | Editor | plain_text    |
+        | Body   | Testing body  |
+    # Normally, here we'd press "Publish", however some child distribtions
+    # don't use 'save_draft', and this makes this test compatible with them.
+    #When I press "Publish"
+    When I press "edit-submit"
+    Then the "h1" element should contain "Testing title"
+
+  @api @panopoly_admin
+  Scenario: Pathauto should automatically assign an url
+    Then the url should match "testing-title"
+
+  @api @panopoly_admin
+  Scenario: Pathauto should automatically assign a new url when changing the title
+    When I click "Edit" in the "Tabs" region
+      And I fill in the following:
+        | Title               | Completely other title |
+      And I press "Save"
+    Then the url should match "completely-other-title"
+    # But visiting the old URL should continue to work
+    When I visit "/content/testing-title"
+    Then the "h1" element should contain "Completely other title"
+
+  @api @panopoly_admin
+  Scenario: My own permalink should be kept even if changing title
+    When I click "Edit" in the "Tabs" region
+      And I fill in the following:
+        | Permalink           | my-custom-permalink |
+      And I press "Save"
+    Then the url should match "my-custom-permalink"
+    When I click "Edit" in the "Tabs" region
+      And I fill in the following:
+        | Title               | Saving Title Again  |
+      And I press "Save"
+    Then the url should match "my-custom-permalink"
+    Given I go to "my-custom-permalink"
+    Then the response status code should be 200
+
diff --git a/tests/features/pathauto_editor.feature b/tests/features/pathauto_editor.feature
new file mode 100644
index 0000000..7356926
--- /dev/null
+++ b/tests/features/pathauto_editor.feature
@@ -0,0 +1,33 @@
+Feature: Test pathauto for editor users
+  In order to get nice urls
+  As a site editor
+  I need to be able to trust that pathauto works consistently
+
+  Background:
+    Given I am logged in as a user with the "editor" role
+      And Panopoly magic live previews are disabled
+    When I visit "/node/add/panopoly-test-page"
+      And I fill in the following:
+        | Title  | Testing title |
+        | Editor | plain_text    |
+        | Body   | Testing body  |
+    # Normally, here we'd press "Publish", however some child distribtions
+    # don't use 'save_draft', and this makes this test compatible with them.
+    #When I press "Publish"
+    When I press "edit-submit"
+    Then the "h1" element should contain "Testing title"
+
+  @api @panopoly_admin
+  Scenario: Pathauto should automatically assign an url
+    Then the url should match "testing-title"
+
+  @api @panopoly_admin
+  Scenario: Pathauto should automatically assign a new url when changing the title
+    When I click "Edit" in the "Tabs" region
+      And I fill in the following:
+        | Title               | Completely other title |
+      And I press "Save"
+    Then the url should match "completely-other-title"
+    # But visiting the old URL should continue to work
+    When I visit "/content/testing-title"
+    Then the "h1" element should contain "Completely other title"
-- 
1.9.3 (Apple Git-50)

