From 1d7e90004c8d211bb88434bfad64a256234e9f40 Mon Sep 17 00:00:00 2001 From: Anderson Grudtner Martins Date: Tue, 20 Jul 2021 18:50:38 -0300 Subject: [PATCH 1/8] Remove legacy fix for posts that breaks block editor on WP 5.8, #463 This fix_post method was only needed before we implemented the sync for post_author column. It is not required anymore, and is breaking the block editor on WP 5.8 --- src/core/Plugin.php | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/src/core/Plugin.php b/src/core/Plugin.php index bbb0bf0e..e569060c 100644 --- a/src/core/Plugin.php +++ b/src/core/Plugin.php @@ -115,7 +115,6 @@ public function __construct() // Fix the author page. // Use posts_selection since it's after WP_Query has built the request and before it's queried any posts add_filter('posts_selection', [$this, 'fix_query_for_author_page']); - add_action('the_post', [$this, 'fix_post'], 10); add_action( 'init', @@ -1148,33 +1147,6 @@ public function fix_404_for_authors($shortCircuit, $wp_query) return $shortCircuit; } - public function fix_post(WP_Post $post) - { - $legacyPlugin = Factory::getLegacyPlugin(); - - if (empty($legacyPlugin) || !isset($legacyPlugin->multiple_authors) || !Utils::is_post_type_enabled()) { - return $post; - } - - global $authordata; - - $authors = get_multiple_authors($post); - - if (empty($authors)) { - return $post; - } - - $firstAuthor = $authors[0]; - - if (!empty($authordata)) { - $authordata->display_name = $firstAuthor->display_name; - $authordata->ID = $firstAuthor->ID; - $authordata->user_nicename = $firstAuthor->user_nicename; - } - - return $post; - } - /** * Get matching authors based on a search value */ From 0ff8617e1054411f80015d72f2b5e9d22321d6f8 Mon Sep 17 00:00:00 2001 From: Anderson Grudtner Martins Date: Wed, 21 Jul 2021 13:54:45 -0300 Subject: [PATCH 2/8] Update the changelog --- readme.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/readme.txt b/readme.txt index fc054ea0..ef7ddda3 100644 --- a/readme.txt +++ b/readme.txt @@ -114,6 +114,10 @@ There are two ways to install the PublishPress Authors plugin: == Changelog == += [3.14.2] - 21 July 2021 = + +* Fixed: Fix error on block editor for posts with guest authors, #463; + = [3.14.1] - 20 July 2021 = * Changed: Invert position of Edit User and Edit Author Profile links in the term actions, #453; From fc222332ade9b11d2fe2daedcc9c1630f15513aa Mon Sep 17 00:00:00 2001 From: Anderson Grudtner Martins Date: Wed, 21 Jul 2021 14:00:56 -0300 Subject: [PATCH 3/8] Preparing to release v3.14.2 --- composer.json | 4 ++-- defines.php | 2 +- publishpress-authors.php | 2 +- readme.txt | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.json b/composer.json index 4889523b..adf6eb92 100644 --- a/composer.json +++ b/composer.json @@ -42,7 +42,7 @@ } ], "dist": { - "url": "https://github.com/publishpress/PublishPress-Authors/releases/download/v3.14.1/publishpress-authors-3.14.1.zip", + "url": "https://github.com/publishpress/PublishPress-Authors/releases/download/v3.14.2/publishpress-authors-3.14.2.zip", "type": "zip" }, "require": { @@ -73,4 +73,4 @@ "mess-check": "vendor/bin/phpmd ./src ansi phpmd-ruleset.xml", "copy-check": "vendor/bin/phpcpd --fuzzy ./src" } -} +} \ No newline at end of file diff --git a/defines.php b/defines.php index 86de9f36..cc0ce889 100644 --- a/defines.php +++ b/defines.php @@ -12,7 +12,7 @@ defined('ABSPATH') or die('No direct script access allowed.'); if (!defined('PP_AUTHORS_VERSION')) { - define('PP_AUTHORS_VERSION', '3.14.1'); + define('PP_AUTHORS_VERSION', '3.14.2'); define('PP_AUTHORS_FILE', 'publishpress-authors/publishpress-authors.php'); define('PP_AUTHORS_BASE_PATH', plugin_dir_path(__DIR__ . '/publishpress-authors.php')); define('PP_AUTHORS_MODULES_PATH', PP_AUTHORS_BASE_PATH . 'src/modules/'); diff --git a/publishpress-authors.php b/publishpress-authors.php index 016457cb..81d7a12e 100644 --- a/publishpress-authors.php +++ b/publishpress-authors.php @@ -5,7 +5,7 @@ * Description: PublishPress Authors allows you to add multiple authors and guest authors to WordPress posts * Author: PublishPress * Author URI: https://publishpress.com - * Version: 3.14.1 + * Version: 3.14.2 * Text Domain: publishpress-authors * * ------------------------------------------------------------------------------ diff --git a/readme.txt b/readme.txt index ef7ddda3..13462ff2 100644 --- a/readme.txt +++ b/readme.txt @@ -7,7 +7,7 @@ Tags: multiple authors, authors, guest authors, author fields, author layouts Requires at least: 4.7 Requires PHP: 5.6 Tested up to: 5.7 -Stable tag: 3.14.1 +Stable tag: 3.14.2 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html From 5aee27bfc4c56e3efbf054129c231a098a8f5602 Mon Sep 17 00:00:00 2001 From: Anderson Grudtner Martins Date: Wed, 21 Jul 2021 15:55:47 -0300 Subject: [PATCH 4/8] Add acceptance tests config file --- .gitignore | 5 ----- tests/acceptance.suite.yml | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 5 deletions(-) create mode 100644 tests/acceptance.suite.yml diff --git a/.gitignore b/.gitignore index 8c1dd5a5..e62bda16 100644 --- a/.gitignore +++ b/.gitignore @@ -16,11 +16,6 @@ Thumbs.db /vendor /packages -codeception.yml -tests/acceptance.suite.yml -tests/functional.suite.yml -tests/unit.suite.yml -tests/wpunit.suite.yml .svn .git diff --git a/tests/acceptance.suite.yml b/tests/acceptance.suite.yml new file mode 100644 index 00000000..bcdf6683 --- /dev/null +++ b/tests/acceptance.suite.yml @@ -0,0 +1,37 @@ +actor: AcceptanceTester +modules: + enabled: + - WPDb + - WPWebDriver + - \Helper\Acceptance + config: + WPDb: + dsn: "mysql:%TEST_SITE_DB_DSN_PREFIX%=%TEST_SITE_DB_HOST%;dbname=%TEST_SITE_DB_NAME%" + user: "%TEST_DB_USER%" + password: "%TEST_DB_PASSWORD%" + dump: "tests/_data/dump.sql" + populate: true #import the dump before the tests + cleanup: false #import the dump between tests + url: "%TEST_SITE_WP_URL%" + urlReplacement: true #replace the hardcoded dump URL with the one above + tablePrefix: "%TEST_TABLE_PREFIX%" + WPBrowser: + url: "%TEST_SITE_WP_URL%" + adminUsername: "%TEST_SITE_ADMIN_USERNAME%" + adminPassword: "%TEST_SITE_ADMIN_PASSWORD%" + adminPath: "%TEST_SITE_WP_ADMIN_PATH%" + WPWebDriver: + url: "%TEST_SITE_WP_URL%" + adminUsername: "%TEST_SITE_ADMIN_USERNAME%" + adminPassword: "%TEST_SITE_ADMIN_PASSWORD%" + adminPath: "%TEST_SITE_WP_ADMIN_PATH%" + browser: chrome + restart: true + window_size: false + port: 9515 + capabilities: + browserName: chrome + chromeOptions: + args: [ "--headless", "--disable-gpu" ] + prefs: + download.default_directory: "..." From 32e89056ca0fa922cdfd1a0944adf3a1edfe9434 Mon Sep 17 00:00:00 2001 From: Anderson Grudtner Martins Date: Wed, 21 Jul 2021 16:14:16 -0300 Subject: [PATCH 5/8] Install tests dependency --- composer.json | 5 +- composer.lock | 160 ++++++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 144 insertions(+), 21 deletions(-) diff --git a/composer.json b/composer.json index adf6eb92..d17122a5 100644 --- a/composer.json +++ b/composer.json @@ -63,7 +63,8 @@ "phpmd/phpmd": "^2.8", "squizlabs/php_codesniffer": "^3.5", "sebastian/phpcpd": "^5.0", - "overtrue/phplint": "^2.1" + "overtrue/phplint": "^2.1", + "codeception/module-webdriver": "^1.2" }, "scripts": { "cs-check": "vendor/bin/phpcs --standard=PSR12 ./src/ publishpress-authors.php --colors", @@ -73,4 +74,4 @@ "mess-check": "vendor/bin/phpmd ./src ansi phpmd-ruleset.xml", "copy-check": "vendor/bin/phpcpd --fuzzy ./src" } -} \ No newline at end of file +} diff --git a/composer.lock b/composer.lock index 09ad5859..e9ab6acf 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": "3754fba4417254147f6715c1ba325718", + "content-hash": "f67ac0b5986037a6995b617ecf6627aa", "packages": [ { "name": "pimple/pimple", @@ -798,6 +798,62 @@ }, "time": "2020-10-24T15:29:28+00:00" }, + { + "name": "codeception/module-webdriver", + "version": "1.2.1", + "source": { + "type": "git", + "url": "https://github.com/Codeception/module-webdriver.git", + "reference": "ebbe729c630415e8caf6b0087e457906f0c6c0c6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Codeception/module-webdriver/zipball/ebbe729c630415e8caf6b0087e457906f0c6c0c6", + "reference": "ebbe729c630415e8caf6b0087e457906f0c6c0c6", + "shasum": "" + }, + "require": { + "codeception/codeception": "^4.0", + "php": ">=5.6.0 <9.0", + "php-webdriver/webdriver": "^1.8.0" + }, + "suggest": { + "codeception/phpbuiltinserver": "Start and stop PHP built-in web server for your tests" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Bodnarchuk" + }, + { + "name": "Gintautas Miselis" + }, + { + "name": "Zaahid Bateson" + } + ], + "description": "WebDriver module for Codeception", + "homepage": "http://codeception.com/", + "keywords": [ + "acceptance-testing", + "browser-testing", + "codeception" + ], + "support": { + "issues": "https://github.com/Codeception/module-webdriver/issues", + "source": "https://github.com/Codeception/module-webdriver/tree/1.2.1" + }, + "time": "2021-04-23T17:30:57+00:00" + }, { "name": "codeception/phpunit-wrapper", "version": "9.0.6", @@ -2003,16 +2059,16 @@ }, { "name": "illuminate/collections", - "version": "v8.50.0", + "version": "v8.51.0", "source": { "type": "git", "url": "https://github.com/illuminate/collections.git", - "reference": "f9311a35779750f38bed47456c031c4dc4962274" + "reference": "7942bc71aca503d2f2721469c650fce38b1058e3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/collections/zipball/f9311a35779750f38bed47456c031c4dc4962274", - "reference": "f9311a35779750f38bed47456c031c4dc4962274", + "url": "https://api.github.com/repos/illuminate/collections/zipball/7942bc71aca503d2f2721469c650fce38b1058e3", + "reference": "7942bc71aca503d2f2721469c650fce38b1058e3", "shasum": "" }, "require": { @@ -2053,11 +2109,11 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2021-06-28T13:56:26+00:00" + "time": "2021-07-15T14:07:19+00:00" }, { "name": "illuminate/contracts", - "version": "v8.50.0", + "version": "v8.51.0", "source": { "type": "git", "url": "https://github.com/illuminate/contracts.git", @@ -2105,7 +2161,7 @@ }, { "name": "illuminate/macroable", - "version": "v8.50.0", + "version": "v8.51.0", "source": { "type": "git", "url": "https://github.com/illuminate/macroable.git", @@ -2151,16 +2207,16 @@ }, { "name": "illuminate/support", - "version": "v8.50.0", + "version": "v8.51.0", "source": { "type": "git", "url": "https://github.com/illuminate/support.git", - "reference": "383e46e8942402503b381c4994a968a8ee642087" + "reference": "ee397b851a411ad490363a47df7476a24f93ca2e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/support/zipball/383e46e8942402503b381c4994a968a8ee642087", - "reference": "383e46e8942402503b381c4994a968a8ee642087", + "url": "https://api.github.com/repos/illuminate/support/zipball/ee397b851a411ad490363a47df7476a24f93ca2e", + "reference": "ee397b851a411ad490363a47df7476a24f93ca2e", "shasum": "" }, "require": { @@ -2215,7 +2271,7 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2021-07-09T13:40:46+00:00" + "time": "2021-07-16T12:34:54+00:00" }, { "name": "league/container", @@ -2934,16 +2990,16 @@ }, { "name": "pdepend/pdepend", - "version": "2.9.1", + "version": "2.10.0", "source": { "type": "git", "url": "https://github.com/pdepend/pdepend.git", - "reference": "1632f0cee84512ffd6dde71e58536b3b06528c41" + "reference": "1fd30f4352b630ad53fec3fd5e8b8ba760f85596" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/pdepend/pdepend/zipball/1632f0cee84512ffd6dde71e58536b3b06528c41", - "reference": "1632f0cee84512ffd6dde71e58536b3b06528c41", + "url": "https://api.github.com/repos/pdepend/pdepend/zipball/1fd30f4352b630ad53fec3fd5e8b8ba760f85596", + "reference": "1fd30f4352b630ad53fec3fd5e8b8ba760f85596", "shasum": "" }, "require": { @@ -2979,7 +3035,7 @@ "description": "Official version of pdepend to be handled with Composer", "support": { "issues": "https://github.com/pdepend/pdepend/issues", - "source": "https://github.com/pdepend/pdepend/tree/2.9.1" + "source": "https://github.com/pdepend/pdepend/tree/2.10.0" }, "funding": [ { @@ -2987,7 +3043,7 @@ "type": "tidelift" } ], - "time": "2021-04-15T21:36:28+00:00" + "time": "2021-07-20T09:56:09+00:00" }, { "name": "phar-io/manifest", @@ -3099,6 +3155,72 @@ }, "time": "2018-07-08T19:19:57+00:00" }, + { + "name": "php-webdriver/webdriver", + "version": "1.11.1", + "source": { + "type": "git", + "url": "https://github.com/php-webdriver/php-webdriver.git", + "reference": "da16e39968f8dd5cfb7d07eef91dc2b731c69880" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-webdriver/php-webdriver/zipball/da16e39968f8dd5cfb7d07eef91dc2b731c69880", + "reference": "da16e39968f8dd5cfb7d07eef91dc2b731c69880", + "shasum": "" + }, + "require": { + "ext-curl": "*", + "ext-json": "*", + "ext-zip": "*", + "php": "^5.6 || ~7.0 || ^8.0", + "symfony/polyfill-mbstring": "^1.12", + "symfony/process": "^2.8 || ^3.1 || ^4.0 || ^5.0" + }, + "replace": { + "facebook/webdriver": "*" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.0", + "ondram/ci-detector": "^2.1 || ^3.5 || ^4.0", + "php-coveralls/php-coveralls": "^2.4", + "php-mock/php-mock-phpunit": "^1.1 || ^2.0", + "php-parallel-lint/php-parallel-lint": "^1.2", + "phpunit/phpunit": "^5.7 || ^7 || ^8 || ^9", + "squizlabs/php_codesniffer": "^3.5", + "symfony/var-dumper": "^3.3 || ^4.0 || ^5.0" + }, + "suggest": { + "ext-SimpleXML": "For Firefox profile creation" + }, + "type": "library", + "autoload": { + "psr-4": { + "Facebook\\WebDriver\\": "lib/" + }, + "files": [ + "lib/Exception/TimeoutException.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "A PHP client for Selenium WebDriver. Previously facebook/webdriver.", + "homepage": "https://github.com/php-webdriver/php-webdriver", + "keywords": [ + "Chromedriver", + "geckodriver", + "php", + "selenium", + "webdriver" + ], + "support": { + "issues": "https://github.com/php-webdriver/php-webdriver/issues", + "source": "https://github.com/php-webdriver/php-webdriver/tree/1.11.1" + }, + "time": "2021-05-21T15:12:49+00:00" + }, { "name": "phpdocumentor/reflection-common", "version": "2.2.0", From 1fd311ce7023e4061f45e471ee42135097d274fc Mon Sep 17 00:00:00 2001 From: Anderson Grudtner Martins Date: Wed, 21 Jul 2021 16:16:28 -0300 Subject: [PATCH 6/8] Update the env file with unix_socket example --- .env.testing.dist | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.env.testing.dist b/.env.testing.dist index 94861c4a..822014f1 100644 --- a/.env.testing.dist +++ b/.env.testing.dist @@ -1,13 +1,13 @@ WP_ROOT_FOLDER="/Users/anderson/Local Sites/tests/app/public/" TEST_SITE_WP_ADMIN_PATH="/wp-admin" TEST_SITE_DB_NAME="local" -TEST_SITE_DB_DSN_PREFIX="host" -TEST_SITE_DB_HOST=":/Users/anderson/Library/Application Support/Local/run/vMY-HAzR7/mysql/mysqld.sock" +TEST_SITE_DB_DSN_PREFIX="unix_socket" +TEST_SITE_DB_HOST="/Users/anderson/Library/Application Support/Local/run/MS_83oTyx/mysql/mysqld.sock" TEST_SITE_DB_USER="root" TEST_SITE_DB_PASSWORD="root" TEST_SITE_TABLE_PREFIX="wp_" TEST_DB_NAME="local" -TEST_DB_HOST=":/Users/anderson/Library/Application Support/Local/run/vMY-HAzR7/mysql/mysqld.sock" +TEST_DB_HOST=":/Users/anderson/Library/Application Support/Local/run/MS_83oTyx/mysql/mysqld.sock" TEST_DB_USER="root" TEST_DB_PASSWORD="root" TEST_TABLE_PREFIX="wp_" From 26a1a4e6043d1c2f03448122064991a64c52b87d Mon Sep 17 00:00:00 2001 From: Anderson Grudtner Martins Date: Wed, 21 Jul 2021 16:38:31 -0300 Subject: [PATCH 7/8] Update the codecept tests --- .env.testing.dist | 36 +++---- composer.json | 11 +- composer.lock | 101 +++++++++++++++++- tests/_support/FunctionalTester.php | 26 +++++ tests/_support/Helper/Functional.php | 10 ++ tests/_support/Helper/Unit.php | 7 +- tests/_support/UnitTester.php | 6 +- tests/acceptance.suite.yml | 39 ++++--- tests/functional.suite.yml | 40 +++++++ tests/unit.suite.yml | 10 ++ ...integration.suite.yml => wpunit.suite.yml} | 4 +- tests/{integration => wpunit}/bootstrap.php | 0 .../core/Classes/Author_UtilsCest.php | 0 .../core/Classes/InstallerCest.php | 0 .../core/Classes/Legacy/UtilCest.php | 0 .../core/Classes/Objects/AuthorCest.php | 0 .../functions/get_multiple_authorsCest.php | 0 .../is_multiple_author_for_postCest.php | 0 .../multiple_authors/MultipleAuthorsCest.php | 0 .../wordpress/feed_links_extraCest.php | 0 .../wordpress/get_author_feed_linkCest.php | 0 .../wordpress/get_author_posts_urlCest.php | 0 .../wordpress/get_avatar_urlCest.php | 0 .../wordpress/get_the_authorCest.php | 0 .../wordpress/get_the_author_metaCest.php | 0 .../get_the_author_posts_linkCest.php | 0 .../wordpress/the_postCest.php | 0 27 files changed, 245 insertions(+), 45 deletions(-) create mode 100644 tests/_support/FunctionalTester.php create mode 100644 tests/_support/Helper/Functional.php create mode 100644 tests/functional.suite.yml create mode 100644 tests/unit.suite.yml rename tests/{integration.suite.yml => wpunit.suite.yml} (81%) rename tests/{integration => wpunit}/bootstrap.php (100%) rename tests/{integration => wpunit}/core/Classes/Author_UtilsCest.php (100%) rename tests/{integration => wpunit}/core/Classes/InstallerCest.php (100%) rename tests/{integration => wpunit}/core/Classes/Legacy/UtilCest.php (100%) rename tests/{integration => wpunit}/core/Classes/Objects/AuthorCest.php (100%) rename tests/{integration => wpunit}/core/functions/get_multiple_authorsCest.php (100%) rename tests/{integration => wpunit}/core/functions/is_multiple_author_for_postCest.php (100%) rename tests/{integration => wpunit}/modules/multiple_authors/MultipleAuthorsCest.php (100%) rename tests/{integration => wpunit}/wordpress/feed_links_extraCest.php (100%) rename tests/{integration => wpunit}/wordpress/get_author_feed_linkCest.php (100%) rename tests/{integration => wpunit}/wordpress/get_author_posts_urlCest.php (100%) rename tests/{integration => wpunit}/wordpress/get_avatar_urlCest.php (100%) rename tests/{integration => wpunit}/wordpress/get_the_authorCest.php (100%) rename tests/{integration => wpunit}/wordpress/get_the_author_metaCest.php (100%) rename tests/{integration => wpunit}/wordpress/get_the_author_posts_linkCest.php (100%) rename tests/{integration => wpunit}/wordpress/the_postCest.php (100%) diff --git a/.env.testing.dist b/.env.testing.dist index 822014f1..479c4a41 100644 --- a/.env.testing.dist +++ b/.env.testing.dist @@ -1,19 +1,19 @@ -WP_ROOT_FOLDER="/Users/anderson/Local Sites/tests/app/public/" -TEST_SITE_WP_ADMIN_PATH="/wp-admin" -TEST_SITE_DB_NAME="local" -TEST_SITE_DB_DSN_PREFIX="unix_socket" -TEST_SITE_DB_HOST="/Users/anderson/Library/Application Support/Local/run/MS_83oTyx/mysql/mysqld.sock" -TEST_SITE_DB_USER="root" -TEST_SITE_DB_PASSWORD="root" -TEST_SITE_TABLE_PREFIX="wp_" -TEST_DB_NAME="local" -TEST_DB_HOST=":/Users/anderson/Library/Application Support/Local/run/MS_83oTyx/mysql/mysqld.sock" -TEST_DB_USER="root" -TEST_DB_PASSWORD="root" -TEST_TABLE_PREFIX="wp_" -TEST_SITE_WP_URL="https://tests.local" -TEST_SITE_WP_DOMAIN="tests.local" -TEST_SITE_ADMIN_EMAIL="anderson@publishpress.com" -TEST_SITE_ADMIN_USERNAME="admin" -TEST_SITE_ADMIN_PASSWORD="admin" +TEST_SITE_DB_DSN=mysql:unix_socket=/Users/anderson/Library/Application Support/Local/run/MS_83oTyx/mysql/mysqld.sock;dbname=ui_tests +TEST_SITE_DB_HOST=localhost:/Users/anderson/Library/Application\ Support/Local/run/MS_83oTyx/mysql/mysqld.sock +TEST_SITE_DB_NAME=ui_tests +TEST_SITE_DB_USER=root +TEST_SITE_DB_PASSWORD=root +TEST_SITE_TABLE_PREFIX=wp_ +TEST_SITE_ADMIN_USERNAME=admin +TEST_SITE_ADMIN_PASSWORD=admin +TEST_SITE_WP_ADMIN_PATH=/wp-admin +WP_ROOT_FOLDER=/Users/anderson/Local/\ Sites/tests/app/public/ +TEST_DB_NAME=local +TEST_DB_HOST=localhost:/Users/anderson/Library/Application\ Support/Local/run/MS_83oTyx/mysql/mysqld.sock +TEST_DB_USER=root +TEST_DB_PASSWORD=root +TEST_TABLE_PREFIX=wp_ +TEST_SITE_WP_URL=https://tests.local +TEST_SITE_WP_DOMAIN=tests.local +TEST_SITE_ADMIN_EMAIL=admin@tests.local PUBLISHPRESS_API_URL="https://publishpress.com" diff --git a/composer.json b/composer.json index d17122a5..de049989 100644 --- a/composer.json +++ b/composer.json @@ -55,16 +55,18 @@ }, "require-dev": { "lucatume/wp-browser": "^3", - "codeception/module-asserts": "^1.3", + "codeception/module-asserts": "^1.0", "codeception/module-phpbrowser": "^1.0", + "codeception/module-webdriver": "^1.0", "codeception/module-db": "^1.0", + "codeception/module-filesystem": "^1.0", + "codeception/module-cli": "^1.0", "codeception/util-universalframework": "^1.0", "publishpress/publishpress-plugin-builder": "^1.2", "phpmd/phpmd": "^2.8", "squizlabs/php_codesniffer": "^3.5", "sebastian/phpcpd": "^5.0", - "overtrue/phplint": "^2.1", - "codeception/module-webdriver": "^1.2" + "overtrue/phplint": "^2.1" }, "scripts": { "cs-check": "vendor/bin/phpcs --standard=PSR12 ./src/ publishpress-authors.php --colors", @@ -72,6 +74,7 @@ "build": "vendor/bin/robo build --ansi", "build-unpacked": "vendor/bin/robo build:unpacked --ansi", "mess-check": "vendor/bin/phpmd ./src ansi phpmd-ruleset.xml", - "copy-check": "vendor/bin/phpcpd --fuzzy ./src" + "copy-check": "vendor/bin/phpcpd --fuzzy ./src", + "start-chromedriver": "chromedriver --url-base=wd/hub" } } diff --git a/composer.lock b/composer.lock index e9ab6acf..7068f224 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": "f67ac0b5986037a6995b617ecf6627aa", + "content-hash": "c5950be804846750ea805f6af1a0c0a3", "packages": [ { "name": "pimple/pimple", @@ -686,6 +686,53 @@ }, "time": "2020-10-21T16:48:15+00:00" }, + { + "name": "codeception/module-cli", + "version": "1.1.1", + "source": { + "type": "git", + "url": "https://github.com/Codeception/module-cli.git", + "reference": "1f841ad4a1d43e5d9e60a43c4cc9e5af8008024f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Codeception/module-cli/zipball/1f841ad4a1d43e5d9e60a43c4cc9e5af8008024f", + "reference": "1f841ad4a1d43e5d9e60a43c4cc9e5af8008024f", + "shasum": "" + }, + "require": { + "codeception/codeception": "*@dev", + "php": ">=5.6.0 <9.0" + }, + "conflict": { + "codeception/codeception": "<4.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Bodnarchuk" + } + ], + "description": "Codeception module for testing basic shell commands and shell output", + "homepage": "http://codeception.com/", + "keywords": [ + "codeception" + ], + "support": { + "issues": "https://github.com/Codeception/module-cli/issues", + "source": "https://github.com/Codeception/module-cli/tree/1.1.1" + }, + "time": "2020-12-26T16:56:19+00:00" + }, { "name": "codeception/module-db", "version": "1.1.0", @@ -738,6 +785,58 @@ }, "time": "2020-12-20T13:37:07+00:00" }, + { + "name": "codeception/module-filesystem", + "version": "1.0.3", + "source": { + "type": "git", + "url": "https://github.com/Codeception/module-filesystem.git", + "reference": "781be167fb1557bfc9b61e0a4eac60a32c534ec1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Codeception/module-filesystem/zipball/781be167fb1557bfc9b61e0a4eac60a32c534ec1", + "reference": "781be167fb1557bfc9b61e0a4eac60a32c534ec1", + "shasum": "" + }, + "require": { + "codeception/codeception": "^4.0", + "php": ">=5.6.0 <9.0", + "symfony/finder": ">=2.7 <6.0" + }, + "conflict": { + "codeception/codeception": "<4.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Bodnarchuk" + }, + { + "name": "Gintautas Miselis" + } + ], + "description": "Codeception module for testing local filesystem", + "homepage": "http://codeception.com/", + "keywords": [ + "codeception", + "filesystem" + ], + "support": { + "issues": "https://github.com/Codeception/module-filesystem/issues", + "source": "https://github.com/Codeception/module-filesystem/tree/1.0.3" + }, + "time": "2020-10-24T14:46:40+00:00" + }, { "name": "codeception/module-phpbrowser", "version": "1.0.2", diff --git a/tests/_support/FunctionalTester.php b/tests/_support/FunctionalTester.php new file mode 100644 index 00000000..f7bb0cd3 --- /dev/null +++ b/tests/_support/FunctionalTester.php @@ -0,0 +1,26 @@ + Date: Wed, 21 Jul 2021 16:41:25 -0300 Subject: [PATCH 8/8] Update the tests config --- .env.testing.dist | 36 ++++++++++++++++++------------------ tests/wpunit.suite.yml | 4 ++-- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/.env.testing.dist b/.env.testing.dist index 479c4a41..d6f27023 100644 --- a/.env.testing.dist +++ b/.env.testing.dist @@ -1,19 +1,19 @@ -TEST_SITE_DB_DSN=mysql:unix_socket=/Users/anderson/Library/Application Support/Local/run/MS_83oTyx/mysql/mysqld.sock;dbname=ui_tests -TEST_SITE_DB_HOST=localhost:/Users/anderson/Library/Application\ Support/Local/run/MS_83oTyx/mysql/mysqld.sock -TEST_SITE_DB_NAME=ui_tests -TEST_SITE_DB_USER=root -TEST_SITE_DB_PASSWORD=root -TEST_SITE_TABLE_PREFIX=wp_ -TEST_SITE_ADMIN_USERNAME=admin -TEST_SITE_ADMIN_PASSWORD=admin -TEST_SITE_WP_ADMIN_PATH=/wp-admin -WP_ROOT_FOLDER=/Users/anderson/Local/\ Sites/tests/app/public/ -TEST_DB_NAME=local -TEST_DB_HOST=localhost:/Users/anderson/Library/Application\ Support/Local/run/MS_83oTyx/mysql/mysqld.sock -TEST_DB_USER=root -TEST_DB_PASSWORD=root -TEST_TABLE_PREFIX=wp_ -TEST_SITE_WP_URL=https://tests.local -TEST_SITE_WP_DOMAIN=tests.local -TEST_SITE_ADMIN_EMAIL=admin@tests.local +TEST_SITE_DB_DSN="mysql:unix_socket=/Users/anderson/Library/Application Support/Local/run/MS_83oTyx/mysql/mysqld.sock;dbname=ui_tests" +TEST_SITE_DB_HOST="localhost:/Users/anderson/Library/Application Support/Local/run/MS_83oTyx/mysql/mysqld.sock" +TEST_SITE_DB_NAME="ui_tests" +TEST_SITE_DB_USER="root" +TEST_SITE_DB_PASSWORD="root" +TEST_SITE_TABLE_PREFIX="wp_" +TEST_SITE_ADMIN_USERNAME="admin" +TEST_SITE_ADMIN_PASSWORD="admin" +TEST_SITE_WP_ADMIN_PATH="/wp-admin" +WP_ROOT_FOLDER="/Users/anderson/Local Sites/tests/app/public/" +TEST_DB_NAME="local" +TEST_DB_HOST="localhost:/Users/anderson/Library/Application Support/Local/run/MS_83oTyx/mysql/mysqld.sock" +TEST_DB_USER="root" +TEST_DB_PASSWORD="root" +TEST_TABLE_PREFIX="wp_" +TEST_SITE_WP_URL="https://tests.local" +TEST_SITE_WP_DOMAIN="tests.local" +TEST_SITE_ADMIN_EMAIL="admin@tests.local" PUBLISHPRESS_API_URL="https://publishpress.com" diff --git a/tests/wpunit.suite.yml b/tests/wpunit.suite.yml index 61dd505b..46d942a9 100644 --- a/tests/wpunit.suite.yml +++ b/tests/wpunit.suite.yml @@ -19,8 +19,8 @@ modules: domain: "%TEST_SITE_WP_DOMAIN%" adminEmail: "%TEST_SITE_ADMIN_EMAIL%" title: "Test" - plugins: [ 'publishpress-authors/publishpress-authors.php' ] - activatePlugins: [ 'publishpress-authors/publishpress-authors.php' ] + plugins: ["publishpress-authors/publishpress-authors.php"] + activatePlugins: ["publishpress-authors/publishpress-authors.php"] isolatedInstall: true bootstrap: bootstrap.php