Skip to content

Commit

Permalink
[BUGS-7135]: Updates code to resolve auth issue. (#359)
Browse files Browse the repository at this point in the history
* [BUGS-7135]: Updates code to resolve auth issue.

* if wp login not permitted, force saml auth

* run phpcbf for easy lint fixes

* bump dependencies

* don't activate a non-existant theme

* change the parent theme

* restore the theme to activate back to the custom one

* rename the theme styles
this is always going to point to the parent theme, so it's better for the stylesheet name to be something generic rather than something outdated

* update element that contains the page title

* be more verbose in our logging
because this prepare script differs from most of our other behat-prepare scripts, let's be more explicit about the steps so we know what it's doing when we look back at this in six+ months

* fix CAPSLOCK

* use the lint-test GHA to run linting

* remove the :

---------

Co-authored-by: Ryan Wagner <[email protected]>
Co-authored-by: Chris Reynolds <[email protected]>
  • Loading branch information
3 people authored Nov 22, 2023
1 parent 3b53f11 commit 5ca7ac4
Show file tree
Hide file tree
Showing 7 changed files with 150 additions and 153 deletions.
31 changes: 1 addition & 30 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,18 @@ workflows:
version: 2
main:
jobs:
- lint
- test-behat:
requires:
- lint
- test-behat
- test-phpunit:
name: "Test with PHP 7.4"
requires:
- lint
php_version: "7.4"
- test-phpunit:
name: "Test with PHP 8.0"
requires:
- lint
php_version: "8.0"
- test-phpunit:
name: "Test with PHP 8.1"
requires:
- lint
php_version: "8.1"
- test-phpunit:
name: "Test with PHP 8.2"
requires:
- lint
php_version: "8.2"
nightly:
triggers:
Expand All @@ -38,24 +27,6 @@ workflows:
jobs:
- test-behat
jobs:
lint:
working_directory: ~/pantheon-systems/wp-saml-auth
docker:
- image: quay.io/pantheon-public/build-tools-ci:8.x-php8.0
steps:
- checkout
- restore_cache:
keys:
- test-lint-dependencies-{{ checksum "composer.json" }}
- run: composer install -n --prefer-dist
- save_cache:
key: test-lint-dependencies-{{ checksum "composer.json" }}
paths:
- vendor
- run:
name: "Run PHP Lint"
command: |
composer phpcs
test-behat:
working_directory: ~/pantheon-systems/wp-saml-auth
parallelism: 1
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/lint-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,13 @@ jobs:
uses: pantheon-systems/[email protected]
with:
type: plugin
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Lint
run: |
composer install
composer lint
4 changes: 4 additions & 0 deletions bin/behat-prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,14 @@ git clone -b $TERMINUS_ENV $PANTHEON_GIT_URL $PREPARE_DIR
###
# Add WP Native PHP Sessions and child theme to environment
###
echo "Creating a child theme called $TERMINUS_SITE"
rm -rf $PREPARE_DIR/wp-content/themes/$TERMINUS_SITE
# Create a child theme that includes WP SAML Auth configuration details
mkdir $PREPARE_DIR/wp-content/themes/$TERMINUS_SITE
cp $BASH_DIR/fixtures/functions.php $PREPARE_DIR/wp-content/themes/$TERMINUS_SITE/functions.php
cp $BASH_DIR/fixtures/style.css $PREPARE_DIR/wp-content/themes/$TERMINUS_SITE/style.css

echo "Adding WP Native PHP Sessions to the environment"
rm -rf $PREPARE_DIR/wp-content/plugins/wp-native-php-sessions
# Download the latest WP Native PHP sessions release from WordPress.org
wget -O $PREPARE_DIR/wp-native-php-sessions.zip https://downloads.wordpress.org/plugin/wp-native-php-sessions.zip
Expand All @@ -59,6 +61,7 @@ rm $PREPARE_DIR/wp-native-php-sessions.zip
###
# Add the copy of this plugin itself to the environment
###
echo "Copying WP SAML Auth into WordPress"
cd $BASH_DIR/..
rsync -av --exclude='node_modules/' --exclude='simplesamlphp/' --exclude='tests/' ./* $PREPARE_DIR/wp-content/plugins/wp-saml-auth
rm -rf $PREPARE_DIR/wp-content/plugins/wp-saml-auth/.git
Expand All @@ -68,6 +71,7 @@ rm -rf $PREPARE_DIR/wp-content/plugins/wp-saml-auth/.git
# SimpleSAMLphp is installed to ~/code/private, and then symlinked into the
# web root
###
echo "Setting up SimpleSAMLphp"
rm -rf $PREPARE_DIR/private
mkdir $PREPARE_DIR/private
wget https://github.com/simplesamlphp/simplesamlphp/releases/download/v1.18.4/simplesamlphp-1.18.4.tar.gz -O $PREPARE_DIR/simplesamlphp-latest.tar.gz
Expand Down
4 changes: 2 additions & 2 deletions bin/fixtures/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
add_action( 'wp_enqueue_scripts', 'samltheme_parent_theme_enqueue_styles' );

function samltheme_parent_theme_enqueue_styles() {
wp_enqueue_style( 'twentytwentythree-style', get_template_directory_uri() . '/style.css' );
wp_enqueue_style( 'theme-style', get_template_directory_uri() . '/style.css' );
wp_enqueue_style( 'samltheme-style',
get_stylesheet_directory_uri() . '/style.css',
array( 'twentytwentythree-style' )
array( 'theme-style' )
);

}
Expand Down
2 changes: 1 addition & 1 deletion bin/fixtures/style.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
Theme Name: WP SAML Auth
Theme URI: https://pantheon.io
Description: Twentytwentythree child theme.
Description: TwentyTwentyThree child theme.
Author: x
Author URI: https://pantheon.io
Template: twentytwentythree
Expand Down
Loading

0 comments on commit 5ca7ac4

Please sign in to comment.