Skip to content

Commit

Permalink
Update CI/CD Pipeline to run Unit Tests (#894)
Browse files Browse the repository at this point in the history
Co-authored-by: godaddy-wordpress-bot <[email protected]>
  • Loading branch information
EvanHerman and godaddy-wordpress-bot authored Jul 21, 2023
1 parent 628c682 commit 459a970
Show file tree
Hide file tree
Showing 6 changed files with 183 additions and 88 deletions.
33 changes: 26 additions & 7 deletions .dev/tests/php/bootstrap.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,38 @@
<?php

$_tests_dir = getenv( 'WP_TESTS_DIR' );
// Require dependencies.
require_once dirname( dirname( dirname( dirname( __FILE__ ) ) ) ) . '/vendor/wp-phpunit/wp-phpunit/__loaded.php';
require_once dirname( dirname( dirname( dirname( __FILE__ ) ) ) ) . '/vendor/yoast/phpunit-polyfills/phpunitpolyfills-autoload.php';

if ( ! $_tests_dir ) {
// If we're running in WP's build directory, ensure that WP knows that, too.
if ( 'build' === getenv( 'LOCAL_DIR' ) ) {
define( 'WP_RUN_CORE_TESTS', true );
}

$_tests_dir = '/var/www/html/wordpress-tests-lib';
// Determine the tests directory (from a WP dev checkout).
// Try the WP_TESTS_DIR environment variable first.
$_tests_dir = getenv( 'WP_TESTS_DIR' );

// Next, try the WP_PHPUNIT composer package if we're inside wp-env.
if ( ! $_tests_dir && 'tests-mysql' === getenv( 'WORDPRESS_DB_HOST' ) ) {
$_tests_dir = getenv( 'WP_PHPUNIT__DIR' );
}

if ( ! file_exists( $_tests_dir . '/includes/functions.php' ) ) {

echo "Could not find $_tests_dir/includes/functions.php, have you run bin/install-wp-tests.sh ?" . PHP_EOL;
// See if we're installed inside an existing WP dev instance.
if ( ! $_tests_dir ) {
$_try_tests_dir = dirname( __FILE__ ) . '/../../../../../tests/phpunit';
if ( file_exists( $_try_tests_dir . '/includes/functions.php' ) ) {
$_tests_dir = $_try_tests_dir;
}
}
// Fallback.
if ( ! $_tests_dir ) {
$_tests_dir = rtrim( sys_get_temp_dir(), '/\\' ) . '/wordpress-tests-lib';
}

if ( ! file_exists( $_tests_dir . '/includes/functions.php' ) ) {
echo "Could not find $_tests_dir/includes/functions.php, have you run .dev/bin/install-wp-tests.sh ?" . PHP_EOL; // WPCS: XSS ok.
exit( 1 );

}

// Give access to tests_add_filter() function.
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/update-translations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.ref }}

- name: Configure git user
run: |
Expand Down
4 changes: 3 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,11 @@
"require-dev": {
"squizlabs/php_codesniffer": "^3.5",
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.1",
"johnpbloch/wordpress-core": "^6.0.1",
"phpcompatibility/phpcompatibility-wp": "^2.1",
"wp-coding-standards/wpcs": "^2.1",
"phpunit/phpunit": "^9",
"phpunit/phpunit": "^9.5.21",
"wp-phpunit/wp-phpunit": "^6.0.1",
"yoast/phpunit-polyfills": "^1.0.1"
},
"scripts": {
Expand Down
150 changes: 123 additions & 27 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 5 additions & 8 deletions languages/go.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@
"45a0bfab2afddc3488bc5271244f2706": "Go is an innovative, Gutenberg-first WordPress theme, hyper-focused on empowering makers to build beautifully rich websites with WordPress.",
"ab0a2ad2de4a8df6663bbcb8fd532f46": "GoDaddy",
"14f0fd22288f6490c67087be904ab544": "https://www.godaddy.com",
"2b63489305859743e2a0ff1f1fc3d44e": "Your installation of the Go theme is incomplete. If you installed the Go theme from GitHub, please refer to this document to set up your development environment: %1$s",
"eb6248e0e51d886d0a025adb479163e9": "Your installation of the Go theme is incomplete. If you installed the Go theme from GitHub, please refer to <a href=\"%1$s\" target=\"_blank\" rel=\"noopener noreferrer\">this document</a> to set up your development environment.",
"074de7e7c226d5c60f8af14c20725352": "Primary",
"7aaf0c93c9323c3379ede972e0950896": "Footer Menu #1",
"be18b79db515eef9e3b22ff01a0af98e": "Footer Menu #2",
"c3349428ccc248d1af8335f5851adfcd": "Footer Menu #3",
"5bf57e0fcef61ba61afc7a88a17b1f71": "One thought on &ldquo;%s&rdquo;",
"f22ad85909b230935593b8d269b2b86b": "%1$s thought on &ldquo;%2$s&rdquo;",
"221b94a7f866d10d0b85b7886cea5d18": "Comment navigation",
Expand Down Expand Up @@ -107,6 +101,10 @@
"0b8c1d6179d1c4a20f002d67dc49bc0c": "%1$s installed successfully.",
"003b8672b471e60c83cb28552f948625": "All installations have been completed.",
"4cee13af8289e47431d5b934e6ecd69f": "Installing Plugin %1$s (%2$d/%3$d)",
"074de7e7c226d5c60f8af14c20725352": "Primary",
"7aaf0c93c9323c3379ede972e0950896": "Footer Menu #1",
"be18b79db515eef9e3b22ff01a0af98e": "Footer Menu #2",
"c3349428ccc248d1af8335f5851adfcd": "Footer Menu #3",
"2660064e68655415da2628c2ae2f7592": "Small",
"5dbc98dcc983a70728bd082d1a47546e": "S",
"87f8a6ab85c9ced3702b4ea641ad4bb5": "Medium",
Expand Down Expand Up @@ -337,6 +335,5 @@
"29042a31d997c996f52c1d2fd4ad813d": "Search &hellip;",
"a4d3b161ce1309df1c4e25df28694b7b": "Submit",
"c25a996297244c1e01e47adb13679782": "Items (%s)",
"1063e38cb53d94d386f21227fcd84717": "Remove",
"0e979c88b3a83cc4da445e3dc2a06213": "Hide page title"
"1063e38cb53d94d386f21227fcd84717": "Remove"
}
Loading

0 comments on commit 459a970

Please sign in to comment.