-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Add Codeception for PHP testing - Add Docker testing environment - Add lint-staged - Add copy of WP_HTML_Tag_Processor, modify for use of indexing content. - Add stemmers from tntsearch s
- Loading branch information
Showing
109 changed files
with
17,266 additions
and
4,662 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
.git | ||
.github | ||
.idea | ||
.husky | ||
.vscode | ||
bin | ||
client | ||
tests | ||
node_modules | ||
vendor | ||
.composer | ||
.distignore | ||
.editorconfig | ||
.env | ||
.env.example | ||
.eslintignore | ||
.eslintrc.json | ||
.gitattributes | ||
.gitignore | ||
.npmrc | ||
.nvmrc | ||
.php-cs-fixer.cache | ||
.php-cs-fixer.php | ||
.php-cs-fixer.dist.php | ||
.prettierignore | ||
.prettierrc.js | ||
.stylelintignore | ||
babel.config.cjs | ||
codeception.yml | ||
codeception.dist.yml | ||
composer.json | ||
composer.lock | ||
jest.config.cjs | ||
package-lock.json | ||
package.json | ||
phpcs.xml | ||
phpstan.neon | ||
phpstan.neon.dist | ||
README.md | ||
tsconfig.eslint.json | ||
tsconfig.json | ||
webpack.config.cjs | ||
$GITHUB_WORKSPACE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# The path to the WordPress root directory, the one containing the wp-load.php file. | ||
# This can be a relative path from the directory that contains the codeception.yml file, | ||
# or an absolute path. | ||
WORDPRESS_ROOT_FOLDER="/var/www/html" | ||
|
||
# The port on which the WordPress installation is served. | ||
WORDPRESS_LOCALHOST_PORT=3389 | ||
|
||
# The URL and domain of the WordPress site used in end-to-end tests. | ||
WORDPRESS_URL="http://localhost:3389" | ||
WORDPRESS_DOMAIN=localhost:3389 | ||
|
||
# Tests will require a MySQL database to run. | ||
# The database will be created if it does not exist. | ||
# Do not use a database that contains important data! | ||
WORDPRESS_DB_DSN="mysql:host=database;port=3306;dbname=wordpress" | ||
WORDPRESS_DB_HOST=database:3306 | ||
WORDPRESS_DB_NAME=wordpress | ||
WORDPRESS_DB_USER=wordpress | ||
WORDPRESS_DB_PASSWORD=wordpress | ||
WORDPRESS_DB_URL=mysql://wordpress:wordpress@database:3306/wordpress | ||
WORDPRESS_DB_LOCALHOST_PORT=3391 | ||
|
||
# The Integration suite will use this table prefix for the WordPress tables. | ||
TEST_TABLE_PREFIX=test_ | ||
|
||
# This table prefix used by the WordPress site in end-to-end tests. | ||
WORDPRESS_TABLE_PREFIX=wp_ | ||
|
||
# The username and password of the administrator user of the WordPress site used in end-to-end tests. | ||
WORDPRESS_ADMIN_USER=admin | ||
WORDPRESS_ADMIN_PASSWORD=password | ||
|
||
WORDPRESS_ADMIN_PATH="/wp-admin" | ||
|
||
WORDPRESS_XDEBUG=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,6 @@ build-module | |
build-types | ||
coverage | ||
vendor | ||
vendor-prod | ||
|
||
tests/_wordpress |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: Install dependencies | ||
description: Setup Node.js, Composer, and install dependencies | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Cache Composer packages | ||
id: composer-cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
vendor | ||
vendor-prod | ||
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} | ||
- name: Composer install | ||
uses: php-actions/composer@v6 | ||
with: | ||
php_version: "8.2" | ||
version: 2.x | ||
dev: yes | ||
args: --optimize-autoloader --ignore-platform-reqs | ||
|
||
- name: Install Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version-file: .nvmrc | ||
cache: npm | ||
cache-dependency-path: package-lock.json | ||
|
||
- name: NPM install | ||
shell: bash | ||
run: npm ci --ignore-scripts | ||
|
||
- name: Build NPM dependencies | ||
shell: bash | ||
run: npm rebuild && npm run prepare --if-present |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: Coding Standards | ||
|
||
on: | ||
pull_request: | ||
branches: [main, epic/*] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
lint: | ||
name: Check Coding Standards | ||
runs-on: ubuntu-latest | ||
environment: testing | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install dependenices | ||
uses: ./.github/actions/install | ||
|
||
- name: Generate testing files | ||
shell: bash | ||
run: | | ||
envsubst < tests/.env.example > tests/.env | ||
php vendor/bin/codecept build | ||
- name: Lint PHP | ||
shell: bash | ||
run: | | ||
composer run-script lint | ||
composer run-script analyze | ||
- name: Lint JavaScript | ||
shell: bash | ||
run: | | ||
npm run lint:js | ||
npm run check | ||
- name: Lint Styles | ||
shell: bash | ||
run: npm run lint:css |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
name: Test Suite | ||
|
||
on: | ||
pull_request: | ||
branches: [main, epic/*] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
test: ["unit", "acceptance"] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install dependenices | ||
uses: ./.github/actions/install | ||
|
||
- name: Setup environment | ||
shell: bash | ||
run: envsubst < tests/.env.example > tests/.env | ||
|
||
- name: Cache Docker images. | ||
uses: ScribeMD/docker-cache@0.3.6 | ||
with: | ||
key: docker-${{ runner.os }}-${{ hashFiles('docker-compose.yml') }} | ||
|
||
- name: Build testing files | ||
shell: bash | ||
run: php vendor/bin/codecept build | ||
|
||
- name: Setup docker | ||
shell: bash | ||
run: sudo bin/test-up.sh | ||
|
||
- name: Run unit tests | ||
if: matrix.test != 'acceptance' | ||
run: bin/test-run.sh ${{ matrix.test }} | ||
|
||
- name: Run acceptance tests | ||
if: matrix.test == 'acceptance' | ||
run: php vendor/bin/codecept run acceptance | ||
|
||
- name: Upload codeception output | ||
if: ${{ failure() }} | ||
uses: actions/upload-artifact@v2.2.1 | ||
with: | ||
name: "${{ matrix.test }}-output" | ||
path: "./tests/_output" | ||
|
||
- name: Stop testing container | ||
shell: bash | ||
run: bin/test-down.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
npx lint-staged |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,5 +4,11 @@ build-module | |
build-types | ||
coverage | ||
vendor | ||
vendor-prod | ||
|
||
composer.lock | ||
package-lock.json | ||
|
||
**/*.md | ||
|
||
tests/_wordpress |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
.cache | ||
build | ||
build-module | ||
build-types | ||
|
||
tests | ||
coverage | ||
|
||
vendor | ||
vendor-prod | ||
node_modules | ||
|
||
tests/_wordpress |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,29 @@ | ||
# Search | ||
# Indexed Search | ||
|
||
An advanced WordPress search block. | ||
An advanced WordPress indexed search plugin. | ||
|
||
## Description | ||
|
||
A super cool search plugin which uses indexing to make the search of post content speedy! | ||
|
||
## Development | ||
|
||
### Getting started | ||
|
||
The testing environment setup in a container through Docker. | ||
|
||
```sh | ||
# Command to start the testing WordPress instance. | ||
docker-compose up -d | ||
``` | ||
|
||
### Testing database | ||
|
||
The testing container does not persist volumes. If a local database dump exists, it will be loaded when initializing the database container. | ||
|
||
Use the following command to create a local database dump. | ||
|
||
```sh | ||
# Command to dump the testing database to tests/_data/dump.sql | ||
bin/dump-acceptance-db | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/env bash | ||
|
||
docker compose --file tests/docker-compose.yml --env-file tests/.env exec database /usr/bin/mysqldump -uwordpress -pwordpress wordpress > tests/_data/dump.sql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/env bash | ||
|
||
./bin/test-up.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/env bash | ||
|
||
docker compose --file docker-compose.yml --env-file .env down |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env bash | ||
|
||
docker compose --file docker-compose.yml --env-file .env up --wait | ||
docker compose --file docker-compose.yml --env-file .env exec -T wordpress chown www-data:www-data wp-content wp-content/plugins |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/env bash | ||
|
||
docker compose --file docker-compose.yml --env-file .env exec -w /var/www/html/wp-content/plugins/indexed-search wordpress bash -c "vendor/bin/wp --allow-root shell" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/env bash | ||
|
||
docker compose --file tests/docker-compose.yml --env-file tests/.env exec -T -w /var/www/html/wp-content/plugins/indexed-search wordpress ./vendor/bin/codecept build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/env bash | ||
|
||
docker compose --file tests/docker-compose.yml --env-file tests/.env down |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/env bash | ||
|
||
docker compose --file tests/docker-compose.yml --env-file tests/.env exec -T -w /var/www/html/wp-content/plugins/indexed-search wordpress ./vendor/bin/codecept run "$1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/usr/bin/env bash | ||
|
||
docker compose --file tests/docker-compose.yml --env-file tests/.env up --wait | ||
docker compose --file tests/docker-compose.yml --env-file tests/.env exec -T wordpress chown -R www-data:www-data wp-content wp-content/plugins wp-content/plugins/indexed-search | ||
docker compose --file tests/docker-compose.yml --env-file tests/.env exec -T -w /var/www/html/wp-content/plugins/indexed-search wordpress bash bin/wp-install.sh |
Oops, something went wrong.