Skip to content

Commit

Permalink
Update tests config
Browse files Browse the repository at this point in the history
  • Loading branch information
AMecea committed Aug 10, 2022
1 parent aaaf04b commit e94c295
Show file tree
Hide file tree
Showing 7 changed files with 97 additions and 15 deletions.
5 changes: 1 addition & 4 deletions .drone.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,13 @@ local Pipeline(php_version, wp_version = "latest") =
commands: [
// install build deps
"make build.tools",
// install wordpress
"make wordpress.build WP_VERSION=%s" % wp_version,
],
},
{
name: "test",
image: "docker.io/presslabs/php-runtime:%s" % php_version,
commands: [
"make test",
//"WP_MULTISITE=1 phpunit",
"make test WP_VERSION=%s" % wp_version,
],
},
{
Expand Down
3 changes: 1 addition & 2 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,13 @@ steps:
tags: true
- commands:
- make build.tools
- make wordpress.build WP_VERSION=latest
environment:
WP_CORE_DIR: /workspace/presslabs/toplytics/wordpress
WP_TEST_DIR: /workspace/presslabs/toplytics/wordpress-test-lib
image: quay.io/presslabs/build:latest
name: install deps
- commands:
- make test
- make test WP_VERSION=latest
image: docker.io/presslabs/php-runtime:8.0
name: test
- commands:
Expand Down
10 changes: 3 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
PROJECT_NAME := toplytics
PROJECT_REPO := github.com/presslabs/toplytics

WP_VERSION ?= 6.0.1

include build/makelib/common.mk
include build/makelib/wordpress.mk
include build/makelib/php.mk

WP_CLI_VERSION:=2.6.0
WP_CLI_DOWNLOAD_URL:=https://github.com/wp-cli/wp-cli/releases/download/v$(WP_CLI_VERSION)/wp-cli-$(WP_CLI_VERSION).phar
$(eval $(call tool.download,wp,$(WP_CLI_VERSION),$(WP_CLI_DOWNLOAD_URL)))

# override php tests because of wordpress.mk
.php.test.init:
@$(INFO) test wordpress pass
.php.test.init: $(WP_TESTS_DIR)/src/wp-includes/version.php $(WP_TESTS_DIR)/includes $(WP_TESTS_DIR)/data
7 changes: 7 additions & 0 deletions build/makelib/wordpress.mk
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ $(WP_TESTS_DIR)/src/wp-includes/version.php: $(WP_TESTS_ARCHIVE)
$(WP_TESTS_DIR)/wp-tests-config.php: $(WP_TESTS_CONFIG) $(WP_TESTS_DIR)/src/wp-includes/version.php
@cp $(WP_TESTS_CONFIG) $@

$(WP_TESTS_DIR)/includes: $(WP_TESTS_DIR)
@cp -r $(WP_TESTS_DIR)/tests/phpunit/includes $@

$(WP_TESTS_DIR)/data: $(WP_TESTS_DIR)
@cp -r $(WP_TESTS_DIR)/tests/phpunit/data $@


# add WP_TESTS_DIR env var for running tests
.do.php.test: PHPUNIT:=WP_TESTS_DIR=$(WP_TESTS_DIR) $(PHPUNIT)

Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"google/apiclient": "^2.10"
},
"require-dev": {
"phpunit/phpunit": "<8"
"phpunit/phpunit": "<8",
"yoast/phpunit-polyfills": "^1.0"
},
"scripts": {
"pre-autoload-dump": "Google\\Task\\Composer::cleanup"
Expand Down
63 changes: 62 additions & 1 deletion composer.lock

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

21 changes: 21 additions & 0 deletions tests/wp-tests-config.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,24 @@
* Authentication Unique Keys and Salts.
*
* Change these to different unique phrases!
* You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}
*/
define( 'AUTH_KEY', 'put your unique phrase here' );
define( 'SECURE_AUTH_KEY', 'put your unique phrase here' );
define( 'LOGGED_IN_KEY', 'put your unique phrase here' );
define( 'NONCE_KEY', 'put your unique phrase here' );
define( 'AUTH_SALT', 'put your unique phrase here' );
define( 'SECURE_AUTH_SALT', 'put your unique phrase here' );
define( 'LOGGED_IN_SALT', 'put your unique phrase here' );
define( 'NONCE_SALT', 'put your unique phrase here' );

$table_prefix = 'wptests_'; // Only numbers, letters, and underscores please!

define( 'WP_TESTS_DOMAIN', 'example.org' );
define( 'WP_TESTS_EMAIL', 'admin@example.org' );
define( 'WP_TESTS_TITLE', 'Test Blog' );

define( 'WP_PHP_BINARY', 'php' );

define( 'WPLANG', '' );

0 comments on commit e94c295

Please sign in to comment.