From bad84d7a16e94a088ae2847c471cdba41733c9d1 Mon Sep 17 00:00:00 2001 From: amecea Date: Wed, 10 Aug 2022 18:35:53 +0300 Subject: [PATCH] Update tests config --- .drone.jsonnet | 9 ++---- .drone.yml | 3 +- Makefile | 10 ++----- composer.json | 3 +- composer.lock | 63 ++++++++++++++++++++++++++++++++++++++- tests/wp-tests-config.php | 21 +++++++++++++ 6 files changed, 92 insertions(+), 17 deletions(-) diff --git a/.drone.jsonnet b/.drone.jsonnet index 7b688c3b..1f673b5f 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -1,5 +1,5 @@ -local Pipeline(php_version, wp_version = "latest") = +local Pipeline(php_version, wp_version) = { kind: 'pipeline', name: 'php-' + php_version, @@ -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, ], }, { @@ -71,6 +68,6 @@ local Pipeline(php_version, wp_version = "latest") = }; [ - Pipeline('8.0'), + Pipeline('8.0', '6.0.1'), //Pipeline('7.4'), ] diff --git a/.drone.yml b/.drone.yml index efd1173c..ad9ee2ad 100644 --- a/.drone.yml +++ b/.drone.yml @@ -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=6.0.1 image: docker.io/presslabs/php-runtime:8.0 name: test - commands: diff --git a/Makefile b/Makefile index 63b75480..fa707458 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/composer.json b/composer.json index 374bd487..6e154651 100755 --- a/composer.json +++ b/composer.json @@ -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" diff --git a/composer.lock b/composer.lock index 72f90b7a..1f7d523f 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "d378a9a7a6240d9a3bbf32957c601c79", + "content-hash": "a7c435b9fe9d0f451365118047f818bb", "packages": [ { "name": "firebase/php-jwt", @@ -2879,6 +2879,67 @@ "source": "https://github.com/webmozarts/assert/tree/1.11.0" }, "time": "2022-06-03T18:03:27+00:00" + }, + { + "name": "yoast/phpunit-polyfills", + "version": "1.0.3", + "source": { + "type": "git", + "url": "https://github.com/Yoast/PHPUnit-Polyfills.git", + "reference": "5ea3536428944955f969bc764bbe09738e151ada" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Yoast/PHPUnit-Polyfills/zipball/5ea3536428944955f969bc764bbe09738e151ada", + "reference": "5ea3536428944955f969bc764bbe09738e151ada", + "shasum": "" + }, + "require": { + "php": ">=5.4", + "phpunit/phpunit": "^4.8.36 || ^5.7.21 || ^6.0 || ^7.0 || ^8.0 || ^9.0" + }, + "require-dev": { + "yoast/yoastcs": "^2.2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.x-dev", + "dev-develop": "1.x-dev" + } + }, + "autoload": { + "files": [ + "phpunitpolyfills-autoload.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Team Yoast", + "email": "support@yoast.com", + "homepage": "https://yoast.com" + }, + { + "name": "Contributors", + "homepage": "https://github.com/Yoast/PHPUnit-Polyfills/graphs/contributors" + } + ], + "description": "Set of polyfills for changed PHPUnit functionality to allow for creating PHPUnit cross-version compatible tests", + "homepage": "https://github.com/Yoast/PHPUnit-Polyfills", + "keywords": [ + "phpunit", + "polyfill", + "testing" + ], + "support": { + "issues": "https://github.com/Yoast/PHPUnit-Polyfills/issues", + "source": "https://github.com/Yoast/PHPUnit-Polyfills" + }, + "time": "2021-11-23T01:37:03+00:00" } ], "aliases": [], diff --git a/tests/wp-tests-config.php b/tests/wp-tests-config.php index 969e7247..4efbc00f 100644 --- a/tests/wp-tests-config.php +++ b/tests/wp-tests-config.php @@ -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', '' ); +