-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #370 from anktd/master
Add Initial Unit Tests and Update Composer Dependencies
- Loading branch information
Showing
5 changed files
with
2,595 additions
and
1 deletion.
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,48 @@ | ||
name: Run PHPUnit Tests | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
services: | ||
mysql: | ||
image: mysql:5.7 | ||
env: | ||
MYSQL_ROOT_PASSWORD: root | ||
MYSQL_DATABASE: wordpress_tests | ||
ports: | ||
- 3306:3306 | ||
options: >- | ||
--health-cmd="mysqladmin ping" | ||
--health-interval=10s | ||
--health-timeout=10s | ||
--health-retries=10 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Setup PHP, with Composer and extensions | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: '8.1' # Ensuring PHP 8.1 is used | ||
extensions: mbstring, xml, curl, pdo_mysql | ||
coverage: pcov | ||
tools: composer:v2 | ||
|
||
- name: Install dependencies | ||
run: composer install --prefer-dist --no-progress | ||
|
||
- name: Start MySQL | ||
run: sudo /etc/init.d/mysql start | ||
|
||
- name: Prepare WordPress Database | ||
run: | | ||
mysql -e 'CREATE DATABASE wordpress_tests;' -uroot -proot | ||
mysql -e "CREATE USER 'wp'@'localhost' IDENTIFIED BY 'wp';" -uroot -proot | ||
mysql -e "GRANT ALL PRIVILEGES ON wordpress_tests.* TO 'wp'@'localhost';" -uroot -proot | ||
mysql -e 'FLUSH PRIVILEGES;' -uroot -proot | ||
- name: Run PHPUnit tests | ||
run: vendor/bin/phpunit tests/ |
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 +1,2 @@ | ||
node_modules | ||
node_modules | ||
vendor/ |
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,18 @@ | ||
{ | ||
"name": "blockonomics/test", | ||
"require-dev": { | ||
"phpunit/phpunit": "^8.5 || ^9.5", | ||
"10up/wp_mock": "^0.5.0" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"": "php/" | ||
} | ||
}, | ||
"authors": [ | ||
{ | ||
"name": "blockonomics", | ||
"email": "[email protected]" | ||
} | ||
] | ||
} |
Oops, something went wrong.