From 3adeb832bd8f49c6dc904d69b7ff5ef6e4929cb8 Mon Sep 17 00:00:00 2001 From: Alex Kirk Date: Tue, 3 Dec 2024 15:58:49 +0100 Subject: [PATCH 01/14] Add unit tests --- .gitignore | 3 +- .phpunit.result.cache | 1 + bin/install-wp-tests.sh | 181 ++ composer.json | 9 +- composer.lock | 2620 ++++++++++++++--- inc/class-anniversary.php | 106 +- inc/class-consistency.php | 82 +- inc/class-first-translation.php | 20 +- inc/class-inactive.php | 55 +- inc/class-notification.php | 4 + inc/class-plugin.php | 9 + inc/class-translation-milestone.php | 19 +- phpunit.xml.dist | 18 + tests/bootstrap.php | 50 + tests/test-anniversary.php | 27 + tests/test-consistency.php | 5 + tests/test-first-translation.php | 4 + tests/test-inactive.php | 5 + tests/test-translation-milestone.php | 5 + .../autoload/class-autoloader.php | 93 + 20 files changed, 2727 insertions(+), 589 deletions(-) create mode 100644 .phpunit.result.cache create mode 100755 bin/install-wp-tests.sh create mode 100644 phpunit.xml.dist create mode 100644 tests/bootstrap.php create mode 100644 tests/test-anniversary.php create mode 100644 tests/test-consistency.php create mode 100644 tests/test-first-translation.php create mode 100644 tests/test-inactive.php create mode 100644 tests/test-translation-milestone.php create mode 100644 vendor/wordpressdotorg/autoload/class-autoloader.php diff --git a/.gitignore b/.gitignore index 49ce3c1..58be7c7 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -/vendor \ No newline at end of file +vendor +.phpunit.result.cache diff --git a/.phpunit.result.cache b/.phpunit.result.cache new file mode 100644 index 0000000..c08d6fa --- /dev/null +++ b/.phpunit.result.cache @@ -0,0 +1 @@ +{"version":1,"defects":{"WordPressdotorg\\GlotPress\\Engagement\\Anniversary_Test::test_anniversary":3},"times":{"WordPressdotorg\\GlotPress\\Engagement\\Anniversary_Test::test_anniversary":0.021}} \ No newline at end of file diff --git a/bin/install-wp-tests.sh b/bin/install-wp-tests.sh new file mode 100755 index 0000000..1c036e2 --- /dev/null +++ b/bin/install-wp-tests.sh @@ -0,0 +1,181 @@ +#!/usr/bin/env bash + +if [ $# -lt 3 ]; then + echo "usage: $0 [db-host] [wp-version] [skip-database-creation]" + exit 1 +fi + +DB_NAME=$1 +DB_USER=$2 +DB_PASS=$3 +DB_HOST=${4-localhost} +WP_VERSION=${5-latest} +SKIP_DB_CREATE=${6-false} + +TMPDIR=${TMPDIR-/tmp} +TMPDIR=$(echo $TMPDIR | sed -e "s/\/$//") +WP_TESTS_DIR=${WP_TESTS_DIR-$TMPDIR/wordpress-tests-lib} +WP_CORE_DIR=${WP_CORE_DIR-$TMPDIR/wordpress} + +download() { + if [ `which curl` ]; then + curl -s "$1" > "$2"; + elif [ `which wget` ]; then + wget -nv -O "$2" "$1" + fi +} + +if [[ $WP_VERSION =~ ^[0-9]+\.[0-9]+\-(beta|RC)[0-9]+$ ]]; then + WP_BRANCH=${WP_VERSION%\-*} + WP_TESTS_TAG="branches/$WP_BRANCH" + +elif [[ $WP_VERSION =~ ^[0-9]+\.[0-9]+$ ]]; then + WP_TESTS_TAG="branches/$WP_VERSION" +elif [[ $WP_VERSION =~ [0-9]+\.[0-9]+\.[0-9]+ ]]; then + if [[ $WP_VERSION =~ [0-9]+\.[0-9]+\.[0] ]]; then + # version x.x.0 means the first release of the major version, so strip off the .0 and download version x.x + WP_TESTS_TAG="tags/${WP_VERSION%??}" + else + WP_TESTS_TAG="tags/$WP_VERSION" + fi +elif [[ $WP_VERSION == 'nightly' || $WP_VERSION == 'trunk' ]]; then + WP_TESTS_TAG="trunk" +else + # http serves a single offer, whereas https serves multiple. we only want one + download http://api.wordpress.org/core/version-check/1.7/ /tmp/wp-latest.json + grep '[0-9]+\.[0-9]+(\.[0-9]+)?' /tmp/wp-latest.json + LATEST_VERSION=$(grep -o '"version":"[^"]*' /tmp/wp-latest.json | sed 's/"version":"//') + if [[ -z "$LATEST_VERSION" ]]; then + echo "Latest WordPress version could not be found" + exit 1 + fi + WP_TESTS_TAG="tags/$LATEST_VERSION" +fi +set -ex + +install_wp() { + + if [ -d $WP_CORE_DIR ]; then + return; + fi + + mkdir -p $WP_CORE_DIR + + if [[ $WP_VERSION == 'nightly' || $WP_VERSION == 'trunk' ]]; then + mkdir -p $TMPDIR/wordpress-trunk + rm -rf $TMPDIR/wordpress-trunk/* + svn export --quiet https://core.svn.wordpress.org/trunk $TMPDIR/wordpress-trunk/wordpress + mv $TMPDIR/wordpress-trunk/wordpress/* $WP_CORE_DIR + else + if [ $WP_VERSION == 'latest' ]; then + local ARCHIVE_NAME='latest' + elif [[ $WP_VERSION =~ [0-9]+\.[0-9]+ ]]; then + # https serves multiple offers, whereas http serves single. + download https://api.wordpress.org/core/version-check/1.7/ $TMPDIR/wp-latest.json + if [[ $WP_VERSION =~ [0-9]+\.[0-9]+\.[0] ]]; then + # version x.x.0 means the first release of the major version, so strip off the .0 and download version x.x + LATEST_VERSION=${WP_VERSION%??} + else + # otherwise, scan the releases and get the most up to date minor version of the major release + local VERSION_ESCAPED=`echo $WP_VERSION | sed 's/\./\\\\./g'` + LATEST_VERSION=$(grep -o '"version":"'$VERSION_ESCAPED'[^"]*' $TMPDIR/wp-latest.json | sed 's/"version":"//' | head -1) + fi + if [[ -z "$LATEST_VERSION" ]]; then + local ARCHIVE_NAME="wordpress-$WP_VERSION" + else + local ARCHIVE_NAME="wordpress-$LATEST_VERSION" + fi + else + local ARCHIVE_NAME="wordpress-$WP_VERSION" + fi + download https://wordpress.org/${ARCHIVE_NAME}.tar.gz $TMPDIR/wordpress.tar.gz + tar --strip-components=1 -zxmf $TMPDIR/wordpress.tar.gz -C $WP_CORE_DIR + fi + + download https://raw.github.com/markoheijnen/wp-mysqli/master/db.php $WP_CORE_DIR/wp-content/db.php +} + +install_test_suite() { + # portable in-place argument for both GNU sed and Mac OSX sed + if [[ $(uname -s) == 'Darwin' ]]; then + local ioption='-i.bak' + else + local ioption='-i' + fi + + # set up testing suite if it doesn't yet exist + if [ ! -d $WP_TESTS_DIR ]; then + # set up testing suite + mkdir -p $WP_TESTS_DIR + rm -rf $WP_TESTS_DIR/{includes,data} + svn export --quiet --ignore-externals https://develop.svn.wordpress.org/${WP_TESTS_TAG}/tests/phpunit/includes/ $WP_TESTS_DIR/includes + svn export --quiet --ignore-externals https://develop.svn.wordpress.org/${WP_TESTS_TAG}/tests/phpunit/data/ $WP_TESTS_DIR/data + fi + + if [ ! -f "$WP_TESTS_DIR"/wp-tests-config.php ]; then + download https://develop.svn.wordpress.org/${WP_TESTS_TAG}/wp-tests-config-sample.php "$WP_TESTS_DIR"/wp-tests-config.php + # remove all forward slashes in the end + WP_CORE_DIR=$(echo $WP_CORE_DIR | sed "s:/\+$::") + sed $ioption "s:dirname( __FILE__ ) . '/src/':'$WP_CORE_DIR/':" "$WP_TESTS_DIR"/wp-tests-config.php + sed $ioption "s:__DIR__ . '/src/':'$WP_CORE_DIR/':" "$WP_TESTS_DIR"/wp-tests-config.php + sed $ioption "s/youremptytestdbnamehere/$DB_NAME/" "$WP_TESTS_DIR"/wp-tests-config.php + sed $ioption "s/yourusernamehere/$DB_USER/" "$WP_TESTS_DIR"/wp-tests-config.php + sed $ioption "s/yourpasswordhere/$DB_PASS/" "$WP_TESTS_DIR"/wp-tests-config.php + sed $ioption "s|localhost|${DB_HOST}|" "$WP_TESTS_DIR"/wp-tests-config.php + fi + +} + +recreate_db() { + shopt -s nocasematch + if [[ $1 =~ ^(y|yes)$ ]] + then + mysqladmin drop $DB_NAME -f --user="$DB_USER" --password="$DB_PASS"$EXTRA + create_db + echo "Recreated the database ($DB_NAME)." + else + echo "Leaving the existing database ($DB_NAME) in place." + fi + shopt -u nocasematch +} + +create_db() { + mysqladmin create $DB_NAME --user="$DB_USER" --password="$DB_PASS"$EXTRA +} + +install_db() { + + if [ ${SKIP_DB_CREATE} = "true" ]; then + return 0 + fi + + # parse DB_HOST for port or socket references + local PARTS=(${DB_HOST//\:/ }) + local DB_HOSTNAME=${PARTS[0]}; + local DB_SOCK_OR_PORT=${PARTS[1]}; + local EXTRA="" + + if ! [ -z $DB_HOSTNAME ] ; then + if [ $(echo $DB_SOCK_OR_PORT | grep -e '^[0-9]\{1,\}$') ]; then + EXTRA=" --host=$DB_HOSTNAME --port=$DB_SOCK_OR_PORT --protocol=tcp" + elif ! [ -z $DB_SOCK_OR_PORT ] ; then + EXTRA=" --socket=$DB_SOCK_OR_PORT" + elif ! [ -z $DB_HOSTNAME ] ; then + EXTRA=" --host=$DB_HOSTNAME --protocol=tcp" + fi + fi + + # create database + if [ $(mysql --user="$DB_USER" --password="$DB_PASS"$EXTRA --execute='show databases;' | grep ^$DB_NAME$) ] + then + echo "Reinstalling will delete the existing test database ($DB_NAME)" + read -p 'Are you sure you want to proceed? [y/N]: ' DELETE_EXISTING_DB + recreate_db $DELETE_EXISTING_DB + else + create_db + fi +} + +install_wp +install_test_suite +install_db diff --git a/composer.json b/composer.json index f5bcd33..f20fc0a 100644 --- a/composer.json +++ b/composer.json @@ -18,10 +18,13 @@ "require-dev" : { "squizlabs/php_codesniffer": "^3.6", "friendsofphp/php-cs-fixer": "^3.0", + "phpunit/phpunit": "^9.6.16", + "yoast/phpunit-polyfills": "^2.0.0", "wp-coding-standards/wpcs": "^3.0" }, "scripts": { - "lint": "phpcs --extensions=php -s -p", - "format": "phpcbf -p" + "lint": "phpcs --standard=phpcs.xml -s", + "format": "phpcbf --standard=phpcs.xml", + "test": "phpunit" } -} \ No newline at end of file +} diff --git a/composer.lock b/composer.lock index a7b330c..13cb748 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": "509023a34072e15c7538d0b81ebc4a3d", + "content-hash": "25b65302fae265651f9444fd96970298", "packages": [], "packages-dev": [ { @@ -73,16 +73,16 @@ }, { "name": "composer/pcre", - "version": "3.3.1", + "version": "3.3.2", "source": { "type": "git", "url": "https://github.com/composer/pcre.git", - "reference": "63aaeac21d7e775ff9bc9d45021e1745c97521c4" + "reference": "b2bed4734f0cc156ee1fe9c0da2550420d99a21e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/pcre/zipball/63aaeac21d7e775ff9bc9d45021e1745c97521c4", - "reference": "63aaeac21d7e775ff9bc9d45021e1745c97521c4", + "url": "https://api.github.com/repos/composer/pcre/zipball/b2bed4734f0cc156ee1fe9c0da2550420d99a21e", + "reference": "b2bed4734f0cc156ee1fe9c0da2550420d99a21e", "shasum": "" }, "require": { @@ -92,8 +92,8 @@ "phpstan/phpstan": "<1.11.10" }, "require-dev": { - "phpstan/phpstan": "^1.11.10", - "phpstan/phpstan-strict-rules": "^1.1", + "phpstan/phpstan": "^1.12 || ^2", + "phpstan/phpstan-strict-rules": "^1 || ^2", "phpunit/phpunit": "^8 || ^9" }, "type": "library", @@ -132,7 +132,7 @@ ], "support": { "issues": "https://github.com/composer/pcre/issues", - "source": "https://github.com/composer/pcre/tree/3.3.1" + "source": "https://github.com/composer/pcre/tree/3.3.2" }, "funding": [ { @@ -148,7 +148,7 @@ "type": "tidelift" } ], - "time": "2024-08-27T18:44:43+00:00" + "time": "2024-11-12T16:29:46+00:00" }, { "name": "composer/semver", @@ -375,6 +375,76 @@ }, "time": "2023-01-05T11:28:13+00:00" }, + { + "name": "doctrine/instantiator", + "version": "1.5.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/instantiator.git", + "reference": "0a0fa9780f5d4e507415a065172d26a98d02047b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/0a0fa9780f5d4e507415a065172d26a98d02047b", + "reference": "0a0fa9780f5d4e507415a065172d26a98d02047b", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "doctrine/coding-standard": "^9 || ^11", + "ext-pdo": "*", + "ext-phar": "*", + "phpbench/phpbench": "^0.16 || ^1", + "phpstan/phpstan": "^1.4", + "phpstan/phpstan-phpunit": "^1", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "vimeo/psalm": "^4.30 || ^5.4" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "homepage": "https://ocramius.github.io/" + } + ], + "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", + "homepage": "https://www.doctrine-project.org/projects/instantiator.html", + "keywords": [ + "constructor", + "instantiate" + ], + "support": { + "issues": "https://github.com/doctrine/instantiator/issues", + "source": "https://github.com/doctrine/instantiator/tree/1.5.0" + }, + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator", + "type": "tidelift" + } + ], + "time": "2022-12-30T00:15:36+00:00" + }, { "name": "evenement/evenement", "version": "v3.0.2", @@ -485,16 +555,16 @@ }, { "name": "friendsofphp/php-cs-fixer", - "version": "v3.64.0", + "version": "v3.65.0", "source": { "type": "git", "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git", - "reference": "58dd9c931c785a79739310aef5178928305ffa67" + "reference": "79d4f3e77b250a7d8043d76c6af8f0695e8a469f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/58dd9c931c785a79739310aef5178928305ffa67", - "reference": "58dd9c931c785a79739310aef5178928305ffa67", + "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/79d4f3e77b250a7d8043d76c6af8f0695e8a469f", + "reference": "79d4f3e77b250a7d8043d76c6af8f0695e8a469f", "shasum": "" }, "require": { @@ -504,7 +574,7 @@ "ext-filter": "*", "ext-json": "*", "ext-tokenizer": "*", - "fidry/cpu-core-counter": "^1.0", + "fidry/cpu-core-counter": "^1.2", "php": "^7.4 || ^8.0", "react/child-process": "^0.6.5", "react/event-loop": "^1.0", @@ -524,18 +594,18 @@ "symfony/stopwatch": "^5.4 || ^6.0 || ^7.0" }, "require-dev": { - "facile-it/paraunit": "^1.3 || ^2.3", - "infection/infection": "^0.29.5", - "justinrainbow/json-schema": "^5.2", + "facile-it/paraunit": "^1.3.1 || ^2.4", + "infection/infection": "^0.29.8", + "justinrainbow/json-schema": "^5.3 || ^6.0", "keradus/cli-executor": "^2.1", - "mikey179/vfsstream": "^1.6.11", + "mikey179/vfsstream": "^1.6.12", "php-coveralls/php-coveralls": "^2.7", "php-cs-fixer/accessible-object": "^1.1", "php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.5", "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.5", - "phpunit/phpunit": "^9.6.19 || ^10.5.21 || ^11.2", - "symfony/var-dumper": "^5.4 || ^6.0 || ^7.0", - "symfony/yaml": "^5.4 || ^6.0 || ^7.0" + "phpunit/phpunit": "^9.6.21 || ^10.5.38 || ^11.4.3", + "symfony/var-dumper": "^5.4.47 || ^6.4.15 || ^7.1.8", + "symfony/yaml": "^5.4.45 || ^6.4.13 || ^7.1.6" }, "suggest": { "ext-dom": "For handling output formats in XML", @@ -576,7 +646,7 @@ ], "support": { "issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues", - "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.64.0" + "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.65.0" }, "funding": [ { @@ -584,7 +654,243 @@ "type": "github" } ], - "time": "2024-08-30T23:09:38+00:00" + "time": "2024-11-25T00:39:24+00:00" + }, + { + "name": "myclabs/deep-copy", + "version": "1.12.1", + "source": { + "type": "git", + "url": "https://github.com/myclabs/DeepCopy.git", + "reference": "123267b2c49fbf30d78a7b2d333f6be754b94845" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/123267b2c49fbf30d78a7b2d333f6be754b94845", + "reference": "123267b2c49fbf30d78a7b2d333f6be754b94845", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "conflict": { + "doctrine/collections": "<1.6.8", + "doctrine/common": "<2.13.3 || >=3 <3.2.2" + }, + "require-dev": { + "doctrine/collections": "^1.6.8", + "doctrine/common": "^2.13.3 || ^3.2.2", + "phpspec/prophecy": "^1.10", + "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" + }, + "type": "library", + "autoload": { + "files": [ + "src/DeepCopy/deep_copy.php" + ], + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Create deep copies (clones) of your objects", + "keywords": [ + "clone", + "copy", + "duplicate", + "object", + "object graph" + ], + "support": { + "issues": "https://github.com/myclabs/DeepCopy/issues", + "source": "https://github.com/myclabs/DeepCopy/tree/1.12.1" + }, + "funding": [ + { + "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy", + "type": "tidelift" + } + ], + "time": "2024-11-08T17:47:46+00:00" + }, + { + "name": "nikic/php-parser", + "version": "v5.3.1", + "source": { + "type": "git", + "url": "https://github.com/nikic/PHP-Parser.git", + "reference": "8eea230464783aa9671db8eea6f8c6ac5285794b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/8eea230464783aa9671db8eea6f8c6ac5285794b", + "reference": "8eea230464783aa9671db8eea6f8c6ac5285794b", + "shasum": "" + }, + "require": { + "ext-ctype": "*", + "ext-json": "*", + "ext-tokenizer": "*", + "php": ">=7.4" + }, + "require-dev": { + "ircmaxell/php-yacc": "^0.0.7", + "phpunit/phpunit": "^9.0" + }, + "bin": [ + "bin/php-parse" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0-dev" + } + }, + "autoload": { + "psr-4": { + "PhpParser\\": "lib/PhpParser" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Nikita Popov" + } + ], + "description": "A PHP parser written in PHP", + "keywords": [ + "parser", + "php" + ], + "support": { + "issues": "https://github.com/nikic/PHP-Parser/issues", + "source": "https://github.com/nikic/PHP-Parser/tree/v5.3.1" + }, + "time": "2024-10-08T18:51:32+00:00" + }, + { + "name": "phar-io/manifest", + "version": "2.0.4", + "source": { + "type": "git", + "url": "https://github.com/phar-io/manifest.git", + "reference": "54750ef60c58e43759730615a392c31c80e23176" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/54750ef60c58e43759730615a392c31c80e23176", + "reference": "54750ef60c58e43759730615a392c31c80e23176", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-libxml": "*", + "ext-phar": "*", + "ext-xmlwriter": "*", + "phar-io/version": "^3.0.1", + "php": "^7.2 || ^8.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", + "support": { + "issues": "https://github.com/phar-io/manifest/issues", + "source": "https://github.com/phar-io/manifest/tree/2.0.4" + }, + "funding": [ + { + "url": "https://github.com/theseer", + "type": "github" + } + ], + "time": "2024-03-03T12:33:53+00:00" + }, + { + "name": "phar-io/version", + "version": "3.2.1", + "source": { + "type": "git", + "url": "https://github.com/phar-io/version.git", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Library for handling version information and constraints", + "support": { + "issues": "https://github.com/phar-io/version/issues", + "source": "https://github.com/phar-io/version/tree/3.2.1" + }, + "time": "2022-02-21T01:04:05+00:00" }, { "name": "phpcsstandards/phpcsextra", @@ -753,407 +1059,600 @@ "time": "2024-05-20T13:34:27+00:00" }, { - "name": "psr/container", - "version": "1.1.2", + "name": "phpunit/php-code-coverage", + "version": "9.2.32", "source": { "type": "git", - "url": "https://github.com/php-fig/container.git", - "reference": "513e0666f7216c7459170d56df27dfcefe1689ea" + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "85402a822d1ecf1db1096959413d35e1c37cf1a5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/513e0666f7216c7459170d56df27dfcefe1689ea", - "reference": "513e0666f7216c7459170d56df27dfcefe1689ea", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/85402a822d1ecf1db1096959413d35e1c37cf1a5", + "reference": "85402a822d1ecf1db1096959413d35e1c37cf1a5", "shasum": "" }, "require": { - "php": ">=7.4.0" + "ext-dom": "*", + "ext-libxml": "*", + "ext-xmlwriter": "*", + "nikic/php-parser": "^4.19.1 || ^5.1.0", + "php": ">=7.3", + "phpunit/php-file-iterator": "^3.0.6", + "phpunit/php-text-template": "^2.0.4", + "sebastian/code-unit-reverse-lookup": "^2.0.3", + "sebastian/complexity": "^2.0.3", + "sebastian/environment": "^5.1.5", + "sebastian/lines-of-code": "^1.0.4", + "sebastian/version": "^3.0.2", + "theseer/tokenizer": "^1.2.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.6" + }, + "suggest": { + "ext-pcov": "PHP extension that provides line coverage", + "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage" }, "type": "library", - "autoload": { - "psr-4": { - "Psr\\Container\\": "src/" + "extra": { + "branch-alias": { + "dev-main": "9.2.x-dev" } }, + "autoload": { + "classmap": [ + "src/" + ] + }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "PHP-FIG", - "homepage": "https://www.php-fig.org/" + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" } ], - "description": "Common Container Interface (PHP FIG PSR-11)", - "homepage": "https://github.com/php-fig/container", + "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", + "homepage": "https://github.com/sebastianbergmann/php-code-coverage", "keywords": [ - "PSR-11", - "container", - "container-interface", - "container-interop", - "psr" + "coverage", + "testing", + "xunit" ], "support": { - "issues": "https://github.com/php-fig/container/issues", - "source": "https://github.com/php-fig/container/tree/1.1.2" + "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", + "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.32" }, - "time": "2021-11-05T16:50:12+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-08-22T04:23:01+00:00" }, { - "name": "psr/event-dispatcher", - "version": "1.0.0", + "name": "phpunit/php-file-iterator", + "version": "3.0.6", "source": { "type": "git", - "url": "https://github.com/php-fig/event-dispatcher.git", - "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0" + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/event-dispatcher/zipball/dbefd12671e8a14ec7f180cab83036ed26714bb0", - "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", + "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", "shasum": "" }, "require": { - "php": ">=7.2.0" + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "3.0-dev" } }, "autoload": { - "psr-4": { - "Psr\\EventDispatcher\\": "src/" - } + "classmap": [ + "src/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" } ], - "description": "Standard interfaces for event handling.", + "description": "FilterIterator implementation that filters files based on a list of suffixes.", + "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", "keywords": [ - "events", - "psr", - "psr-14" + "filesystem", + "iterator" ], "support": { - "issues": "https://github.com/php-fig/event-dispatcher/issues", - "source": "https://github.com/php-fig/event-dispatcher/tree/1.0.0" + "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.6" }, - "time": "2019-01-08T18:20:26+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2021-12-02T12:48:52+00:00" }, { - "name": "psr/log", - "version": "1.1.4", + "name": "phpunit/php-invoker", + "version": "3.1.1", "source": { "type": "git", - "url": "https://github.com/php-fig/log.git", - "reference": "d49695b909c3b7628b6289db5479a1c204601f11" + "url": "https://github.com/sebastianbergmann/php-invoker.git", + "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11", - "reference": "d49695b909c3b7628b6289db5479a1c204601f11", + "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/5a10147d0aaf65b58940a0b72f71c9ac0423cc67", + "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": ">=7.3" + }, + "require-dev": { + "ext-pcntl": "*", + "phpunit/phpunit": "^9.3" + }, + "suggest": { + "ext-pcntl": "*" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1.x-dev" + "dev-master": "3.1-dev" } }, "autoload": { - "psr-4": { - "Psr\\Log\\": "Psr/Log/" - } + "classmap": [ + "src/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "PHP-FIG", - "homepage": "https://www.php-fig.org/" + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" } ], - "description": "Common interface for logging libraries", - "homepage": "https://github.com/php-fig/log", + "description": "Invoke callables with a timeout", + "homepage": "https://github.com/sebastianbergmann/php-invoker/", "keywords": [ - "log", - "psr", - "psr-3" + "process" ], "support": { - "source": "https://github.com/php-fig/log/tree/1.1.4" + "issues": "https://github.com/sebastianbergmann/php-invoker/issues", + "source": "https://github.com/sebastianbergmann/php-invoker/tree/3.1.1" }, - "time": "2021-05-03T11:20:27+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T05:58:55+00:00" }, { - "name": "react/cache", - "version": "v1.2.0", + "name": "phpunit/php-text-template", + "version": "2.0.4", "source": { "type": "git", - "url": "https://github.com/reactphp/cache.git", - "reference": "d47c472b64aa5608225f47965a484b75c7817d5b" + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/reactphp/cache/zipball/d47c472b64aa5608225f47965a484b75c7817d5b", - "reference": "d47c472b64aa5608225f47965a484b75c7817d5b", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", + "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", "shasum": "" }, "require": { - "php": ">=5.3.0", - "react/promise": "^3.0 || ^2.0 || ^1.1" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^9.5 || ^5.7 || ^4.8.35" + "phpunit/phpunit": "^9.3" }, "type": "library", - "autoload": { - "psr-4": { - "React\\Cache\\": "src/" + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" } }, + "autoload": { + "classmap": [ + "src/" + ] + }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Christian Lück", - "email": "christian@clue.engineering", - "homepage": "https://clue.engineering/" - }, - { - "name": "Cees-Jan Kiewiet", - "email": "reactphp@ceesjankiewiet.nl", - "homepage": "https://wyrihaximus.net/" - }, - { - "name": "Jan Sorgalla", - "email": "jsorgalla@gmail.com", - "homepage": "https://sorgalla.com/" - }, - { - "name": "Chris Boden", - "email": "cboden@gmail.com", - "homepage": "https://cboden.dev/" + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" } ], - "description": "Async, Promise-based cache interface for ReactPHP", + "description": "Simple template engine.", + "homepage": "https://github.com/sebastianbergmann/php-text-template/", "keywords": [ - "cache", - "caching", - "promise", - "reactphp" + "template" ], "support": { - "issues": "https://github.com/reactphp/cache/issues", - "source": "https://github.com/reactphp/cache/tree/v1.2.0" + "issues": "https://github.com/sebastianbergmann/php-text-template/issues", + "source": "https://github.com/sebastianbergmann/php-text-template/tree/2.0.4" }, "funding": [ { - "url": "https://opencollective.com/reactphp", - "type": "open_collective" + "url": "https://github.com/sebastianbergmann", + "type": "github" } ], - "time": "2022-11-30T15:59:55+00:00" + "time": "2020-10-26T05:33:50+00:00" }, { - "name": "react/child-process", - "version": "v0.6.5", + "name": "phpunit/php-timer", + "version": "5.0.3", "source": { "type": "git", - "url": "https://github.com/reactphp/child-process.git", - "reference": "e71eb1aa55f057c7a4a0d08d06b0b0a484bead43" + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/reactphp/child-process/zipball/e71eb1aa55f057c7a4a0d08d06b0b0a484bead43", - "reference": "e71eb1aa55f057c7a4a0d08d06b0b0a484bead43", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", + "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", "shasum": "" }, "require": { - "evenement/evenement": "^3.0 || ^2.0 || ^1.0", - "php": ">=5.3.0", - "react/event-loop": "^1.2", - "react/stream": "^1.2" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^9.3 || ^5.7 || ^4.8.35", - "react/socket": "^1.8", - "sebastian/environment": "^5.0 || ^3.0 || ^2.0 || ^1.0" + "phpunit/phpunit": "^9.3" }, "type": "library", - "autoload": { - "psr-4": { - "React\\ChildProcess\\": "src" + "extra": { + "branch-alias": { + "dev-master": "5.0-dev" } }, + "autoload": { + "classmap": [ + "src/" + ] + }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Christian Lück", - "email": "christian@clue.engineering", - "homepage": "https://clue.engineering/" - }, - { - "name": "Cees-Jan Kiewiet", - "email": "reactphp@ceesjankiewiet.nl", - "homepage": "https://wyrihaximus.net/" - }, - { - "name": "Jan Sorgalla", - "email": "jsorgalla@gmail.com", - "homepage": "https://sorgalla.com/" - }, - { - "name": "Chris Boden", - "email": "cboden@gmail.com", - "homepage": "https://cboden.dev/" + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" } ], - "description": "Event-driven library for executing child processes with ReactPHP.", + "description": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", "keywords": [ - "event-driven", - "process", - "reactphp" + "timer" ], "support": { - "issues": "https://github.com/reactphp/child-process/issues", - "source": "https://github.com/reactphp/child-process/tree/v0.6.5" + "issues": "https://github.com/sebastianbergmann/php-timer/issues", + "source": "https://github.com/sebastianbergmann/php-timer/tree/5.0.3" }, "funding": [ { - "url": "https://github.com/WyriHaximus", - "type": "github" - }, - { - "url": "https://github.com/clue", + "url": "https://github.com/sebastianbergmann", "type": "github" } ], - "time": "2022-09-16T13:41:56+00:00" + "time": "2020-10-26T13:16:10+00:00" }, { - "name": "react/dns", - "version": "v1.13.0", + "name": "phpunit/phpunit", + "version": "9.6.21", "source": { "type": "git", - "url": "https://github.com/reactphp/dns.git", - "reference": "eb8ae001b5a455665c89c1df97f6fb682f8fb0f5" + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "de6abf3b6f8dd955fac3caad3af7a9504e8c2ffa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/reactphp/dns/zipball/eb8ae001b5a455665c89c1df97f6fb682f8fb0f5", - "reference": "eb8ae001b5a455665c89c1df97f6fb682f8fb0f5", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/de6abf3b6f8dd955fac3caad3af7a9504e8c2ffa", + "reference": "de6abf3b6f8dd955fac3caad3af7a9504e8c2ffa", "shasum": "" }, "require": { - "php": ">=5.3.0", - "react/cache": "^1.0 || ^0.6 || ^0.5", - "react/event-loop": "^1.2", - "react/promise": "^3.2 || ^2.7 || ^1.2.1" + "doctrine/instantiator": "^1.5.0 || ^2", + "ext-dom": "*", + "ext-json": "*", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-xml": "*", + "ext-xmlwriter": "*", + "myclabs/deep-copy": "^1.12.0", + "phar-io/manifest": "^2.0.4", + "phar-io/version": "^3.2.1", + "php": ">=7.3", + "phpunit/php-code-coverage": "^9.2.32", + "phpunit/php-file-iterator": "^3.0.6", + "phpunit/php-invoker": "^3.1.1", + "phpunit/php-text-template": "^2.0.4", + "phpunit/php-timer": "^5.0.3", + "sebastian/cli-parser": "^1.0.2", + "sebastian/code-unit": "^1.0.8", + "sebastian/comparator": "^4.0.8", + "sebastian/diff": "^4.0.6", + "sebastian/environment": "^5.1.5", + "sebastian/exporter": "^4.0.6", + "sebastian/global-state": "^5.0.7", + "sebastian/object-enumerator": "^4.0.4", + "sebastian/resource-operations": "^3.0.4", + "sebastian/type": "^3.2.1", + "sebastian/version": "^3.0.2" }, - "require-dev": { - "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36", - "react/async": "^4.3 || ^3 || ^2", - "react/promise-timer": "^1.11" + "suggest": { + "ext-soap": "To be able to generate mocks based on WSDL files", + "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage" }, + "bin": [ + "phpunit" + ], "type": "library", - "autoload": { - "psr-4": { - "React\\Dns\\": "src/" + "extra": { + "branch-alias": { + "dev-master": "9.6-dev" } }, + "autoload": { + "files": [ + "src/Framework/Assert/Functions.php" + ], + "classmap": [ + "src/" + ] + }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Christian Lück", - "email": "christian@clue.engineering", - "homepage": "https://clue.engineering/" - }, - { - "name": "Cees-Jan Kiewiet", - "email": "reactphp@ceesjankiewiet.nl", - "homepage": "https://wyrihaximus.net/" - }, - { - "name": "Jan Sorgalla", - "email": "jsorgalla@gmail.com", - "homepage": "https://sorgalla.com/" - }, - { - "name": "Chris Boden", - "email": "cboden@gmail.com", - "homepage": "https://cboden.dev/" + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" } ], - "description": "Async DNS resolver for ReactPHP", + "description": "The PHP Unit Testing framework.", + "homepage": "https://phpunit.de/", "keywords": [ - "async", - "dns", - "dns-resolver", - "reactphp" + "phpunit", + "testing", + "xunit" ], "support": { - "issues": "https://github.com/reactphp/dns/issues", - "source": "https://github.com/reactphp/dns/tree/v1.13.0" + "issues": "https://github.com/sebastianbergmann/phpunit/issues", + "security": "https://github.com/sebastianbergmann/phpunit/security/policy", + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.21" }, "funding": [ { - "url": "https://opencollective.com/reactphp", - "type": "open_collective" + "url": "https://phpunit.de/sponsors.html", + "type": "custom" + }, + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpunit/phpunit", + "type": "tidelift" } ], - "time": "2024-06-13T14:18:03+00:00" + "time": "2024-09-19T10:50:18+00:00" }, { - "name": "react/event-loop", - "version": "v1.5.0", + "name": "psr/container", + "version": "1.1.2", "source": { "type": "git", - "url": "https://github.com/reactphp/event-loop.git", - "reference": "bbe0bd8c51ffc05ee43f1729087ed3bdf7d53354" + "url": "https://github.com/php-fig/container.git", + "reference": "513e0666f7216c7459170d56df27dfcefe1689ea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/reactphp/event-loop/zipball/bbe0bd8c51ffc05ee43f1729087ed3bdf7d53354", - "reference": "bbe0bd8c51ffc05ee43f1729087ed3bdf7d53354", + "url": "https://api.github.com/repos/php-fig/container/zipball/513e0666f7216c7459170d56df27dfcefe1689ea", + "reference": "513e0666f7216c7459170d56df27dfcefe1689ea", "shasum": "" }, "require": { - "php": ">=5.3.0" - }, - "require-dev": { - "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36" + "php": ">=7.4.0" }, - "suggest": { - "ext-pcntl": "For signal handling support when using the StreamSelectLoop" + "type": "library", + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "support": { + "issues": "https://github.com/php-fig/container/issues", + "source": "https://github.com/php-fig/container/tree/1.1.2" + }, + "time": "2021-11-05T16:50:12+00:00" + }, + { + "name": "psr/event-dispatcher", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/event-dispatcher.git", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/event-dispatcher/zipball/dbefd12671e8a14ec7f180cab83036ed26714bb0", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0", + "shasum": "" + }, + "require": { + "php": ">=7.2.0" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, "autoload": { "psr-4": { - "React\\EventLoop\\": "src/" + "Psr\\EventDispatcher\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Standard interfaces for event handling.", + "keywords": [ + "events", + "psr", + "psr-14" + ], + "support": { + "issues": "https://github.com/php-fig/event-dispatcher/issues", + "source": "https://github.com/php-fig/event-dispatcher/tree/1.0.0" + }, + "time": "2019-01-08T18:20:26+00:00" + }, + { + "name": "psr/log", + "version": "1.1.4", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "d49695b909c3b7628b6289db5479a1c204601f11" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11", + "reference": "d49695b909c3b7628b6289db5479a1c204601f11", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "support": { + "source": "https://github.com/php-fig/log/tree/1.1.4" + }, + "time": "2021-05-03T11:20:27+00:00" + }, + { + "name": "react/cache", + "version": "v1.2.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/cache.git", + "reference": "d47c472b64aa5608225f47965a484b75c7817d5b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/cache/zipball/d47c472b64aa5608225f47965a484b75c7817d5b", + "reference": "d47c472b64aa5608225f47965a484b75c7817d5b", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "react/promise": "^3.0 || ^2.0 || ^1.1" + }, + "require-dev": { + "phpunit/phpunit": "^9.5 || ^5.7 || ^4.8.35" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\Cache\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -1182,14 +1681,16 @@ "homepage": "https://cboden.dev/" } ], - "description": "ReactPHP's core reactor event loop that libraries can use for evented I/O.", + "description": "Async, Promise-based cache interface for ReactPHP", "keywords": [ - "asynchronous", - "event-loop" + "cache", + "caching", + "promise", + "reactphp" ], "support": { - "issues": "https://github.com/reactphp/event-loop/issues", - "source": "https://github.com/reactphp/event-loop/tree/v1.5.0" + "issues": "https://github.com/reactphp/cache/issues", + "source": "https://github.com/reactphp/cache/tree/v1.2.0" }, "funding": [ { @@ -1197,36 +1698,37 @@ "type": "open_collective" } ], - "time": "2023-11-13T13:48:05+00:00" + "time": "2022-11-30T15:59:55+00:00" }, { - "name": "react/promise", - "version": "v3.2.0", + "name": "react/child-process", + "version": "v0.6.5", "source": { "type": "git", - "url": "https://github.com/reactphp/promise.git", - "reference": "8a164643313c71354582dc850b42b33fa12a4b63" + "url": "https://github.com/reactphp/child-process.git", + "reference": "e71eb1aa55f057c7a4a0d08d06b0b0a484bead43" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/reactphp/promise/zipball/8a164643313c71354582dc850b42b33fa12a4b63", - "reference": "8a164643313c71354582dc850b42b33fa12a4b63", + "url": "https://api.github.com/repos/reactphp/child-process/zipball/e71eb1aa55f057c7a4a0d08d06b0b0a484bead43", + "reference": "e71eb1aa55f057c7a4a0d08d06b0b0a484bead43", "shasum": "" }, "require": { - "php": ">=7.1.0" + "evenement/evenement": "^3.0 || ^2.0 || ^1.0", + "php": ">=5.3.0", + "react/event-loop": "^1.2", + "react/stream": "^1.2" }, "require-dev": { - "phpstan/phpstan": "1.10.39 || 1.4.10", - "phpunit/phpunit": "^9.6 || ^7.5" + "phpunit/phpunit": "^9.3 || ^5.7 || ^4.8.35", + "react/socket": "^1.8", + "sebastian/environment": "^5.0 || ^3.0 || ^2.0 || ^1.0" }, "type": "library", "autoload": { - "files": [ - "src/functions_include.php" - ], "psr-4": { - "React\\Promise\\": "src/" + "React\\ChildProcess\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -1234,227 +1736,1359 @@ "MIT" ], "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, { "name": "Jan Sorgalla", "email": "jsorgalla@gmail.com", "homepage": "https://sorgalla.com/" }, { - "name": "Christian Lück", - "email": "christian@clue.engineering", - "homepage": "https://clue.engineering/" + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "Event-driven library for executing child processes with ReactPHP.", + "keywords": [ + "event-driven", + "process", + "reactphp" + ], + "support": { + "issues": "https://github.com/reactphp/child-process/issues", + "source": "https://github.com/reactphp/child-process/tree/v0.6.5" + }, + "funding": [ + { + "url": "https://github.com/WyriHaximus", + "type": "github" + }, + { + "url": "https://github.com/clue", + "type": "github" + } + ], + "time": "2022-09-16T13:41:56+00:00" + }, + { + "name": "react/dns", + "version": "v1.13.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/dns.git", + "reference": "eb8ae001b5a455665c89c1df97f6fb682f8fb0f5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/dns/zipball/eb8ae001b5a455665c89c1df97f6fb682f8fb0f5", + "reference": "eb8ae001b5a455665c89c1df97f6fb682f8fb0f5", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "react/cache": "^1.0 || ^0.6 || ^0.5", + "react/event-loop": "^1.2", + "react/promise": "^3.2 || ^2.7 || ^1.2.1" + }, + "require-dev": { + "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36", + "react/async": "^4.3 || ^3 || ^2", + "react/promise-timer": "^1.11" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\Dns\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "Async DNS resolver for ReactPHP", + "keywords": [ + "async", + "dns", + "dns-resolver", + "reactphp" + ], + "support": { + "issues": "https://github.com/reactphp/dns/issues", + "source": "https://github.com/reactphp/dns/tree/v1.13.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2024-06-13T14:18:03+00:00" + }, + { + "name": "react/event-loop", + "version": "v1.5.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/event-loop.git", + "reference": "bbe0bd8c51ffc05ee43f1729087ed3bdf7d53354" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/event-loop/zipball/bbe0bd8c51ffc05ee43f1729087ed3bdf7d53354", + "reference": "bbe0bd8c51ffc05ee43f1729087ed3bdf7d53354", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36" + }, + "suggest": { + "ext-pcntl": "For signal handling support when using the StreamSelectLoop" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\EventLoop\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "ReactPHP's core reactor event loop that libraries can use for evented I/O.", + "keywords": [ + "asynchronous", + "event-loop" + ], + "support": { + "issues": "https://github.com/reactphp/event-loop/issues", + "source": "https://github.com/reactphp/event-loop/tree/v1.5.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2023-11-13T13:48:05+00:00" + }, + { + "name": "react/promise", + "version": "v3.2.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/promise.git", + "reference": "8a164643313c71354582dc850b42b33fa12a4b63" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/promise/zipball/8a164643313c71354582dc850b42b33fa12a4b63", + "reference": "8a164643313c71354582dc850b42b33fa12a4b63", + "shasum": "" + }, + "require": { + "php": ">=7.1.0" + }, + "require-dev": { + "phpstan/phpstan": "1.10.39 || 1.4.10", + "phpunit/phpunit": "^9.6 || ^7.5" + }, + "type": "library", + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "React\\Promise\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "A lightweight implementation of CommonJS Promises/A for PHP", + "keywords": [ + "promise", + "promises" + ], + "support": { + "issues": "https://github.com/reactphp/promise/issues", + "source": "https://github.com/reactphp/promise/tree/v3.2.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2024-05-24T10:39:05+00:00" + }, + { + "name": "react/socket", + "version": "v1.16.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/socket.git", + "reference": "23e4ff33ea3e160d2d1f59a0e6050e4b0fb0eac1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/socket/zipball/23e4ff33ea3e160d2d1f59a0e6050e4b0fb0eac1", + "reference": "23e4ff33ea3e160d2d1f59a0e6050e4b0fb0eac1", + "shasum": "" + }, + "require": { + "evenement/evenement": "^3.0 || ^2.0 || ^1.0", + "php": ">=5.3.0", + "react/dns": "^1.13", + "react/event-loop": "^1.2", + "react/promise": "^3.2 || ^2.6 || ^1.2.1", + "react/stream": "^1.4" + }, + "require-dev": { + "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36", + "react/async": "^4.3 || ^3.3 || ^2", + "react/promise-stream": "^1.4", + "react/promise-timer": "^1.11" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\Socket\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "Async, streaming plaintext TCP/IP and secure TLS socket server and client connections for ReactPHP", + "keywords": [ + "Connection", + "Socket", + "async", + "reactphp", + "stream" + ], + "support": { + "issues": "https://github.com/reactphp/socket/issues", + "source": "https://github.com/reactphp/socket/tree/v1.16.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2024-07-26T10:38:09+00:00" + }, + { + "name": "react/stream", + "version": "v1.4.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/stream.git", + "reference": "1e5b0acb8fe55143b5b426817155190eb6f5b18d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/stream/zipball/1e5b0acb8fe55143b5b426817155190eb6f5b18d", + "reference": "1e5b0acb8fe55143b5b426817155190eb6f5b18d", + "shasum": "" + }, + "require": { + "evenement/evenement": "^3.0 || ^2.0 || ^1.0", + "php": ">=5.3.8", + "react/event-loop": "^1.2" + }, + "require-dev": { + "clue/stream-filter": "~1.2", + "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\Stream\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "Event-driven readable and writable streams for non-blocking I/O in ReactPHP", + "keywords": [ + "event-driven", + "io", + "non-blocking", + "pipe", + "reactphp", + "readable", + "stream", + "writable" + ], + "support": { + "issues": "https://github.com/reactphp/stream/issues", + "source": "https://github.com/reactphp/stream/tree/v1.4.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2024-06-11T12:45:25+00:00" + }, + { + "name": "sebastian/cli-parser", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/cli-parser.git", + "reference": "2b56bea83a09de3ac06bb18b92f068e60cc6f50b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/2b56bea83a09de3ac06bb18b92f068e60cc6f50b", + "reference": "2b56bea83a09de3ac06bb18b92f068e60cc6f50b", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for parsing CLI options", + "homepage": "https://github.com/sebastianbergmann/cli-parser", + "support": { + "issues": "https://github.com/sebastianbergmann/cli-parser/issues", + "source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-03-02T06:27:43+00:00" + }, + { + "name": "sebastian/code-unit", + "version": "1.0.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit.git", + "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/1fc9f64c0927627ef78ba436c9b17d967e68e120", + "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Collection of value objects that represent the PHP code units", + "homepage": "https://github.com/sebastianbergmann/code-unit", + "support": { + "issues": "https://github.com/sebastianbergmann/code-unit/issues", + "source": "https://github.com/sebastianbergmann/code-unit/tree/1.0.8" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:08:54+00:00" + }, + { + "name": "sebastian/code-unit-reverse-lookup", + "version": "2.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", + "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", + "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Looks up which function or method a line of code belongs to", + "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", + "support": { + "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", + "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/2.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T05:30:19+00:00" + }, + { + "name": "sebastian/comparator", + "version": "4.0.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/comparator.git", + "reference": "fa0f136dd2334583309d32b62544682ee972b51a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/fa0f136dd2334583309d32b62544682ee972b51a", + "reference": "fa0f136dd2334583309d32b62544682ee972b51a", + "shasum": "" + }, + "require": { + "php": ">=7.3", + "sebastian/diff": "^4.0", + "sebastian/exporter": "^4.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + } + ], + "description": "Provides the functionality to compare PHP values for equality", + "homepage": "https://github.com/sebastianbergmann/comparator", + "keywords": [ + "comparator", + "compare", + "equality" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/comparator/issues", + "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.8" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2022-09-14T12:41:17+00:00" + }, + { + "name": "sebastian/complexity", + "version": "2.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/complexity.git", + "reference": "25f207c40d62b8b7aa32f5ab026c53561964053a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/25f207c40d62b8b7aa32f5ab026c53561964053a", + "reference": "25f207c40d62b8b7aa32f5ab026c53561964053a", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^4.18 || ^5.0", + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for calculating the complexity of PHP code units", + "homepage": "https://github.com/sebastianbergmann/complexity", + "support": { + "issues": "https://github.com/sebastianbergmann/complexity/issues", + "source": "https://github.com/sebastianbergmann/complexity/tree/2.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-12-22T06:19:30+00:00" + }, + { + "name": "sebastian/diff", + "version": "4.0.6", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "ba01945089c3a293b01ba9badc29ad55b106b0bc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/ba01945089c3a293b01ba9badc29ad55b106b0bc", + "reference": "ba01945089c3a293b01ba9badc29ad55b106b0bc", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3", + "symfony/process": "^4.2 || ^5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + } + ], + "description": "Diff implementation", + "homepage": "https://github.com/sebastianbergmann/diff", + "keywords": [ + "diff", + "udiff", + "unidiff", + "unified diff" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/diff/issues", + "source": "https://github.com/sebastianbergmann/diff/tree/4.0.6" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-03-02T06:30:58+00:00" + }, + { + "name": "sebastian/environment", + "version": "5.1.5", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/environment.git", + "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", + "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "suggest": { + "ext-posix": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides functionality to handle HHVM/PHP environments", + "homepage": "http://www.github.com/sebastianbergmann/environment", + "keywords": [ + "Xdebug", + "environment", + "hhvm" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/environment/issues", + "source": "https://github.com/sebastianbergmann/environment/tree/5.1.5" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-02-03T06:03:51+00:00" + }, + { + "name": "sebastian/exporter", + "version": "4.0.6", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/exporter.git", + "reference": "78c00df8f170e02473b682df15bfcdacc3d32d72" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/78c00df8f170e02473b682df15bfcdacc3d32d72", + "reference": "78c00df8f170e02473b682df15bfcdacc3d32d72", + "shasum": "" + }, + "require": { + "php": ">=7.3", + "sebastian/recursion-context": "^4.0" + }, + "require-dev": { + "ext-mbstring": "*", + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Provides the functionality to export PHP variables for visualization", + "homepage": "https://www.github.com/sebastianbergmann/exporter", + "keywords": [ + "export", + "exporter" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/exporter/issues", + "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.6" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-03-02T06:33:00+00:00" + }, + { + "name": "sebastian/global-state", + "version": "5.0.7", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/global-state.git", + "reference": "bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9", + "reference": "bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9", + "shasum": "" + }, + "require": { + "php": ">=7.3", + "sebastian/object-reflector": "^2.0", + "sebastian/recursion-context": "^4.0" + }, + "require-dev": { + "ext-dom": "*", + "phpunit/phpunit": "^9.3" + }, + "suggest": { + "ext-uopz": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Snapshotting of global state", + "homepage": "http://www.github.com/sebastianbergmann/global-state", + "keywords": [ + "global state" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/global-state/issues", + "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.7" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-03-02T06:35:11+00:00" + }, + { + "name": "sebastian/lines-of-code", + "version": "1.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/lines-of-code.git", + "reference": "e1e4a170560925c26d424b6a03aed157e7dcc5c5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/e1e4a170560925c26d424b6a03aed157e7dcc5c5", + "reference": "e1e4a170560925c26d424b6a03aed157e7dcc5c5", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^4.18 || ^5.0", + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for counting the lines of code in PHP source code", + "homepage": "https://github.com/sebastianbergmann/lines-of-code", + "support": { + "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", + "source": "https://github.com/sebastianbergmann/lines-of-code/tree/1.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-12-22T06:20:34+00:00" + }, + { + "name": "sebastian/object-enumerator", + "version": "4.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-enumerator.git", + "reference": "5c9eeac41b290a3712d88851518825ad78f45c71" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/5c9eeac41b290a3712d88851518825ad78f45c71", + "reference": "5c9eeac41b290a3712d88851518825ad78f45c71", + "shasum": "" + }, + "require": { + "php": ">=7.3", + "sebastian/object-reflector": "^2.0", + "sebastian/recursion-context": "^4.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Traverses array structures and object graphs to enumerate all referenced objects", + "homepage": "https://github.com/sebastianbergmann/object-enumerator/", + "support": { + "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", + "source": "https://github.com/sebastianbergmann/object-enumerator/tree/4.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:12:34+00:00" + }, + { + "name": "sebastian/object-reflector", + "version": "2.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-reflector.git", + "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", + "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Allows reflection of object attributes, including inherited and non-public ones", + "homepage": "https://github.com/sebastianbergmann/object-reflector/", + "support": { + "issues": "https://github.com/sebastianbergmann/object-reflector/issues", + "source": "https://github.com/sebastianbergmann/object-reflector/tree/2.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:14:26+00:00" + }, + { + "name": "sebastian/recursion-context", + "version": "4.0.5", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", + "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" }, { - "name": "Cees-Jan Kiewiet", - "email": "reactphp@ceesjankiewiet.nl", - "homepage": "https://wyrihaximus.net/" + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" }, { - "name": "Chris Boden", - "email": "cboden@gmail.com", - "homepage": "https://cboden.dev/" + "name": "Adam Harvey", + "email": "aharvey@php.net" } ], - "description": "A lightweight implementation of CommonJS Promises/A for PHP", - "keywords": [ - "promise", - "promises" - ], + "description": "Provides functionality to recursively process PHP variables", + "homepage": "https://github.com/sebastianbergmann/recursion-context", "support": { - "issues": "https://github.com/reactphp/promise/issues", - "source": "https://github.com/reactphp/promise/tree/v3.2.0" + "issues": "https://github.com/sebastianbergmann/recursion-context/issues", + "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.5" }, "funding": [ { - "url": "https://opencollective.com/reactphp", - "type": "open_collective" + "url": "https://github.com/sebastianbergmann", + "type": "github" } ], - "time": "2024-05-24T10:39:05+00:00" + "time": "2023-02-03T06:07:39+00:00" }, { - "name": "react/socket", - "version": "v1.16.0", + "name": "sebastian/resource-operations", + "version": "3.0.4", "source": { "type": "git", - "url": "https://github.com/reactphp/socket.git", - "reference": "23e4ff33ea3e160d2d1f59a0e6050e4b0fb0eac1" + "url": "https://github.com/sebastianbergmann/resource-operations.git", + "reference": "05d5692a7993ecccd56a03e40cd7e5b09b1d404e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/reactphp/socket/zipball/23e4ff33ea3e160d2d1f59a0e6050e4b0fb0eac1", - "reference": "23e4ff33ea3e160d2d1f59a0e6050e4b0fb0eac1", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/05d5692a7993ecccd56a03e40cd7e5b09b1d404e", + "reference": "05d5692a7993ecccd56a03e40cd7e5b09b1d404e", "shasum": "" }, "require": { - "evenement/evenement": "^3.0 || ^2.0 || ^1.0", - "php": ">=5.3.0", - "react/dns": "^1.13", - "react/event-loop": "^1.2", - "react/promise": "^3.2 || ^2.6 || ^1.2.1", - "react/stream": "^1.4" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36", - "react/async": "^4.3 || ^3.3 || ^2", - "react/promise-stream": "^1.4", - "react/promise-timer": "^1.11" + "phpunit/phpunit": "^9.0" }, "type": "library", - "autoload": { - "psr-4": { - "React\\Socket\\": "src/" + "extra": { + "branch-alias": { + "dev-main": "3.0-dev" } }, + "autoload": { + "classmap": [ + "src/" + ] + }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Christian Lück", - "email": "christian@clue.engineering", - "homepage": "https://clue.engineering/" - }, - { - "name": "Cees-Jan Kiewiet", - "email": "reactphp@ceesjankiewiet.nl", - "homepage": "https://wyrihaximus.net/" - }, - { - "name": "Jan Sorgalla", - "email": "jsorgalla@gmail.com", - "homepage": "https://sorgalla.com/" - }, - { - "name": "Chris Boden", - "email": "cboden@gmail.com", - "homepage": "https://cboden.dev/" + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" } ], - "description": "Async, streaming plaintext TCP/IP and secure TLS socket server and client connections for ReactPHP", - "keywords": [ - "Connection", - "Socket", - "async", - "reactphp", - "stream" - ], + "description": "Provides a list of PHP built-in functions that operate on resources", + "homepage": "https://www.github.com/sebastianbergmann/resource-operations", "support": { - "issues": "https://github.com/reactphp/socket/issues", - "source": "https://github.com/reactphp/socket/tree/v1.16.0" + "source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.4" }, "funding": [ { - "url": "https://opencollective.com/reactphp", - "type": "open_collective" + "url": "https://github.com/sebastianbergmann", + "type": "github" } ], - "time": "2024-07-26T10:38:09+00:00" + "time": "2024-03-14T16:00:52+00:00" }, { - "name": "react/stream", - "version": "v1.4.0", + "name": "sebastian/type", + "version": "3.2.1", "source": { "type": "git", - "url": "https://github.com/reactphp/stream.git", - "reference": "1e5b0acb8fe55143b5b426817155190eb6f5b18d" + "url": "https://github.com/sebastianbergmann/type.git", + "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/reactphp/stream/zipball/1e5b0acb8fe55143b5b426817155190eb6f5b18d", - "reference": "1e5b0acb8fe55143b5b426817155190eb6f5b18d", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", + "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", "shasum": "" }, "require": { - "evenement/evenement": "^3.0 || ^2.0 || ^1.0", - "php": ">=5.3.8", - "react/event-loop": "^1.2" + "php": ">=7.3" }, "require-dev": { - "clue/stream-filter": "~1.2", - "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36" + "phpunit/phpunit": "^9.5" }, "type": "library", - "autoload": { - "psr-4": { - "React\\Stream\\": "src/" + "extra": { + "branch-alias": { + "dev-master": "3.2-dev" } }, + "autoload": { + "classmap": [ + "src/" + ] + }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Christian Lück", - "email": "christian@clue.engineering", - "homepage": "https://clue.engineering/" - }, - { - "name": "Cees-Jan Kiewiet", - "email": "reactphp@ceesjankiewiet.nl", - "homepage": "https://wyrihaximus.net/" - }, - { - "name": "Jan Sorgalla", - "email": "jsorgalla@gmail.com", - "homepage": "https://sorgalla.com/" - }, - { - "name": "Chris Boden", - "email": "cboden@gmail.com", - "homepage": "https://cboden.dev/" + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" } ], - "description": "Event-driven readable and writable streams for non-blocking I/O in ReactPHP", - "keywords": [ - "event-driven", - "io", - "non-blocking", - "pipe", - "reactphp", - "readable", - "stream", - "writable" - ], + "description": "Collection of value objects that represent the types of the PHP type system", + "homepage": "https://github.com/sebastianbergmann/type", "support": { - "issues": "https://github.com/reactphp/stream/issues", - "source": "https://github.com/reactphp/stream/tree/v1.4.0" + "issues": "https://github.com/sebastianbergmann/type/issues", + "source": "https://github.com/sebastianbergmann/type/tree/3.2.1" }, "funding": [ { - "url": "https://opencollective.com/reactphp", - "type": "open_collective" + "url": "https://github.com/sebastianbergmann", + "type": "github" } ], - "time": "2024-06-11T12:45:25+00:00" + "time": "2023-02-03T06:13:03+00:00" }, { - "name": "sebastian/diff", - "version": "4.0.6", + "name": "sebastian/version", + "version": "3.0.2", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "ba01945089c3a293b01ba9badc29ad55b106b0bc" + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "c6c1022351a901512170118436c764e473f6de8c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/ba01945089c3a293b01ba9badc29ad55b106b0bc", - "reference": "ba01945089c3a293b01ba9badc29ad55b106b0bc", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c6c1022351a901512170118436c764e473f6de8c", + "reference": "c6c1022351a901512170118436c764e473f6de8c", "shasum": "" }, "require": { "php": ">=7.3" }, - "require-dev": { - "phpunit/phpunit": "^9.3", - "symfony/process": "^4.2 || ^5" - }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -1469,24 +3103,15 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" + "email": "sebastian@phpunit.de", + "role": "lead" } ], - "description": "Diff implementation", - "homepage": "https://github.com/sebastianbergmann/diff", - "keywords": [ - "diff", - "udiff", - "unidiff", - "unified diff" - ], + "description": "Library that helps with managing the version number of Git-hosted PHP projects", + "homepage": "https://github.com/sebastianbergmann/version", "support": { - "issues": "https://github.com/sebastianbergmann/diff/issues", - "source": "https://github.com/sebastianbergmann/diff/tree/4.0.6" + "issues": "https://github.com/sebastianbergmann/version/issues", + "source": "https://github.com/sebastianbergmann/version/tree/3.0.2" }, "funding": [ { @@ -1494,20 +3119,20 @@ "type": "github" } ], - "time": "2024-03-02T06:30:58+00:00" + "time": "2020-09-28T06:39:44+00:00" }, { "name": "squizlabs/php_codesniffer", - "version": "3.10.3", + "version": "3.11.1", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", - "reference": "62d32998e820bddc40f99f8251958aed187a5c9c" + "reference": "19473c30efe4f7b3cd42522d0b2e6e7f243c6f87" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/62d32998e820bddc40f99f8251958aed187a5c9c", - "reference": "62d32998e820bddc40f99f8251958aed187a5c9c", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/19473c30efe4f7b3cd42522d0b2e6e7f243c6f87", + "reference": "19473c30efe4f7b3cd42522d0b2e6e7f243c6f87", "shasum": "" }, "require": { @@ -1574,20 +3199,20 @@ "type": "open_collective" } ], - "time": "2024-09-18T10:38:58+00:00" + "time": "2024-11-16T12:02:36+00:00" }, { "name": "symfony/console", - "version": "v5.4.46", + "version": "v5.4.47", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "fb0d4760e7147d81ab4d9e2d57d56268261b4e4e" + "reference": "c4ba980ca61a9eb18ee6bcc73f28e475852bb1ed" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/fb0d4760e7147d81ab4d9e2d57d56268261b4e4e", - "reference": "fb0d4760e7147d81ab4d9e2d57d56268261b4e4e", + "url": "https://api.github.com/repos/symfony/console/zipball/c4ba980ca61a9eb18ee6bcc73f28e475852bb1ed", + "reference": "c4ba980ca61a9eb18ee6bcc73f28e475852bb1ed", "shasum": "" }, "require": { @@ -1657,7 +3282,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v5.4.46" + "source": "https://github.com/symfony/console/tree/v5.4.47" }, "funding": [ { @@ -1673,20 +3298,20 @@ "type": "tidelift" } ], - "time": "2024-11-05T14:17:06+00:00" + "time": "2024-11-06T11:30:55+00:00" }, { "name": "symfony/deprecation-contracts", - "version": "v2.5.3", + "version": "v2.5.4", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "80d075412b557d41002320b96a096ca65aa2c98d" + "reference": "605389f2a7e5625f273b53960dc46aeaf9c62918" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/80d075412b557d41002320b96a096ca65aa2c98d", - "reference": "80d075412b557d41002320b96a096ca65aa2c98d", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/605389f2a7e5625f273b53960dc46aeaf9c62918", + "reference": "605389f2a7e5625f273b53960dc46aeaf9c62918", "shasum": "" }, "require": { @@ -1724,7 +3349,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.3" + "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.4" }, "funding": [ { @@ -1740,7 +3365,7 @@ "type": "tidelift" } ], - "time": "2023-01-24T14:02:46+00:00" + "time": "2024-09-25T14:11:13+00:00" }, { "name": "symfony/event-dispatcher", @@ -1829,16 +3454,16 @@ }, { "name": "symfony/event-dispatcher-contracts", - "version": "v2.5.3", + "version": "v2.5.4", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher-contracts.git", - "reference": "540f4c73e87fd0c71ca44a6aa305d024ac68cb73" + "reference": "e0fe3d79b516eb75126ac6fa4cbf19b79b08c99f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/540f4c73e87fd0c71ca44a6aa305d024ac68cb73", - "reference": "540f4c73e87fd0c71ca44a6aa305d024ac68cb73", + "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/e0fe3d79b516eb75126ac6fa4cbf19b79b08c99f", + "reference": "e0fe3d79b516eb75126ac6fa4cbf19b79b08c99f", "shasum": "" }, "require": { @@ -1888,7 +3513,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v2.5.3" + "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v2.5.4" }, "funding": [ { @@ -1904,7 +3529,7 @@ "type": "tidelift" } ], - "time": "2024-01-23T13:51:25+00:00" + "time": "2024-09-25T14:11:13+00:00" }, { "name": "symfony/filesystem", @@ -2657,16 +4282,16 @@ }, { "name": "symfony/process", - "version": "v5.4.46", + "version": "v5.4.47", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "01906871cb9b5e3cf872863b91aba4ec9767daf4" + "reference": "5d1662fb32ebc94f17ddb8d635454a776066733d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/01906871cb9b5e3cf872863b91aba4ec9767daf4", - "reference": "01906871cb9b5e3cf872863b91aba4ec9767daf4", + "url": "https://api.github.com/repos/symfony/process/zipball/5d1662fb32ebc94f17ddb8d635454a776066733d", + "reference": "5d1662fb32ebc94f17ddb8d635454a776066733d", "shasum": "" }, "require": { @@ -2699,7 +4324,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v5.4.46" + "source": "https://github.com/symfony/process/tree/v5.4.47" }, "funding": [ { @@ -2715,20 +4340,20 @@ "type": "tidelift" } ], - "time": "2024-11-06T09:18:28+00:00" + "time": "2024-11-06T11:36:42+00:00" }, { "name": "symfony/service-contracts", - "version": "v2.5.3", + "version": "v2.5.4", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "a2329596ddc8fd568900e3fc76cba42489ecc7f3" + "reference": "f37b419f7aea2e9abf10abd261832cace12e3300" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/a2329596ddc8fd568900e3fc76cba42489ecc7f3", - "reference": "a2329596ddc8fd568900e3fc76cba42489ecc7f3", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/f37b419f7aea2e9abf10abd261832cace12e3300", + "reference": "f37b419f7aea2e9abf10abd261832cace12e3300", "shasum": "" }, "require": { @@ -2782,7 +4407,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v2.5.3" + "source": "https://github.com/symfony/service-contracts/tree/v2.5.4" }, "funding": [ { @@ -2798,7 +4423,7 @@ "type": "tidelift" } ], - "time": "2023-04-21T15:04:16+00:00" + "time": "2024-09-25T14:11:13+00:00" }, { "name": "symfony/stopwatch", @@ -2864,16 +4489,16 @@ }, { "name": "symfony/string", - "version": "v5.4.45", + "version": "v5.4.47", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "7f6807add88b1e2635f3c6de5e1ace631ed7cad2" + "reference": "136ca7d72f72b599f2631aca474a4f8e26719799" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/7f6807add88b1e2635f3c6de5e1ace631ed7cad2", - "reference": "7f6807add88b1e2635f3c6de5e1ace631ed7cad2", + "url": "https://api.github.com/repos/symfony/string/zipball/136ca7d72f72b599f2631aca474a4f8e26719799", + "reference": "136ca7d72f72b599f2631aca474a4f8e26719799", "shasum": "" }, "require": { @@ -2930,7 +4555,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v5.4.45" + "source": "https://github.com/symfony/string/tree/v5.4.47" }, "funding": [ { @@ -2946,7 +4571,57 @@ "type": "tidelift" } ], - "time": "2024-09-25T14:11:13+00:00" + "time": "2024-11-10T20:33:58+00:00" + }, + { + "name": "theseer/tokenizer", + "version": "1.2.3", + "source": { + "type": "git", + "url": "https://github.com/theseer/tokenizer.git", + "reference": "737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2", + "reference": "737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": "^7.2 || ^8.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + } + ], + "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", + "support": { + "issues": "https://github.com/theseer/tokenizer/issues", + "source": "https://github.com/theseer/tokenizer/tree/1.2.3" + }, + "funding": [ + { + "url": "https://github.com/theseer", + "type": "github" + } + ], + "time": "2024-03-03T12:36:25+00:00" }, { "name": "wp-coding-standards/wpcs", @@ -3013,6 +4688,69 @@ } ], "time": "2024-03-25T16:39:00+00:00" + }, + { + "name": "yoast/phpunit-polyfills", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/Yoast/PHPUnit-Polyfills.git", + "reference": "562f449a2ec8ab92fe7b30d94da9622c7b1345fe" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Yoast/PHPUnit-Polyfills/zipball/562f449a2ec8ab92fe7b30d94da9622c7b1345fe", + "reference": "562f449a2ec8ab92fe7b30d94da9622c7b1345fe", + "shasum": "" + }, + "require": { + "php": ">=5.6", + "phpunit/phpunit": "^5.7.21 || ^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0" + }, + "require-dev": { + "php-parallel-lint/php-console-highlighter": "^1.0.0", + "php-parallel-lint/php-parallel-lint": "^1.4.0", + "yoast/yoastcs": "^3.1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.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", + "security": "https://github.com/Yoast/PHPUnit-Polyfills/security/policy", + "source": "https://github.com/Yoast/PHPUnit-Polyfills" + }, + "time": "2024-09-06T22:38:28+00:00" } ], "aliases": [], diff --git a/inc/class-anniversary.php b/inc/class-anniversary.php index c47d5d9..29841ef 100644 --- a/inc/class-anniversary.php +++ b/inc/class-anniversary.php @@ -13,6 +13,11 @@ * Sends an email to translators in their translation anniversary. */ class Anniversary { + public function __construct() { + add_action( 'wporg_translate_notification_anniversary', array( $this, 'send_email_to_translator' ) ); + add_action( 'wporg_translate_notification_summary_anniversary', array( $this, 'send_slack_notification' ) ); + } + /** * Send an email to translators in their translation anniversary. * @@ -21,9 +26,13 @@ class Anniversary { public function __invoke() { $all_users = $this->get_users_and_first_translation_date(); $anniversary_users = $this->get_translators_in_anniversary( $all_users ); - $number_of_translations = $this->get_number_of_translations( $anniversary_users ); - $this->send_email_to_translator( $anniversary_users, $number_of_translations ); - $this->send_slack_notification( $anniversary_users, $number_of_translations ); + $number_of_translations = array(); + foreach ( $anniversary_users as $user_id => $date ) { + $number_of_translations[ $user_id ] = $this->get_number_of_translations( $user_id ); + do_action( 'wporg_translate_notification_anniversary', $user_id, $date, $number_of_translations[ $user_id ] ); + } + + do_action( 'wporg_translate_notification_summary_anniversary', $anniversary_users, $number_of_translations ); } /** @@ -88,51 +97,45 @@ private function get_translators_in_anniversary( ?array $users ): array { /** * Get the number of translations for each user. * - * @param array|null $users An array with the user_id as key and the date of the first translation as value. + * @param int $user_id The user_id. * * @return array An array with the user_id as key and the number of translations as value. */ - private function get_number_of_translations( ?array $users ): array { - $number_of_translations = array(); + private function get_number_of_translations( int $user_id ): array { global $wpdb; - foreach ( $users as $user_id => $date ) { - // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching - $number_of_translations[ $user_id ] = $wpdb->get_var( - $wpdb->prepare( - "SELECT COUNT(id) - FROM translate_translations - WHERE user_id = %d - AND status = 'current'", - $user_id - ) - ); - } - - return $number_of_translations; + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching + return $wpdb->get_var( + $wpdb->prepare( + "SELECT COUNT(id) + FROM translate_translations + WHERE user_id = %d + AND status = 'current'", + $user_id + ) + ); } /** * Send an email to the translators. * - * @param array|null $anniversary_users The user_id (key) that have an anniversary and their start date (value. Y-m-d format). - * @param array|null $number_of_translations The number of translations for each user as value. The user_id is the key. + * @param int $anniversary_users The user_id (key) that have an anniversary and their start date (value. Y-m-d format). + * @param int $number_of_translations The number of translations for each user as value. The user_id is the key. * * @return void */ - private function send_email_to_translator( ?array $anniversary_users, ?array $number_of_translations ) { - foreach ( $anniversary_users as $user_id => $date ) { - $user = get_userdata( $user_id ); - $start_date = new \DateTime( $date ); - $today = new \DateTime(); - $interval = $start_date->diff( $today ); - $years = $interval->y; - - // translators: Email subject. - $subject = __( 'Happy translation anniversary! 🎂', 'wporg-gp-engagement' ); - - $message = sprintf( - // translators: Email body. %1$s: Display name. %2$d: number of years since the first translation. %3$d: number of translations. - _n( + private function send_email_to_translator( int $user_id, string $date, int $number_of_translations ) { + $user = get_userdata( $user_id ); + $start_date = new \DateTime( $date ); + $today = new \DateTime(); + $interval = $start_date->diff( $today ); + $years = $interval->y; + + // translators: Email subject. + $subject = __( 'Happy translation anniversary! 🎂', 'wporg-gp-engagement' ); + + $message = sprintf( + // translators: Email body. %1$s: Display name. %2$d: number of years since the first translation. %3$d: number of translations. + _n( ' Dear %1$s,

@@ -155,27 +158,21 @@ private function send_email_to_translator( ?array $anniversary_users, ?array $nu

The Global Polyglots Team ', - $years, - 'wporg-gp-engagement' - ), - $user->display_name, $years, - number_format_i18n( $number_of_translations[ $user_id ] ) - ); + 'wporg-gp-engagement' + ), + $user->display_name, + $years, + number_format_i18n( $number_of_translations ) + ); - $allowed_html = array( - 'br' => array(), - ); + $allowed_html = array( + 'br' => array(), + ); - $message = wp_kses( $message, $allowed_html ); + $message = wp_kses( $message, $allowed_html ); - $random_sentence = new Random_Sentence(); - $message .= '

💡 ' . esc_html__( 'Did you know...', 'wporg-gp-engagement' ) . '

'; - $message .= $random_sentence->random_string(); - - $email = new Notification(); - $email->send_email( $user, $subject, $message ); - } + do_action( 'wporg_translate_notification_email', $user, $subject, $message ); } /** @@ -201,8 +198,7 @@ private function send_slack_notification( ?array $anniversary_users, ?array $num number_format_i18n( $number_of_translations[ $user_id ] ) ); - $notification = new Notification(); - $notification->send_slack_notification( $message ); + do_action( 'wporg_translate_notification_slack', $message ); } } } diff --git a/inc/class-consistency.php b/inc/class-consistency.php index 633aef8..5cd6b85 100644 --- a/inc/class-consistency.php +++ b/inc/class-consistency.php @@ -18,6 +18,12 @@ class Consistency { * @var array */ private array $months_to_notify = array( 48, 24, 12, 6 ); + + public function __construct() { + add_action( 'wporg_translate_notification_consistency', array( $this, 'send_email_to_translator' ) ); + add_action( 'wporg_translate_notification_summary_consistency', array( $this, 'send_slack_notification' ) ); + } + /** * Send an email to translators in their translation anniversary. * @@ -25,8 +31,12 @@ class Consistency { */ public function __invoke() { $users_to_notify = $this->get_users_to_notify(); - $this->send_email_to_translators( $users_to_notify ); - $this->send_slack_notifications( $users_to_notify ); + foreach ( $users_to_notify as $months => $user_ids ) { + foreach ( $user_ids as $user_id ) { + do_action( 'wporg_translate_notification_consistency', $months, $user_id ); + } + } + do_action( 'wporg_translate_notification_summary_consistency', $users_to_notify ); } /** @@ -105,55 +115,46 @@ private function get_users_with_consistency_last_months( int $months = 6 ): arra * * @return void */ - private function send_email_to_translators( array $users_to_notify ): void { - foreach ( $users_to_notify as $months => $user_ids ) { - $years = intdiv( $months, 12 ); - // Translators: Number of years or months of translation consistency, to be used in the email subject. - $time_period = $years > 0 ? sprintf( _n( '%d year', '%d years', $years, 'wporg-gp-engagement' ), $years ) : sprintf( _n( '%d month', '%d months', $months, 'wporg-gp-engagement' ), $months ); + private function send_email_to_translators( $months, $user_id ): void { + $years = intdiv( $months, 12 ); + // Translators: Number of years or months of translation consistency, to be used in the email subject. + $time_period = $years > 0 ? sprintf( _n( '%d year', '%d years', $years, 'wporg-gp-engagement' ), $years ) : sprintf( _n( '%d month', '%d months', $months, 'wporg-gp-engagement' ), $months ); - // Translators: Email subject. %s is the number of years or months of translation consistency. - $subject = sprintf( __( 'Thank you for your %s of translation consistency! 🏆', 'wporg-gp-engagement' ), $time_period ); + // Translators: Email subject. %s is the number of years or months of translation consistency. + $subject = sprintf( __( 'Thank you for your %s of translation consistency! 🏆', 'wporg-gp-engagement' ), $time_period ); - foreach ( $user_ids as $user_id ) { - $user = get_user_by( 'id', $user_id ); - if ( ! $user ) { - continue; - } + $user = get_user_by( 'id', $user_id ); + if ( ! $user ) { + return; + } - if ( $this->has_the_notification_been_sent( $user_id, $months ) ) { - continue; - } + if ( $this->has_the_notification_been_sent( $user_id, $months ) ) { + return; + } - $message = sprintf( - // Translators: Email message. %1$s is the user display name, %2$s is the number of years or months of translation consistency. - __( - 'Dear %1$s,

Thank you for your %2$s of consistent translations at translate.wordpress.org. + $message = sprintf( + // Translators: Email message. %1$s is the user display name, %2$s is the number of years or months of translation consistency. + __( + 'Dear %1$s,

Thank you for your %2$s of consistent translations at translate.wordpress.org. Your contributions are invaluable in making WordPress available in multiple languages.

Best regards,

The Global Polyglots Team', - 'wporg-gp-engagement' - ), - $user->display_name, - $time_period - ); - - $allowed_html = array( - 'br' => array(), - ); + 'wporg-gp-engagement' + ), + $user->display_name, + $time_period + ); - $message = wp_kses( $message, $allowed_html ); + $allowed_html = array( + 'br' => array(), + ); - $random_sentence = new Random_Sentence(); - $message .= '

💡 ' . esc_html__( 'Did you know...', 'wporg-gp-engagement' ) . '

'; - $message .= $random_sentence->random_string(); + $message = wp_kses( $message, $allowed_html ); - $notification = new Notification(); - $notification->send_email( $user, $subject, $message ); - $this->update_user_option( $user_id, $months ); - } - } + do_action( 'wporg_translate_notification_email', $user, $subject, $message ); + $this->update_user_option( $user_id, $months ); } /** @@ -189,8 +190,7 @@ private function send_slack_notifications( array $users_to_notify ) { $time_period ); - $notification = new Notification(); - $notification->send_slack_notification( $message ); + do_action( 'wporg_translate_notification_slack', $message ); } } diff --git a/inc/class-first-translation.php b/inc/class-first-translation.php index 86deea8..d2d6ea1 100644 --- a/inc/class-first-translation.php +++ b/inc/class-first-translation.php @@ -15,6 +15,11 @@ * Sends an email to translators who for the first time had a translation approved. */ class First_Translation { + public function __construct() { + add_action( 'wporg_translate_notification_first_translation', array( $this, 'send_email_to_translator' ) ); + add_action( 'wporg_translate_notification_summary_first_translation', array( $this, 'send_slack_notification' ) ); + } + /** * Send an email to translators who for the first time today had a translation approved. * @@ -33,9 +38,10 @@ public function __invoke( ?GP_Translation $translation ) { return; } - $this->send_email_to_translator( $translation ); + do_action( 'wporg_translate_notification_first_translation', $translation ); $this->update_user_option( $translation->user_id ); - $this->send_slack_notification( $translation ); + do_action( 'wporg_translate_notification_summary_first_translation', $translation ); + } /** @@ -170,12 +176,7 @@ private function send_email_to_translator( GP_Translation $translation ) { $message = wp_kses( $message, $allowed_html ); - $random_sentence = new Random_Sentence(); - $message .= '

💡 ' . esc_html__( 'Did you know...', 'wporg-gp-engagement' ) . '

'; - $message .= $random_sentence->random_string(); - - $notification = new Notification(); - $notification->send_email( $user, $subject, $message ); + do_action( 'wporg_translate_notification_email', $user, $subject, $message ); } /** @@ -200,8 +201,7 @@ private function send_slack_notification( GP_Translation $translation ) { $project_url ); - $notification = new Notification(); - $notification->send_slack_notification( $message ); + do_action( 'wporg_translate_notification_slack', $message ); } /** diff --git a/inc/class-inactive.php b/inc/class-inactive.php index 9907a63..9ffd826 100644 --- a/inc/class-inactive.php +++ b/inc/class-inactive.php @@ -14,7 +14,11 @@ * Sends an email to translators in their translation anniversary. */ class Inactive { - /** + public function __construct() { + add_action( 'wporg_translate_notification_inactive', array( $this, 'send_email_to_translator' ) ); + add_action( 'wporg_translate_notification_summary_inactive', array( $this, 'send_slack_notification' ) ); + } + /** * Send an email to translators who have been inactive in the last years. * * @return void @@ -23,8 +27,11 @@ public function __invoke() { $one_year_ago = ( new DateTime() )->modify( '-1 year' )->format( 'Y-m-d' ); $all_users = $this->get_users_with_translation_on_date( $one_year_ago ); $inactive_users = $this->get_inactive_users( $all_users, $one_year_ago ); - $this->send_email_to_translators( $inactive_users ); - $this->send_slack_notification( $inactive_users ); + foreach ( $inactive_users as $user_id ) { + do_action( 'wporg_translate_notification_inactive', $user_id ); + } + + do_action( 'wporg_translate_notification_summary_inactive', $inactive_users ); } /** @@ -101,18 +108,17 @@ private function get_inactive_users( ?array $users, string $date ): array { /** * Send an email to the inactive translators. * - * @param array $inactive_users An array with the user_id of the inactive users. + * @param int $user_id The user_id of the inactive users. * * @return void */ - private function send_email_to_translators( array $inactive_users ) { + private function send_email_to_translators( int $user_id ) { $subject = esc_html__( 'We did not see you in the last year and we miss you! ⏳', 'wporg-gp-engagement' ); - foreach ( $inactive_users as $user_id ) { - $user = get_user_by( 'id', $user_id ); - $message = sprintf( - // translators: Email body. %s: Display name. - __( - 'We miss you, %s, + $user = get_user_by( 'id', $user_id ); + $message = sprintf( + // translators: Email body. %s: Display name. + __( + 'We miss you, %s,

we\'re writing you because you have previously contributed to translate.wordpress.org. Thank you for that!

@@ -124,24 +130,18 @@ private function send_email_to_translators( array $inactive_users ) {

The Global Polyglots Team ', - 'wporg-gp-engagement' - ), - $user->display_name, - ); - - $allowed_html = array( - 'br' => array(), - ); + 'wporg-gp-engagement' + ), + $user->display_name, + ); - $message = wp_kses( $message, $allowed_html ); + $allowed_html = array( + 'br' => array(), + ); - $random_sentence = new Random_Sentence(); - $message .= '

💡 ' . esc_html__( 'Did you know...', 'wporg-gp-engagement' ) . '

'; - $message .= $random_sentence->random_string(); + $message = wp_kses( $message, $allowed_html ); - $notification = new Notification(); - $notification->send_email( $user, $subject, $message ); - } + do_action( 'wporg_translate_notification_slack', $message ); } /** @@ -172,7 +172,6 @@ private function send_slack_notification( array $inactive_users ) { $users_list ); - $notification = new Notification(); - $notification->send_slack_notification( $message ); + do_action( 'wporg_translate_notification_slack', $message ); } } diff --git a/inc/class-notification.php b/inc/class-notification.php index dc2362d..1407447 100644 --- a/inc/class-notification.php +++ b/inc/class-notification.php @@ -50,6 +50,10 @@ public function send_email( ?WP_User $user, string $subject, string $message ) { 'From: Translating WordPress.org ', ); + $random_sentence = new Random_Sentence(); + $message .= '

💡 ' . esc_html__( 'Did you know...', 'wporg-gp-engagement' ) . '

'; + $message .= $random_sentence->random_string(); + if ( defined( 'WPORG_SANDBOXED' ) && WPORG_SANDBOXED ) { $email = $this->testing_email; wp_mail( $email, $subject, $message, $headers ); diff --git a/inc/class-plugin.php b/inc/class-plugin.php index 517d2c9..2e00088 100644 --- a/inc/class-plugin.php +++ b/inc/class-plugin.php @@ -52,6 +52,10 @@ public function __construct() { add_action( 'gp_engagement_anniversary', array( new Anniversary(), '__invoke' ) ); add_action( 'gp_engagement_inactive', array( new Inactive(), '__invoke' ) ); add_action( 'gp_engagement_consistency', array( new Consistency(), '__invoke' ) ); + + $notification = new Notification(); + add_action( 'wporg_translate_notification_email', array( $notification, 'send_email' ) ); + add_action( 'wporg_translate_notification_slack', array( $notification, 'send_slack_notification' ) ); } /** @@ -108,4 +112,9 @@ public function wp_schedule_crons() { wp_schedule_event( $timestamp, 'monthly', 'gp_engagement_consistency' ); } } + + public function send_notification_email( $user, $subject, $message ) { + $email = new Notification(); + $email->send_email( $user, $subject, $message ); + } } diff --git a/inc/class-translation-milestone.php b/inc/class-translation-milestone.php index 8a8b413..d2af1a9 100644 --- a/inc/class-translation-milestone.php +++ b/inc/class-translation-milestone.php @@ -34,6 +34,11 @@ class Translation_Milestone { 1000000, ); + public function __construct() { + add_action( 'wporg_translate_notification_milestone', array( $this, 'send_email_to_translator' ) ); + add_action( 'wporg_translate_notification_summary_milestone', array( $this, 'send_slack_notification' ) ); + } + /** * Send an email to translators who reached a translation milestone. * @@ -49,8 +54,8 @@ public function __invoke( ?GP_Translation $translation ) { if ( ! $milestone ) { return; } - $this->send_email_to_translator( $translation, $milestone ); - $this->send_slack_notification( $translation, $milestone ); + do_action( 'wporg_translate_notification_milestone', $translation, $milestone ); + do_action( 'wporg_translate_notification_summary_milestone', $translation, $milestone ); } /** @@ -140,12 +145,7 @@ private function send_email_to_translator( GP_Translation $translation, int $mil $message = wp_kses( $message, $allowed_html ); - $random_sentence = new Random_Sentence(); - $message .= '

💡 ' . esc_html__( 'Did you know...', 'wporg-gp-engagement' ) . '

'; - $message .= $random_sentence->random_string(); - - $email = new Notification(); - $email->send_email( $user, $subject, $message ); + do_action( 'wporg_translate_notification_email', $user, $subject, $message ); } /** @@ -166,7 +166,6 @@ private function send_slack_notification( GP_Translation $translation, int $mile number_format_i18n( $milestone ), ); - $notification = new Notification(); - $notification->send_slack_notification( $message ); + do_action( 'wporg_translate_notification_slack', $message ); } } diff --git a/phpunit.xml.dist b/phpunit.xml.dist new file mode 100644 index 0000000..56a71a1 --- /dev/null +++ b/phpunit.xml.dist @@ -0,0 +1,18 @@ + + + + + ./tests/ + + + + + + diff --git a/tests/bootstrap.php b/tests/bootstrap.php new file mode 100644 index 0000000..9ee8f4e --- /dev/null +++ b/tests/bootstrap.php @@ -0,0 +1,50 @@ +factory->user->create(); + $translation = $this->factory->translation->create( array( + 'status' => 'current', + 'locale' => 'en', + 'translation_set_id' => 1, + 'user_id' => $user, + 'user_id_last_modified' => $user, + ) ); + + remove_all_actions( 'wporg_translate_notification_milestone' ); + remove_all_actions( 'wporg_translate_notification_summary_milestone' ); + + $mock = new \MockAction(); + add_action( 'wporg_translate_notification_milestone', array( $mock, 'action' ), 10, 2 ); + + $translation_milestone = new Translation_Milestone(); + $translation_milestone( $translation ); + + // Ensure the email was sent. + $this->assertEquals( 1, $mock->get_call_count() ); + } +} diff --git a/tests/test-consistency.php b/tests/test-consistency.php new file mode 100644 index 0000000..923697d --- /dev/null +++ b/tests/test-consistency.php @@ -0,0 +1,5 @@ +prefix = $prefix; + $this->prefix_length = strlen( $prefix ); + $this->path = trailingslashit( $path ); + } + + /** + * Loads a class if it starts with `$this->prefix`. + * + * @param string $class The class to be loaded. + */ + public function load( $class ) { + if ( strpos( $class, $this->prefix . self::NS_SEPARATOR ) !== 0 ) { + return; + } + + // Strip prefix from the start (ala PSR-4) + $class = substr( $class, $this->prefix_length + 1 ); + $class = strtolower( $class ); + $file = ''; + + if ( false !== ( $last_ns_pos = strripos( $class, self::NS_SEPARATOR ) ) ) { + $namespace = substr( $class, 0, $last_ns_pos ); + $namespace = str_replace( '_', '-', $namespace ); + $class = substr( $class, $last_ns_pos + 1 ); + $file = str_replace( self::NS_SEPARATOR, DIRECTORY_SEPARATOR, $namespace ) . DIRECTORY_SEPARATOR; + } + + $file .= 'class-' . str_replace( '_', '-', $class ) . '.php'; + + $path = $this->path . $file; + + if ( file_exists( $path ) ) { + require $path; + } + } +} + +/** + * Registers Autoloader's autoload function. + * + * @param string $prefix + * @param string $path + */ +function register_class_path( $prefix, $path ) { + $loader = new Autoloader( $prefix, $path ); + spl_autoload_register( array( $loader, 'load' ) ); +} From f5d5dcc4c2328eb52498d7a458396e453e070381 Mon Sep 17 00:00:00 2001 From: Alex Kirk Date: Tue, 3 Dec 2024 16:02:14 +0100 Subject: [PATCH 02/14] Add Github workflow --- .github/workflows/coding-standards.yml | 29 +++++++++++++ .github/workflows/tests.yml | 56 ++++++++++++++++++++++++++ .phpunit.result.cache | 1 - 3 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/coding-standards.yml create mode 100644 .github/workflows/tests.yml delete mode 100644 .phpunit.result.cache diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml new file mode 100644 index 0000000..180b493 --- /dev/null +++ b/.github/workflows/coding-standards.yml @@ -0,0 +1,29 @@ +name: Coding standards + +on: + pull_request: + types: [ opened, synchronize ] + +jobs: + phpcs: + name: phpcs + runs-on: ubuntu-latest + + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Install PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.3' + coverage: 'none' + tools: composer, cs2pr + + - name: Install dependencies + uses: ramsey/composer-install@v2 + with: + composer-options: "--no-progress --no-ansi --no-interaction" + + - name: Run PHPCS + run: vendor/bin/phpcs --standard=phpcs.xml -q --report=checkstyle | cs2pr --notices-as-warnings diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..067dcb6 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,56 @@ +name: Tests + +on: + pull_request: + types: [ opened, synchronize ] + +jobs: + phpunit: + name: PHPUnit ${{ matrix.php }} + runs-on: ubuntu-latest + + services: + mysql: + image: mysql:5.7 + ports: + - 3306/tcp + env: + MYSQL_ROOT_PASSWORD: password + # Set health checks to wait until mysql has started + options: >- + --health-cmd "mysqladmin ping" + --health-interval 10s + --health-timeout 5s + --health-retries 3 + + strategy: + fail-fast: false + matrix: + php: [ '7.4', '8.3' ] + + steps: + - name: Check out Git repository + uses: actions/checkout@v4 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + coverage: 'none' + tools: composer + + - name: Install dependencies + uses: ramsey/composer-install@v2 + with: + composer-options: "--no-progress --no-ansi --no-interaction" + + - name: Install WordPress test setup + run: bash bin/install-wp-tests.sh wordpress_test root password 127.0.0.1:${{ job.services.mysql.ports[3306] }} latest + + - name: Setup problem matchers for PHPUnit + run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" + + - name: Run tests + env: + WP_TESTS_DIR: /tmp/wordpress-tests-lib/ + run: vendor/bin/phpunit diff --git a/.phpunit.result.cache b/.phpunit.result.cache deleted file mode 100644 index c08d6fa..0000000 --- a/.phpunit.result.cache +++ /dev/null @@ -1 +0,0 @@ -{"version":1,"defects":{"WordPressdotorg\\GlotPress\\Engagement\\Anniversary_Test::test_anniversary":3},"times":{"WordPressdotorg\\GlotPress\\Engagement\\Anniversary_Test::test_anniversary":0.021}} \ No newline at end of file From bc37a5c2c1568385093644dea1d1e1abf6e1d581 Mon Sep 17 00:00:00 2001 From: Alex Kirk Date: Tue, 3 Dec 2024 16:15:32 +0100 Subject: [PATCH 03/14] Make first test pass --- inc/class-anniversary.php | 35 ++++++++++++++++------------- inc/class-consistency.php | 6 ++--- inc/class-first-translation.php | 4 ++-- inc/class-inactive.php | 4 ++-- inc/class-plugin.php | 2 +- inc/class-translation-milestone.php | 8 +++---- phpunit.xml.dist | 1 + tests/test-anniversary.php | 28 ++++++++++++++++++----- 8 files changed, 54 insertions(+), 34 deletions(-) diff --git a/inc/class-anniversary.php b/inc/class-anniversary.php index 29841ef..d031bc0 100644 --- a/inc/class-anniversary.php +++ b/inc/class-anniversary.php @@ -14,8 +14,8 @@ */ class Anniversary { public function __construct() { - add_action( 'wporg_translate_notification_anniversary', array( $this, 'send_email_to_translator' ) ); - add_action( 'wporg_translate_notification_summary_anniversary', array( $this, 'send_slack_notification' ) ); + add_action( 'wporg_translate_notification_anniversary', array( $this, 'send_email_to_translator' ), 10, 3 ); + add_action( 'wporg_translate_notification_summary_anniversary', array( $this, 'send_slack_notification' ), 10, 2 ); } /** @@ -45,10 +45,10 @@ private function get_users_and_first_translation_date(): array { $users = array(); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching - $max_user_id = $wpdb->get_var( 'SELECT MAX(user_id) FROM translate_translations' ); + $max_user_id = $wpdb->get_var( "SELECT MAX(user_id) FROM {$wpdb->gp_translations}" ); // Todo: change to 1. - $first_id = 21_000_000; + $first_id = 1; $batch_size = 50_000; do { @@ -101,16 +101,18 @@ private function get_translators_in_anniversary( ?array $users ): array { * * @return array An array with the user_id as key and the number of translations as value. */ - private function get_number_of_translations( int $user_id ): array { + private function get_number_of_translations( int $user_id ): int { global $wpdb; // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching - return $wpdb->get_var( - $wpdb->prepare( - "SELECT COUNT(id) - FROM translate_translations - WHERE user_id = %d - AND status = 'current'", - $user_id + return intval( + $wpdb->get_var( + $wpdb->prepare( + "SELECT COUNT(id) + FROM {$wpdb->gp_translations} + WHERE user_id = %d + AND status = 'current'", + $user_id + ) ) ); } @@ -118,12 +120,13 @@ private function get_number_of_translations( int $user_id ): array { /** * Send an email to the translators. * - * @param int $anniversary_users The user_id (key) that have an anniversary and their start date (value. Y-m-d format). - * @param int $number_of_translations The number of translations for each user as value. The user_id is the key. + * @param int $user_id The user_id of the anniversary user. + * @param string $date The user's first translation date (Y-m-d format). + * @param int $number_of_translations The number of translations made so far. * * @return void */ - private function send_email_to_translator( int $user_id, string $date, int $number_of_translations ) { + public function send_email_to_translator( int $user_id, string $date, int $number_of_translations ) { $user = get_userdata( $user_id ); $start_date = new \DateTime( $date ); $today = new \DateTime(); @@ -183,7 +186,7 @@ private function send_email_to_translator( int $user_id, string $date, int $numb * * @return void */ - private function send_slack_notification( ?array $anniversary_users, ?array $number_of_translations ) { + public function send_slack_notification( ?array $anniversary_users, ?array $number_of_translations ) { if ( ! $anniversary_users ) { return; } diff --git a/inc/class-consistency.php b/inc/class-consistency.php index 5cd6b85..f435ca2 100644 --- a/inc/class-consistency.php +++ b/inc/class-consistency.php @@ -20,7 +20,7 @@ class Consistency { private array $months_to_notify = array( 48, 24, 12, 6 ); public function __construct() { - add_action( 'wporg_translate_notification_consistency', array( $this, 'send_email_to_translator' ) ); + add_action( 'wporg_translate_notification_consistency', array( $this, 'send_email_to_translator' ), 10, 2 ); add_action( 'wporg_translate_notification_summary_consistency', array( $this, 'send_slack_notification' ) ); } @@ -115,7 +115,7 @@ private function get_users_with_consistency_last_months( int $months = 6 ): arra * * @return void */ - private function send_email_to_translators( $months, $user_id ): void { + public function send_email_to_translators( $months, $user_id ): void { $years = intdiv( $months, 12 ); // Translators: Number of years or months of translation consistency, to be used in the email subject. $time_period = $years > 0 ? sprintf( _n( '%d year', '%d years', $years, 'wporg-gp-engagement' ), $years ) : sprintf( _n( '%d month', '%d months', $months, 'wporg-gp-engagement' ), $months ); @@ -162,7 +162,7 @@ private function send_email_to_translators( $months, $user_id ): void { * * @param array $users_to_notify The users to notify. */ - private function send_slack_notifications( array $users_to_notify ) { + public function send_slack_notifications( array $users_to_notify ) { foreach ( $users_to_notify as $months => $user_ids ) { $years = intdiv( $months, 12 ); // Translators: Number of years or months of translation consistency, to be used in the Slack message. diff --git a/inc/class-first-translation.php b/inc/class-first-translation.php index d2d6ea1..f284806 100644 --- a/inc/class-first-translation.php +++ b/inc/class-first-translation.php @@ -112,7 +112,7 @@ private function date_of_first_approved_translation( int $user_id ): string { * * @return void */ - private function send_email_to_translator( GP_Translation $translation ) { + public function send_email_to_translator( GP_Translation $translation ) { $notification_elements = $this->get_notification_elements( $translation ); if ( false === $notification_elements ) { return; @@ -186,7 +186,7 @@ private function send_email_to_translator( GP_Translation $translation ) { * * @return void */ - private function send_slack_notification( GP_Translation $translation ) { + public function send_slack_notification( GP_Translation $translation ) { $notification_elements = $this->get_notification_elements( $translation ); if ( false === $notification_elements ) { return; diff --git a/inc/class-inactive.php b/inc/class-inactive.php index 9ffd826..40b1761 100644 --- a/inc/class-inactive.php +++ b/inc/class-inactive.php @@ -112,7 +112,7 @@ private function get_inactive_users( ?array $users, string $date ): array { * * @return void */ - private function send_email_to_translators( int $user_id ) { + public function send_email_to_translators( int $user_id ) { $subject = esc_html__( 'We did not see you in the last year and we miss you! ⏳', 'wporg-gp-engagement' ); $user = get_user_by( 'id', $user_id ); $message = sprintf( @@ -151,7 +151,7 @@ private function send_email_to_translators( int $user_id ) { * * @return void */ - private function send_slack_notification( array $inactive_users ) { + public function send_slack_notification( array $inactive_users ) { $users = array(); foreach ( $inactive_users as $user_id ) { $user = get_userdata( $user_id ); diff --git a/inc/class-plugin.php b/inc/class-plugin.php index 2e00088..fcfb728 100644 --- a/inc/class-plugin.php +++ b/inc/class-plugin.php @@ -54,7 +54,7 @@ public function __construct() { add_action( 'gp_engagement_consistency', array( new Consistency(), '__invoke' ) ); $notification = new Notification(); - add_action( 'wporg_translate_notification_email', array( $notification, 'send_email' ) ); + add_action( 'wporg_translate_notification_email', array( $notification, 'send_email' ), 10, 3 ); add_action( 'wporg_translate_notification_slack', array( $notification, 'send_slack_notification' ) ); } diff --git a/inc/class-translation-milestone.php b/inc/class-translation-milestone.php index d2af1a9..10793f7 100644 --- a/inc/class-translation-milestone.php +++ b/inc/class-translation-milestone.php @@ -35,8 +35,8 @@ class Translation_Milestone { ); public function __construct() { - add_action( 'wporg_translate_notification_milestone', array( $this, 'send_email_to_translator' ) ); - add_action( 'wporg_translate_notification_summary_milestone', array( $this, 'send_slack_notification' ) ); + add_action( 'wporg_translate_notification_milestone', array( $this, 'send_email_to_translator' ), 10, 2 ); + add_action( 'wporg_translate_notification_summary_milestone', array( $this, 'send_slack_notification' ), 10, 2 ); } /** @@ -116,7 +116,7 @@ private function is_milestone( ?GP_Translation $translation ) { * * @return void */ - private function send_email_to_translator( GP_Translation $translation, int $milestone ) { + public function send_email_to_translator( GP_Translation $translation, int $milestone ) { $user = get_userdata( $translation->user_id ); $subject = sprintf( // translators: Email subject. @@ -156,7 +156,7 @@ private function send_email_to_translator( GP_Translation $translation, int $mil * * @return void */ - private function send_slack_notification( GP_Translation $translation, int $milestone ) { + public function send_slack_notification( GP_Translation $translation, int $milestone ) { $user = get_userdata( $translation->user_id ); // translators: Slack message. %s: Display name. %d: Milestone. diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 56a71a1..203cd1b 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -6,6 +6,7 @@ convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" + testdox="true" > diff --git a/tests/test-anniversary.php b/tests/test-anniversary.php index fa1b1ec..7dbfde4 100644 --- a/tests/test-anniversary.php +++ b/tests/test-anniversary.php @@ -2,8 +2,23 @@ namespace WordPressdotorg\GlotPress\Engagement; class Anniversary_Test extends \GP_UnitTestCase { - public function test_anniversary() { + + public function anniversary_data_provider() { + return array( + 'today' => array( time(), 0 ), + '1 years ago' => array( strtotime( '-1 year' ), 1 ), + '1.5 years ago' => array( strtotime( '-1.5 year' ), 0 ), + '2 years ago' => array( strtotime( '-2 year' ), 1 ), + ); + } + + /** + * @dataProvider anniversary_data_provider + */ + public function test_anniversary( $date, $expected ) { + $user = $this->factory->user->create(); + $translation = $this->factory->translation->create( array( 'status' => 'current', 'locale' => 'en', @@ -12,16 +27,17 @@ public function test_anniversary() { 'user_id_last_modified' => $user, ) ); + $translation->update( array( 'date_added' => date( 'Y-m-d H:i:s', $date ) ) ); + remove_all_actions( 'wporg_translate_notification_milestone' ); remove_all_actions( 'wporg_translate_notification_summary_milestone' ); $mock = new \MockAction(); - add_action( 'wporg_translate_notification_milestone', array( $mock, 'action' ), 10, 2 ); + add_action( 'wporg_translate_notification_anniversary', array( $mock, 'action' ), 10, 2 ); - $translation_milestone = new Translation_Milestone(); - $translation_milestone( $translation ); + $anniversary = new Anniversary(); + $anniversary(); - // Ensure the email was sent. - $this->assertEquals( 1, $mock->get_call_count() ); + $this->assertEquals( $expected, $mock->get_call_count() ); } } From f968c865f158e41fa950c77c6765aa7afece9da1 Mon Sep 17 00:00:00 2001 From: Alex Kirk Date: Tue, 3 Dec 2024 16:27:03 +0100 Subject: [PATCH 04/14] Fix linting --- bin/install-wp-tests.sh | 7 ++++- inc/class-anniversary.php | 13 ++++---- inc/class-consistency.php | 16 ++++++---- inc/class-first-translation.php | 4 ++- inc/class-inactive.php | 17 ++++++----- inc/class-plugin.php | 5 ---- inc/class-translation-milestone.php | 3 ++ phpcs.xml | 6 +++- tests/bootstrap.php | 12 +++++++- tests/test-anniversary.php | 44 ++++++++++++++++++++-------- tests/test-consistency.php | 9 ++++++ tests/test-first-translation.php | 10 +++++++ tests/test-inactive.php | 9 ++++++ tests/test-translation-milestone.php | 9 ++++++ 14 files changed, 125 insertions(+), 39 deletions(-) diff --git a/bin/install-wp-tests.sh b/bin/install-wp-tests.sh index 1c036e2..36fd652 100755 --- a/bin/install-wp-tests.sh +++ b/bin/install-wp-tests.sh @@ -92,7 +92,7 @@ install_wp() { tar --strip-components=1 -zxmf $TMPDIR/wordpress.tar.gz -C $WP_CORE_DIR fi - download https://raw.github.com/markoheijnen/wp-mysqli/master/db.php $WP_CORE_DIR/wp-content/db.php + download https://raw.githubusercontent.com/markoheijnen/wp-mysqli/master/db.php $WP_CORE_DIR/wp-content/db.php } install_test_suite() { @@ -176,6 +176,11 @@ install_db() { fi } +install_gp() { + git clone --branch develop --single-branch -q https://github.com/GlotPress/GlotPress.git "$WP_CORE_DIR/wp-content/plugins/glotpress" +} + install_wp install_test_suite install_db +install_gp diff --git a/inc/class-anniversary.php b/inc/class-anniversary.php index d031bc0..1ec2dcb 100644 --- a/inc/class-anniversary.php +++ b/inc/class-anniversary.php @@ -13,6 +13,9 @@ * Sends an email to translators in their translation anniversary. */ class Anniversary { + /** + * Constructor. + */ public function __construct() { add_action( 'wporg_translate_notification_anniversary', array( $this, 'send_email_to_translator' ), 10, 3 ); add_action( 'wporg_translate_notification_summary_anniversary', array( $this, 'send_slack_notification' ), 10, 2 ); @@ -103,8 +106,8 @@ private function get_translators_in_anniversary( ?array $users ): array { */ private function get_number_of_translations( int $user_id ): int { global $wpdb; - // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching return intval( + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(id) @@ -120,9 +123,9 @@ private function get_number_of_translations( int $user_id ): int { /** * Send an email to the translators. * - * @param int $user_id The user_id of the anniversary user. + * @param int $user_id The user_id of the anniversary user. * @param string $date The user's first translation date (Y-m-d format). - * @param int $number_of_translations The number of translations made so far. + * @param int $number_of_translations The number of translations made so far. * * @return void */ @@ -139,7 +142,7 @@ public function send_email_to_translator( int $user_id, string $date, int $numbe $message = sprintf( // translators: Email body. %1$s: Display name. %2$d: number of years since the first translation. %3$d: number of translations. _n( - ' + ' Dear %1$s,

do you remember? On this day, %2$d year ago, you contributed your first translation to translate.wordpress.org. @@ -150,7 +153,7 @@ public function send_email_to_translator( int $user_id, string $date, int $numbe

The Global Polyglots Team ', - ' + ' Dear %1$s,

do you remember? On this day, %2$d years ago, you contributed your first translation to translate.wordpress.org. diff --git a/inc/class-consistency.php b/inc/class-consistency.php index f435ca2..4ecd711 100644 --- a/inc/class-consistency.php +++ b/inc/class-consistency.php @@ -19,6 +19,9 @@ class Consistency { */ private array $months_to_notify = array( 48, 24, 12, 6 ); + /** + * Constructor. + */ public function __construct() { add_action( 'wporg_translate_notification_consistency', array( $this, 'send_email_to_translator' ), 10, 2 ); add_action( 'wporg_translate_notification_summary_consistency', array( $this, 'send_slack_notification' ) ); @@ -111,11 +114,12 @@ private function get_users_with_consistency_last_months( int $months = 6 ): arra /** * Send an email to the translators. * - * @param array $users_to_notify The users to notify. + * @param int $months The number of months. + * @param int $user_id The user ID. * * @return void */ - public function send_email_to_translators( $months, $user_id ): void { + public function send_email_to_translators( int $months, int $user_id ): void { $years = intdiv( $months, 12 ); // Translators: Number of years or months of translation consistency, to be used in the email subject. $time_period = $years > 0 ? sprintf( _n( '%d year', '%d years', $years, 'wporg-gp-engagement' ), $years ) : sprintf( _n( '%d month', '%d months', $months, 'wporg-gp-engagement' ), $months ); @@ -158,12 +162,12 @@ public function send_email_to_translators( $months, $user_id ): void { } /** - * Send a Slack notification to the users + * Send a Slack notification about the notified users * - * @param array $users_to_notify The users to notify. + * @param array $users_notified The users that were notify. */ - public function send_slack_notifications( array $users_to_notify ) { - foreach ( $users_to_notify as $months => $user_ids ) { + public function send_slack_notifications( array $users_notified ) { + foreach ( $users_notified as $months => $user_ids ) { $years = intdiv( $months, 12 ); // Translators: Number of years or months of translation consistency, to be used in the Slack message. $time_period = $years > 0 ? sprintf( _n( '%d year', '%d years', $years, 'wporg-gp-engagement' ), $years ) : sprintf( _n( '%d month', '%d months', $months, 'wporg-gp-engagement' ), $months ); diff --git a/inc/class-first-translation.php b/inc/class-first-translation.php index f284806..bb65725 100644 --- a/inc/class-first-translation.php +++ b/inc/class-first-translation.php @@ -15,6 +15,9 @@ * Sends an email to translators who for the first time had a translation approved. */ class First_Translation { + /** + * Constructor. + */ public function __construct() { add_action( 'wporg_translate_notification_first_translation', array( $this, 'send_email_to_translator' ) ); add_action( 'wporg_translate_notification_summary_first_translation', array( $this, 'send_slack_notification' ) ); @@ -41,7 +44,6 @@ public function __invoke( ?GP_Translation $translation ) { do_action( 'wporg_translate_notification_first_translation', $translation ); $this->update_user_option( $translation->user_id ); do_action( 'wporg_translate_notification_summary_first_translation', $translation ); - } /** diff --git a/inc/class-inactive.php b/inc/class-inactive.php index 40b1761..2339a02 100644 --- a/inc/class-inactive.php +++ b/inc/class-inactive.php @@ -14,22 +14,25 @@ * Sends an email to translators in their translation anniversary. */ class Inactive { + /** + * Constructor. + */ public function __construct() { add_action( 'wporg_translate_notification_inactive', array( $this, 'send_email_to_translator' ) ); add_action( 'wporg_translate_notification_summary_inactive', array( $this, 'send_slack_notification' ) ); } /** - * Send an email to translators who have been inactive in the last years. - * - * @return void - */ + * Send an email to translators who have been inactive in the last years. + * + * @return void + */ public function __invoke() { $one_year_ago = ( new DateTime() )->modify( '-1 year' )->format( 'Y-m-d' ); $all_users = $this->get_users_with_translation_on_date( $one_year_ago ); $inactive_users = $this->get_inactive_users( $all_users, $one_year_ago ); - foreach ( $inactive_users as $user_id ) { - do_action( 'wporg_translate_notification_inactive', $user_id ); - } + foreach ( $inactive_users as $user_id ) { + do_action( 'wporg_translate_notification_inactive', $user_id ); + } do_action( 'wporg_translate_notification_summary_inactive', $inactive_users ); } diff --git a/inc/class-plugin.php b/inc/class-plugin.php index fcfb728..4e7c860 100644 --- a/inc/class-plugin.php +++ b/inc/class-plugin.php @@ -112,9 +112,4 @@ public function wp_schedule_crons() { wp_schedule_event( $timestamp, 'monthly', 'gp_engagement_consistency' ); } } - - public function send_notification_email( $user, $subject, $message ) { - $email = new Notification(); - $email->send_email( $user, $subject, $message ); - } } diff --git a/inc/class-translation-milestone.php b/inc/class-translation-milestone.php index 10793f7..dc7374f 100644 --- a/inc/class-translation-milestone.php +++ b/inc/class-translation-milestone.php @@ -34,6 +34,9 @@ class Translation_Milestone { 1000000, ); + /** + * Constructor. + */ public function __construct() { add_action( 'wporg_translate_notification_milestone', array( $this, 'send_email_to_translator' ), 10, 2 ); add_action( 'wporg_translate_notification_summary_milestone', array( $this, 'send_slack_notification' ), 10, 2 ); diff --git a/phpcs.xml b/phpcs.xml index 79d4c42..0ddacba 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -7,6 +7,10 @@ . inc + + tests/* + + */vendor/* @@ -17,4 +21,4 @@ - \ No newline at end of file + diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 9ee8f4e..3407df6 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -1,10 +1,21 @@ array( time(), 0 ), - '1 years ago' => array( strtotime( '-1 year' ), 1 ), + 'today' => array( time(), 0 ), + '1 years ago' => array( strtotime( '-1 year' ), 1 ), '1.5 years ago' => array( strtotime( '-1.5 year' ), 0 ), - '2 years ago' => array( strtotime( '-2 year' ), 1 ), + '2 years ago' => array( strtotime( '-2 year' ), 1 ), ); } /** + * Test the anniversary notification + * * @dataProvider anniversary_data_provider + * + * @param int $date The date to test. + * @param int $expected The expected number of calls to the mock action. */ public function test_anniversary( $date, $expected ) { $user = $this->factory->user->create(); - $translation = $this->factory->translation->create( array( - 'status' => 'current', - 'locale' => 'en', - 'translation_set_id' => 1, - 'user_id' => $user, - 'user_id_last_modified' => $user, - ) ); + $translation = $this->factory->translation->create( + array( + 'status' => 'current', + 'locale' => 'en', + 'translation_set_id' => 1, + 'user_id' => $user, + 'user_id_last_modified' => $user, + ) + ); - $translation->update( array( 'date_added' => date( 'Y-m-d H:i:s', $date ) ) ); + $translation->update( array( 'date_added' => gmdate( 'Y-m-d H:i:s', $date ) ) ); remove_all_actions( 'wporg_translate_notification_milestone' ); remove_all_actions( 'wporg_translate_notification_summary_milestone' ); diff --git a/tests/test-consistency.php b/tests/test-consistency.php index 923697d..9915bf4 100644 --- a/tests/test-consistency.php +++ b/tests/test-consistency.php @@ -1,5 +1,14 @@ Date: Tue, 3 Dec 2024 16:58:48 +0100 Subject: [PATCH 05/14] Add consistency tests --- inc/class-consistency.php | 61 +++++++++++++++++--------------------- phpunit.xml.dist | 2 +- tests/bootstrap.php | 3 ++ tests/test-anniversary.php | 10 +++---- tests/test-consistency.php | 53 +++++++++++++++++++++++++++++++-- 5 files changed, 88 insertions(+), 41 deletions(-) diff --git a/inc/class-consistency.php b/inc/class-consistency.php index 4ecd711..47f1254 100644 --- a/inc/class-consistency.php +++ b/inc/class-consistency.php @@ -17,14 +17,14 @@ class Consistency { * * @var array */ - private array $months_to_notify = array( 48, 24, 12, 6 ); + public array $months_to_notify = array( 48, 24, 12, 6 ); /** * Constructor. */ public function __construct() { - add_action( 'wporg_translate_notification_consistency', array( $this, 'send_email_to_translator' ), 10, 2 ); - add_action( 'wporg_translate_notification_summary_consistency', array( $this, 'send_slack_notification' ) ); + add_action( 'wporg_translate_notification_consistency', array( $this, 'send_email_to_translators' ), 10, 2 ); + add_action( 'wporg_translate_notification_summary_consistency', array( $this, 'send_slack_notification' ), 10, 2 ); } /** @@ -38,8 +38,10 @@ public function __invoke() { foreach ( $user_ids as $user_id ) { do_action( 'wporg_translate_notification_consistency', $months, $user_id ); } + if ( $user_ids ) { + do_action( 'wporg_translate_notification_summary_consistency', $months, $user_ids ); + } } - do_action( 'wporg_translate_notification_summary_consistency', $users_to_notify ); } /** @@ -101,11 +103,6 @@ private function get_users_with_consistency_last_months( int $months = 6 ): arra } else { $user_ids = array_intersect( $user_ids, $month_user_ids ); } - - // If no users are found in any month, return an empty array. - if ( empty( $user_ids ) ) { - return array(); - } } return array_values( $user_ids ); @@ -166,36 +163,34 @@ public function send_email_to_translators( int $months, int $user_id ): void { * * @param array $users_notified The users that were notify. */ - public function send_slack_notifications( array $users_notified ) { - foreach ( $users_notified as $months => $user_ids ) { - $years = intdiv( $months, 12 ); - // Translators: Number of years or months of translation consistency, to be used in the Slack message. - $time_period = $years > 0 ? sprintf( _n( '%d year', '%d years', $years, 'wporg-gp-engagement' ), $years ) : sprintf( _n( '%d month', '%d months', $months, 'wporg-gp-engagement' ), $months ); - - $users = array(); - foreach ( $user_ids as $user_id ) { - $user = get_userdata( $user_id ); - if ( ! $user ) { - continue; - } - $users[] = $user->display_name; - } + public function send_slack_notification( int $months, array $user_ids ) { + $years = intdiv( $months, 12 ); + // Translators: Number of years or months of translation consistency, to be used in the Slack message. + $time_period = $years > 0 ? sprintf( _n( '%d year', '%d years', $years, 'wporg-gp-engagement' ), $years ) : sprintf( _n( '%d month', '%d months', $months, 'wporg-gp-engagement' ), $months ); - if ( empty( $users ) ) { + $users = array(); + foreach ( $user_ids as $user_id ) { + $user = get_userdata( $user_id ); + if ( ! $user ) { continue; } + $users[] = $user->display_name; + } - $users_list = implode( ', ', $users ); + if ( empty( $users ) ) { + return; + } - // Translators: Slack message. - $message = sprintf( - 'We have sent a thank you message to *%s* for their %s of translation consistency.', - $users_list, - $time_period - ); + $users_list = implode( ', ', $users ); - do_action( 'wporg_translate_notification_slack', $message ); - } + // Translators: Slack message. + $message = sprintf( + 'We have sent a thank you message to *%s* for their %s of translation consistency.', + $users_list, + $time_period + ); + + do_action( 'wporg_translate_notification_slack', $message ); } /** diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 203cd1b..5d8392e 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -10,7 +10,7 @@ > - ./tests/ + ./tests/ diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 3407df6..4e657a0 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -58,3 +58,6 @@ function _manually_load_plugin() { require_once _glotpress_path( '/tests/phpunit/lib/testcase.php' ); require_once _glotpress_path( '/tests/phpunit/lib/testcase-route.php' ); require_once _glotpress_path( '/tests/phpunit/lib/testcase-request.php' ); + +// Require our own test code. +require_once __DIR__ . '/base-test.php'; diff --git a/tests/test-anniversary.php b/tests/test-anniversary.php index 5854952..65809fe 100644 --- a/tests/test-anniversary.php +++ b/tests/test-anniversary.php @@ -5,12 +5,12 @@ * @package wporg-gp-engagement */ -namespace WordPressdotorg\GlotPress\Engagement; +namespace Wporg\Tests; /** * Test the Anniversary class. */ -class Anniversary_Test extends \GP_UnitTestCase { +class Anniversary_Test extends Base_Test { /** * Data provider for the anniversary tests. * @@ -49,13 +49,13 @@ public function test_anniversary( $date, $expected ) { $translation->update( array( 'date_added' => gmdate( 'Y-m-d H:i:s', $date ) ) ); - remove_all_actions( 'wporg_translate_notification_milestone' ); - remove_all_actions( 'wporg_translate_notification_summary_milestone' ); + $anniversary = new \WordPressdotorg\GlotPress\Engagement\Anniversary(); + remove_all_actions( 'wporg_translate_notification_anniversary' ); + remove_all_actions( 'wporg_translate_notification_summary_anniversary' ); $mock = new \MockAction(); add_action( 'wporg_translate_notification_anniversary', array( $mock, 'action' ), 10, 2 ); - $anniversary = new Anniversary(); $anniversary(); $this->assertEquals( $expected, $mock->get_call_count() ); diff --git a/tests/test-consistency.php b/tests/test-consistency.php index 9915bf4..70de197 100644 --- a/tests/test-consistency.php +++ b/tests/test-consistency.php @@ -5,10 +5,59 @@ * @package wporg-gp-engagement */ -namespace WordPressdotorg\GlotPress\Engagement; +namespace Wporg\Tests; /** * Test the Consistency class. */ -class Consistency_Test { +class Consistency_Test extends Base_Test { + /** + * Data provider for the consistency tests. + * + * @return array + */ + public function consistency_data_provider() { + return array( + '3 months' => array( 3, 3 ), + '6 months' => array( 6, 2 ), + '12 months' => array( 12, 1 ), + ); + } + + /** + * Test notifications for consistently translating users. + * + * @dataProvider consistency_data_provider + * + * @param int $months The months to check. + * @param int $expected The expected number of users. + */ + public function test_users_with_consistent_translations( $months, $expected ) { + foreach ( + array( + // in which previous months did these users have translations? + array( 1, 2, 3, 4, 5, 6 ), + array( 1, 2, 3, 5, 6 ), + array( 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 ), + array( 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 ), + ) as $generate_months ) { + $user = $this->factory->user->create(); + foreach ( $generate_months as $month ) { + $translation = $this->factory->translation->create( array( 'user_id' => $user ) ); + $translation->update( array( 'date_added' => gmdate( 'Y-m-d H:i:s', strtotime( '-' . $month . ' months' ) ) ) ); + } + } + + $consistency = new \WordPressdotorg\GlotPress\Engagement\Consistency(); + remove_all_actions( 'wporg_translate_notification_consistency' ); + remove_all_actions( 'wporg_translate_notification_summary_consistency' ); + + $mock = new \MockAction(); + add_action( 'wporg_translate_notification_consistency', array( $mock, 'action' ), 10, 2 ); + + $consistency->months_to_notify = array( $months ); + $consistency(); + + $this->assertEquals( $expected, $mock->get_call_count() ); + } } From ff975a8b4514f5c9f9f0eae2f5afb8c807bbc358 Mon Sep 17 00:00:00 2001 From: Alex Kirk Date: Tue, 3 Dec 2024 17:00:14 +0100 Subject: [PATCH 06/14] Lint --- inc/class-consistency.php | 3 ++- tests/test-consistency.php | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/inc/class-consistency.php b/inc/class-consistency.php index 47f1254..17801e5 100644 --- a/inc/class-consistency.php +++ b/inc/class-consistency.php @@ -161,7 +161,8 @@ public function send_email_to_translators( int $months, int $user_id ): void { /** * Send a Slack notification about the notified users * - * @param array $users_notified The users that were notify. + * @param int $months The number of months. + * @param array $user_ids The user IDs. */ public function send_slack_notification( int $months, array $user_ids ) { $years = intdiv( $months, 12 ); diff --git a/tests/test-consistency.php b/tests/test-consistency.php index 70de197..69cd694 100644 --- a/tests/test-consistency.php +++ b/tests/test-consistency.php @@ -18,8 +18,8 @@ class Consistency_Test extends Base_Test { */ public function consistency_data_provider() { return array( - '3 months' => array( 3, 3 ), - '6 months' => array( 6, 2 ), + '3 months' => array( 3, 3 ), + '6 months' => array( 6, 2 ), '12 months' => array( 12, 1 ), ); } From 08dc818afa26b21745632e28af2fd48c953cae07 Mon Sep 17 00:00:00 2001 From: Alex Kirk Date: Tue, 3 Dec 2024 17:06:25 +0100 Subject: [PATCH 07/14] Set less info on translation --- tests/test-anniversary.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tests/test-anniversary.php b/tests/test-anniversary.php index 65809fe..c426e65 100644 --- a/tests/test-anniversary.php +++ b/tests/test-anniversary.php @@ -40,13 +40,9 @@ public function test_anniversary( $date, $expected ) { $translation = $this->factory->translation->create( array( 'status' => 'current', - 'locale' => 'en', - 'translation_set_id' => 1, 'user_id' => $user, - 'user_id_last_modified' => $user, ) ); - $translation->update( array( 'date_added' => gmdate( 'Y-m-d H:i:s', $date ) ) ); $anniversary = new \WordPressdotorg\GlotPress\Engagement\Anniversary(); From 508c472a465fa77405c0693aee85b4c22d62b534 Mon Sep 17 00:00:00 2001 From: Alex Kirk Date: Tue, 3 Dec 2024 17:07:14 +0100 Subject: [PATCH 08/14] Add missing file --- inc/class-anniversary.php | 2 +- tests/base-test.php | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 tests/base-test.php diff --git a/inc/class-anniversary.php b/inc/class-anniversary.php index 1ec2dcb..4a4d0d6 100644 --- a/inc/class-anniversary.php +++ b/inc/class-anniversary.php @@ -51,7 +51,7 @@ private function get_users_and_first_translation_date(): array { $max_user_id = $wpdb->get_var( "SELECT MAX(user_id) FROM {$wpdb->gp_translations}" ); // Todo: change to 1. - $first_id = 1; + $first_id = 21_000_000; $batch_size = 50_000; do { diff --git a/tests/base-test.php b/tests/base-test.php new file mode 100644 index 0000000..33e610c --- /dev/null +++ b/tests/base-test.php @@ -0,0 +1,36 @@ +fail( sprintf( 'The hook %s should never be called.', current_action() ) ); + } +} From 8d6f37bfc4620ba69f226d6334f0e3d90685c088 Mon Sep 17 00:00:00 2001 From: Alex Kirk Date: Tue, 3 Dec 2024 17:07:36 +0100 Subject: [PATCH 09/14] lint --- tests/test-anniversary.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test-anniversary.php b/tests/test-anniversary.php index c426e65..f8ff31d 100644 --- a/tests/test-anniversary.php +++ b/tests/test-anniversary.php @@ -39,8 +39,8 @@ public function test_anniversary( $date, $expected ) { $translation = $this->factory->translation->create( array( - 'status' => 'current', - 'user_id' => $user, + 'status' => 'current', + 'user_id' => $user, ) ); $translation->update( array( 'date_added' => gmdate( 'Y-m-d H:i:s', $date ) ) ); From eba5f8864def9cb5e4a9c0e288e6e424b12beaca Mon Sep 17 00:00:00 2001 From: Alex Kirk Date: Tue, 3 Dec 2024 19:25:10 +0100 Subject: [PATCH 10/14] Add First Translation test --- tests/test-first-translation.php | 77 +++++++++++++++++++++++++++++++- 1 file changed, 75 insertions(+), 2 deletions(-) diff --git a/tests/test-first-translation.php b/tests/test-first-translation.php index 3ef737a..5dc76e0 100644 --- a/tests/test-first-translation.php +++ b/tests/test-first-translation.php @@ -5,10 +5,83 @@ * @package wporg-gp-engagement */ -namespace WordPressdotorg\GlotPress\Engagement; +namespace Wporg\Tests; /** * Test the First_Translation class. */ -class First_Translation_Test { +class First_Translation_Test extends Base_Test { + + public function test_first_translation_notification() { + $user = $this->factory->user->create(); + $approver = $this->factory->user->create(); + $translation1 = $this->factory->translation->create( + array( + 'status' => 'waiting', + 'user_id' => $user, + ) + ); + $translation1->update( array( 'user_id_last_modified' => $approver, 'status' => 'current' ) ); + $translation1 = \GP::$translation->get( $translation1->id ); + + $first_translation = new \WordPressdotorg\GlotPress\Engagement\First_Translation(); + remove_all_actions( 'wporg_translate_notification_first_translation' ); + remove_all_actions( 'wporg_translate_notification_summary_first_translation' ); + + $mock = new \MockAction(); + add_action( 'wporg_translate_notification_first_translation', array( $mock, 'action' ), 10, 2 ); + + $first_translation( $translation1 ); + + $this->assertEquals( 1, $mock->get_call_count() ); + + $translation2 = $this->factory->translation->create( + array( + 'status' => 'current', + 'user_id' => $user, + ) + ); + + $first_translation( $translation1 ); + + $this->assertEquals( 1, $mock->get_call_count() ); + + } + + public function test_first_translation_hook_notification() { + $first_translation = new \WordPressdotorg\GlotPress\Engagement\First_Translation(); + add_action( 'gp_translation_saved', array( $first_translation, '__invoke' ) ); + + remove_all_actions( 'wporg_translate_notification_first_translation' ); + remove_all_actions( 'wporg_translate_notification_summary_first_translation' ); + + $mock = new \MockAction(); + add_action( 'wporg_translate_notification_first_translation', array( $mock, 'action' ), 10, 2 ); + + $user = $this->factory->user->create(); + $approver = $this->factory->user->create(); + $translation1 = $this->factory->translation->create( + array( + 'status' => 'waiting', + 'user_id' => $user, + ) + ); + $this->assertEquals( 0, $mock->get_call_count() ); + $translation1->save( array( 'user_id_last_modified' => $approver, 'status' => 'current' ) ); + $translation1 = \GP::$translation->get( $translation1->id ); + + $this->assertEquals( 1, $mock->get_call_count() ); + + $translation2 = $this->factory->translation->create( + array( + 'status' => 'current', + 'user_id' => $user, + ) + ); + + $first_translation( $translation1 ); + + $this->assertEquals( 1, $mock->get_call_count() ); + + } } From 7bd0c80f448c1c594a1fd9cdd79cbda06bb9a4a3 Mon Sep 17 00:00:00 2001 From: Alex Kirk Date: Tue, 3 Dec 2024 19:26:13 +0100 Subject: [PATCH 11/14] Set batch start to 1 again --- inc/class-anniversary.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/class-anniversary.php b/inc/class-anniversary.php index 4a4d0d6..1ec2dcb 100644 --- a/inc/class-anniversary.php +++ b/inc/class-anniversary.php @@ -51,7 +51,7 @@ private function get_users_and_first_translation_date(): array { $max_user_id = $wpdb->get_var( "SELECT MAX(user_id) FROM {$wpdb->gp_translations}" ); // Todo: change to 1. - $first_id = 21_000_000; + $first_id = 1; $batch_size = 50_000; do { From 01193ee6d7383617e8279379720fd466a482135b Mon Sep 17 00:00:00 2001 From: Alex Kirk Date: Tue, 3 Dec 2024 19:30:42 +0100 Subject: [PATCH 12/14] lint --- tests/test-first-translation.php | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/tests/test-first-translation.php b/tests/test-first-translation.php index 5dc76e0..dba1a51 100644 --- a/tests/test-first-translation.php +++ b/tests/test-first-translation.php @@ -11,17 +11,24 @@ * Test the First_Translation class. */ class First_Translation_Test extends Base_Test { - + /** + * Test the first translation notification. + */ public function test_first_translation_notification() { - $user = $this->factory->user->create(); - $approver = $this->factory->user->create(); + $user = $this->factory->user->create(); + $approver = $this->factory->user->create(); $translation1 = $this->factory->translation->create( array( 'status' => 'waiting', 'user_id' => $user, ) ); - $translation1->update( array( 'user_id_last_modified' => $approver, 'status' => 'current' ) ); + $translation1->update( + array( + 'user_id_last_modified' => $approver, + 'status' => 'current', + ) + ); $translation1 = \GP::$translation->get( $translation1->id ); $first_translation = new \WordPressdotorg\GlotPress\Engagement\First_Translation(); @@ -45,9 +52,11 @@ public function test_first_translation_notification() { $first_translation( $translation1 ); $this->assertEquals( 1, $mock->get_call_count() ); - } + /** + * Test the first translation hook notification. + */ public function test_first_translation_hook_notification() { $first_translation = new \WordPressdotorg\GlotPress\Engagement\First_Translation(); add_action( 'gp_translation_saved', array( $first_translation, '__invoke' ) ); @@ -58,8 +67,8 @@ public function test_first_translation_hook_notification() { $mock = new \MockAction(); add_action( 'wporg_translate_notification_first_translation', array( $mock, 'action' ), 10, 2 ); - $user = $this->factory->user->create(); - $approver = $this->factory->user->create(); + $user = $this->factory->user->create(); + $approver = $this->factory->user->create(); $translation1 = $this->factory->translation->create( array( 'status' => 'waiting', @@ -67,7 +76,12 @@ public function test_first_translation_hook_notification() { ) ); $this->assertEquals( 0, $mock->get_call_count() ); - $translation1->save( array( 'user_id_last_modified' => $approver, 'status' => 'current' ) ); + $translation1->save( + array( + 'user_id_last_modified' => $approver, + 'status' => 'current', + ) + ); $translation1 = \GP::$translation->get( $translation1->id ); $this->assertEquals( 1, $mock->get_call_count() ); @@ -82,6 +96,5 @@ public function test_first_translation_hook_notification() { $first_translation( $translation1 ); $this->assertEquals( 1, $mock->get_call_count() ); - } } From c37265496b4658afe04614adab3a6f5163ae7089 Mon Sep 17 00:00:00 2001 From: Alex Kirk Date: Tue, 3 Dec 2024 19:32:35 +0100 Subject: [PATCH 13/14] Update base tests --- tests/test-translation-milestone.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test-translation-milestone.php b/tests/test-translation-milestone.php index 7614098..8889697 100644 --- a/tests/test-translation-milestone.php +++ b/tests/test-translation-milestone.php @@ -5,10 +5,10 @@ * @package wporg-gp-engagement */ -namespace WordPressdotorg\GlotPress\Engagement; +namespace Wporg\Tests; /** * Test the Translation_Milestone class. */ -class Translation_Milestone_Test { +class Translation_Milestone_Test extends Base_Test { } From f64d0c0110848d38c34bd5a4cbbda49d9a0d7a40 Mon Sep 17 00:00:00 2001 From: Alex Kirk Date: Tue, 17 Dec 2024 10:39:50 +0100 Subject: [PATCH 14/14] Update test-anniversary.php --- tests/test-anniversary.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/tests/test-anniversary.php b/tests/test-anniversary.php index f8ff31d..9560d24 100644 --- a/tests/test-anniversary.php +++ b/tests/test-anniversary.php @@ -18,10 +18,10 @@ class Anniversary_Test extends Base_Test { */ public function anniversary_data_provider() { return array( - 'today' => array( time(), 0 ), - '1 years ago' => array( strtotime( '-1 year' ), 1 ), - '1.5 years ago' => array( strtotime( '-1.5 year' ), 0 ), - '2 years ago' => array( strtotime( '-2 year' ), 1 ), + 'today' => array( time(), 0, 0 ), + '1 years ago' => array( strtotime( '-1 year' ), 1, 1 ), + '1.5 years ago' => array( strtotime( '-1.5 year' ), 0, 0 ), + '2 years ago' => array( strtotime( '-2 year' ), 1, 1 ), ); } @@ -33,7 +33,7 @@ public function anniversary_data_provider() { * @param int $date The date to test. * @param int $expected The expected number of calls to the mock action. */ - public function test_anniversary( $date, $expected ) { + public function test_anniversary( $date, $expected, $expected_summary ) { $user = $this->factory->user->create(); @@ -51,9 +51,11 @@ public function test_anniversary( $date, $expected ) { $mock = new \MockAction(); add_action( 'wporg_translate_notification_anniversary', array( $mock, 'action' ), 10, 2 ); + add_action( 'wporg_translate_notification_summary_anniversary', array( $mock, 'action' ) ); $anniversary(); - $this->assertEquals( $expected, $mock->get_call_count() ); + $this->assertEquals( $expected, $mock->get_call_count('wporg_translate_notification_anniversary') ); + $this->assertEquals( $expected_summary, $mock->get_call_count('wporg_translate_notification_summary_anniversary') ); } }