Skip to content

Commit

Permalink
Merge pull request #304 from localgovdrupal/1.x
Browse files Browse the repository at this point in the history
Release 1.7.3
  • Loading branch information
andybroomfield committed Jan 30, 2024
2 parents 0ff7659 + 2a7c282 commit d34d931
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 10 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
##
# Managed by https://github.com/localgovdrupal/github_workflow_manager
---
name: Test localgovdrupal/localgov_alert_banner drupal-module

on:
Expand Down Expand Up @@ -215,4 +212,4 @@ jobs:
mkdir -p ./html/web/sites/simpletest && chmod 777 ./html/web/sites/simpletest
sed -i "s#http://localgov.lndo.site#http://drupal#" ./html/phpunit.xml.dist
docker exec -t drupal bash -c 'chown docker:docker -R /var/www/html'
docker exec -u docker -t drupal bash -c "cd /var/www/html && ./bin/paratest --processes=4 ${{ env.LOCALGOV_DRUPAL_PROJECT_PATH }}"
docker exec -u docker -t drupal bash -c "cd /var/www/html && ./bin/paratest --processes=4 /var/www/html/${{ env.LOCALGOV_DRUPAL_PROJECT_PATH }}"
7 changes: 1 addition & 6 deletions localgov_alert_banner.links.task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ entity.localgov_alert_banner.edit_form:
base_route: entity.localgov_alert_banner.canonical
title: 'Edit'

entity.localgov_alert_banner.version_history:
route_name: entity.localgov_alert_banner.version_history
base_route: entity.localgov_alert_banner.canonical
title: 'Revisions'

entity.localgov_alert_banner.status_form:
route_name: entity.localgov_alert_banner.status_form
base_route: entity.localgov_alert_banner.canonical
Expand All @@ -26,7 +21,7 @@ entity.localgov_alert_banner.delete_form:
route_name: entity.localgov_alert_banner.delete_form
base_route: entity.localgov_alert_banner.canonical
title: Delete
weight: 10
weight: 20

entity.localgov_alert_banner.collection:
route_name: entity.localgov_alert_banner.collection
Expand Down
8 changes: 8 additions & 0 deletions localgov_alert_banner.module
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,14 @@ function localgov_alert_banner_preprocess(&$variables) {
if ($route_name == 'entity.localgov_alert_banner.status_form') {
unset($variables['content']['content_moderation_control']);
}

// Set is_front variable.
try {
$variables['is_front'] = \Drupal::service('path.matcher')->isFrontPage();
}
catch (Exception $e) {
$variables['is_front'] = FALSE;
}
}
}

Expand Down
8 changes: 8 additions & 0 deletions tests/src/Functional/AlertBannerBlockTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,14 @@ public function testAlertBannerDisplays() {
// Load the front page and check the banner is displayed.
$this->drupalGet('<front>');
$this->assertSession()->pageTextContains($alert_message);

// Check that the front page class exists.
$this->assertSession()->responseContains('localgov-alert-banner--homepage');

// Check front pages class not visible on second page.
$this->drupalGet('/admin');
$this->assertSession()->responseContains('localgov-alert-banner');
$this->assertSession()->responseNotContains('localgov-alert-banner--homepage');
}

/**
Expand Down

0 comments on commit d34d931

Please sign in to comment.