Skip to content

Commit

Permalink
try fixing e2e
Browse files Browse the repository at this point in the history
  • Loading branch information
Sidsector9 committed Jul 15, 2024
1 parent 10fafaf commit df9a529
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 25 deletions.
9 changes: 1 addition & 8 deletions .wp-env.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,5 @@
".",
"./tests/Basic-Auth-master"
],
"env": {
"tests": {
"port": 80,
"mappings": {
"wp-cli.yml": "./tests/bin/wp-cli.yml"
}
}
}
"port": 80
}
20 changes: 20 additions & 0 deletions tests/bin/.htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# BEGIN WordPress
# The directives (lines) between "BEGIN WordPress" and "END WordPress" are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]

# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]

# END WordPress
40 changes: 23 additions & 17 deletions tests/bin/initialize.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,27 @@
#!/bin/bash
set -e
# set -e

npm run env run tests-wordpress "chmod -c ugo+w /var/www/html"
npm run env run tests-cli "wp rewrite structure '/%postname%/' --hard"
# npm run env run tests-wordpress "chmod -c ugo+w /var/www/html"
# npm run env run tests-cli "wp rewrite structure '/%postname%/' --hard"

status=0
npm run env run tests-cli "wp site list" || status=$?
# status=0
# npm run env run tests-cli "wp site list" || status=$?

if [ $status -eq 0 ]
then
echo "Multisite already initialized"
else
echo "Converting to multisite"
npm run env run tests-cli "wp core multisite-convert --title='Distributor Multisite'"
npm run env run tests-cli "wp user create second '[email protected]' --user_pass=password --role=administrator"
npm run env run tests-cli "wp site create --slug=second --title='Second Site' --email='[email protected]'"
npm run env run tests-cli "wp theme enable twentytwentyone --activate"
npm run env run tests-cli "wp theme enable twentytwentyone --url=localhost/second --activate"
npm run env run tests-cli "cp wp-content/plugins/distributor/tests/cypress/.htaccess .htaccess"
fi
# if [ $status -eq 0 ]
# then
# echo "Multisite already initialized"
# else
# echo "Converting to multisite"
# npm run env run tests-cli "wp core multisite-convert --title='Distributor Multisite'"
# npm run env run tests-cli "wp user create second '[email protected]' --user_pass=password --role=administrator"
# npm run env run tests-cli "wp site create --slug=second --title='Second Site' --email='[email protected]'"
# npm run env run tests-cli "wp theme enable twentytwentyone --activate"
# npm run env run tests-cli "wp theme enable twentytwentyone --url=localhost/second --activate"
# npm run env run tests-cli "cp wp-content/plugins/distributor/tests/cypress/.htaccess .htaccess"
# fi

wp-env run cli wp core multisite-convert
HTACCESS_PATH="$(wp-env install-path)/WordPress/.htaccess"
cp ./tests/bin/.htaccess $HTACCESS_PATH;
wp-env run cli wp user create second '[email protected]' --user_pass=password --role=administrator
wp-env run cli wp site create --slug=second --title='Second Site' --email='[email protected]'

0 comments on commit df9a529

Please sign in to comment.