Commit b239754e authored by Matt Glaman's avatar Matt Glaman

Merge pull request #134 from mglaman/2393519-breadcrumbs-on-user

2393519 breadcrumbs on user
parents 0dd17c05 69e9f2ae
......@@ -47,8 +47,10 @@ install:
- cd ../../../
# Setting Behat environment
- DISTRO=`echo $TRAVIS_BUILD_DIR | sed -e "s/\/[^\/]*$//"`
- export BEHAT_PARAMS="{\"extensions\":{\"Drupal\\\DrupalExtension\":{\"drupal\":{\"drupal_root\":\"$DISTRO/drupal\"}}}}"
- BUILD_TOP=`dirname $TRAVIS_BUILD_DIR`
- BEHAT_PARAMS='{"extensions":{"Drupal\\DrupalExtension":{"drupal":{"drupal_root":"BUILD_TOP/drupal"}}}}'
- BEHAT_PARAMS=`echo $BEHAT_PARAMS | sed -e s#BUILD_TOP#$BUILD_TOP#`
- export BEHAT_PARAMS
# Build Codebase
- mkdir private_files
......@@ -88,6 +90,17 @@ install:
# Disable sendmail
- echo sendmail_path=`which true` >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
# Enable APC
- if [[ $TRAVIS_PHP_VERSION < "5.5" ]]; then echo "mysql.connect_timeout=3000" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini && echo "default_socket_timeout=3000" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi
# Increase the MySQL connection timeout on the PHP end.
- echo "mysql.connect_timeout=3000" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
- echo "default_socket_timeout=3000" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
# Increase the MySQL server timetout and packet size.
- mysql -e "SET GLOBAL wait_timeout = 36000;"
- mysql -e "SET GLOBAL max_allowed_packet = 33554432;"
before_script:
# Do the site install (either the current revision or old for the upgrade).
......
......@@ -154,9 +154,9 @@ function commerce_kickstart_product_ui_form_alter(&$form, &$form_state, $form_id
* Implements hook_page_alter().
*/
function commerce_kickstart_product_ui_page_alter(&$page) {
// Disable breadcumb on user, checkout and cart pages.
// Disable breadrcumb on checkout and cart pages.
$current_path = current_path();
$exclude_path = "user*\ncheckout/*\ncart";
$exclude_path = "checkout/*\ncart";
$match = drupal_match_path(drupal_strtolower($current_path), drupal_strtolower($exclude_path));
if ($match) {
drupal_set_breadcrumb(array());
......
......@@ -27,3 +27,10 @@ function commerce_kickstart_user_enable() {
throw $e;
}
}
/**
* Implements hook_uninstall().
*/
function commerce_kickstart_user_uninstall() {
variable_del('commerce_kickstart_user_breadcrumbs');
}
......@@ -90,6 +90,17 @@ function commerce_kickstart_user_module_implements_alter(&$implementations, $hoo
}
}
/**
* Implements hook_page_alter().
*/
function commerce_kickstart_user_page_alter(&$page) {
// Disable breadcrumb on user.
$match = drupal_match_path(drupal_strtolower(current_path()), drupal_strtolower('user*'));
if ($match && !variable_get('commerce_kickstart_user_breadcrumbs', FALSE)) {
drupal_set_breadcrumb(array());
}
}
/**
* Implements hook_form_FORM_ID_alter().
*
......
......@@ -213,4 +213,20 @@ class FeatureContext extends RawDrupalContext implements SnippetAcceptingContext
public function iWaitForSeconds($arg1) {
sleep($arg1);
}
/**
* @AfterScenario @variables
*/
public function afterScenarioVariableCleanUp(\Behat\Behat\Hook\Scope\AfterScenarioScope $scope) {
// Clean up variables after each scenario tagged @variable.
variable_del('commerce_kickstart_user_breadcrumbs');
}
/**
* @Given user breadcrumbs are enabled
*/
public function userBreadcrumbsAreEnabled() {
$this->getDrupal();
variable_set('commerce_kickstart_user_breadcrumbs', TRUE);
}
}
......@@ -52,3 +52,11 @@ Feature: Login Commerce Kickstart
| Update email/password |
| Connections |
| Order history |
But I should not see an "#breadcrumb" element
@api @variables
Scenario: Login with user breadcrumbs enabled
When I am logged in as a user with the "administrator" role
And user breadcrumbs are enabled
And I go to "/user"
Then I should see an "#breadcrumb" element
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment