diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index c56eceac..4e67b8bb 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -7,50 +7,47 @@ concurrency: cancel-in-progress: true jobs: - build: + test: + # Alias 'master' to 'latest' + name: WP ${{ matrix.wp == 'master' && 'latest' || matrix.wp }} and PHP ${{ matrix.php }} runs-on: ubuntu-latest + continue-on-error: ${{ matrix.allowed_failure }} strategy: + fail-fast: false matrix: - php-versions: - - 8.0 - - env: - DB_DATABASE: test_db - DB_USER: root - DB_PASSWORD: root + include: + # Check lowest supported WP version, with the lowest supported PHP. + - php: "8.0" + wp: "6.0" + allowed_failure: false + # Check latest WP with the highest supported PHP. + - php: "latest" + wp: "master" + allowed_failure: false steps: - - name: Checkout - uses: actions/checkout@v2 + - name: Checkout code + uses: actions/checkout@v4 - name: Install wordpress environment run: npm -g install @wordpress/env - - name: Setup PHP + - name: Setup PHP ${{ matrix.php }} uses: shivammathur/setup-php@v2 with: + php-version: ${{ matrix.php }} tools: composer - php-version: ${{ matrix.php-versions }} - - - name: Setup MySQL - run: | - sudo /etc/init.d/mysql start - - name: Cache Composer packages - id: composer-cache - uses: actions/cache@v2 + - name: Install Composer dependencies + uses: ramsey/composer-install@v3 with: - path: vendor - key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} - restore-keys: | - ${{ runner.os }}-php- - - - name: Install dependencies - run: composer install --prefer-dist --no-progress + composer-options: --prefer-dist --no-progress - - name: Setup the wordpress environment + - name: Setup wp-env run: wp-env start + env: + WP_ENV_CORE: WordPress/WordPress#${{ matrix.wp }} - name: PHPUnit run: composer test diff --git a/composer.json b/composer.json index 62d2d8f5..66b136e7 100644 --- a/composer.json +++ b/composer.json @@ -32,9 +32,6 @@ "dealerdirect/phpcodesniffer-composer-installer": true, "mnsami/composer-custom-directory-installer": false }, - "platform": { - "php": "8.0.2" - }, "sort-packages": true } } diff --git a/composer.lock b/composer.lock index 9d32ce9c..33862a9b 100644 --- a/composer.lock +++ b/composer.lock @@ -4,20 +4,20 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "9741385d0c76d0dc5537489f0c98fc76", + "content-hash": "0912de9090ec82c584107806ea84d177", "packages": [ { "name": "masterminds/html5", - "version": "2.8.1", + "version": "2.9.0", "source": { "type": "git", "url": "https://github.com/Masterminds/html5-php.git", - "reference": "f47dcf3c70c584de14f21143c55d9939631bc6cf" + "reference": "f5ac2c0b0a2eefca70b2ce32a5809992227e75a6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Masterminds/html5-php/zipball/f47dcf3c70c584de14f21143c55d9939631bc6cf", - "reference": "f47dcf3c70c584de14f21143c55d9939631bc6cf", + "url": "https://api.github.com/repos/Masterminds/html5-php/zipball/f5ac2c0b0a2eefca70b2ce32a5809992227e75a6", + "reference": "f5ac2c0b0a2eefca70b2ce32a5809992227e75a6", "shasum": "" }, "require": { @@ -25,7 +25,7 @@ "php": ">=5.3.0" }, "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7.21 || ^6 || ^7 || ^8" + "phpunit/phpunit": "^4.8.35 || ^5.7.21 || ^6 || ^7 || ^8 || ^9" }, "type": "library", "extra": { @@ -69,9 +69,9 @@ ], "support": { "issues": "https://github.com/Masterminds/html5-php/issues", - "source": "https://github.com/Masterminds/html5-php/tree/2.8.1" + "source": "https://github.com/Masterminds/html5-php/tree/2.9.0" }, - "time": "2023-05-10T11:58:31+00:00" + "time": "2024-03-31T07:05:07+00:00" }, { "name": "symfony/css-selector", @@ -213,16 +213,16 @@ }, { "name": "symfony/polyfill-ctype", - "version": "v1.28.0", + "version": "v1.29.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb" + "reference": "ef4d7e442ca910c4764bce785146269b30cb5fc4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb", - "reference": "ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/ef4d7e442ca910c4764bce785146269b30cb5fc4", + "reference": "ef4d7e442ca910c4764bce785146269b30cb5fc4", "shasum": "" }, "require": { @@ -236,9 +236,6 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.28-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -275,7 +272,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.28.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.29.0" }, "funding": [ { @@ -291,20 +288,20 @@ "type": "tidelift" } ], - "time": "2023-01-26T09:26:14+00:00" + "time": "2024-01-29T20:11:03+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.28.0", + "version": "v1.29.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "42292d99c55abe617799667f454222c54c60e229" + "reference": "9773676c8a1bb1f8d4340a62efe641cf76eda7ec" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/42292d99c55abe617799667f454222c54c60e229", - "reference": "42292d99c55abe617799667f454222c54c60e229", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9773676c8a1bb1f8d4340a62efe641cf76eda7ec", + "reference": "9773676c8a1bb1f8d4340a62efe641cf76eda7ec", "shasum": "" }, "require": { @@ -318,9 +315,6 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.28-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -358,7 +352,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.28.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.29.0" }, "funding": [ { @@ -374,38 +368,38 @@ "type": "tidelift" } ], - "time": "2023-07-28T09:04:16+00:00" + "time": "2024-01-29T20:11:03+00:00" } ], "packages-dev": [ { "name": "automattic/vipwpcs", - "version": "3.0.0", + "version": "3.0.1", "source": { "type": "git", "url": "https://github.com/Automattic/VIP-Coding-Standards.git", - "reference": "1b8960ebff9ea3eb482258a906ece4d1ee1e25fd" + "reference": "2b1d206d81b74ed999023cffd924f862ff2753c8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Automattic/VIP-Coding-Standards/zipball/1b8960ebff9ea3eb482258a906ece4d1ee1e25fd", - "reference": "1b8960ebff9ea3eb482258a906ece4d1ee1e25fd", + "url": "https://api.github.com/repos/Automattic/VIP-Coding-Standards/zipball/2b1d206d81b74ed999023cffd924f862ff2753c8", + "reference": "2b1d206d81b74ed999023cffd924f862ff2753c8", "shasum": "" }, "require": { "php": ">=5.4", - "phpcsstandards/phpcsextra": "^1.1.0", - "phpcsstandards/phpcsutils": "^1.0.8", - "sirbrillig/phpcs-variable-analysis": "^2.11.17", - "squizlabs/php_codesniffer": "^3.7.2", - "wp-coding-standards/wpcs": "^3.0" + "phpcsstandards/phpcsextra": "^1.2.1", + "phpcsstandards/phpcsutils": "^1.0.11", + "sirbrillig/phpcs-variable-analysis": "^2.11.18", + "squizlabs/php_codesniffer": "^3.9.2", + "wp-coding-standards/wpcs": "^3.1.0" }, "require-dev": { "php-parallel-lint/php-console-highlighter": "^1.0.0", "php-parallel-lint/php-parallel-lint": "^1.3.2", "phpcompatibility/php-compatibility": "^9", "phpcsstandards/phpcsdevtools": "^1.0", - "phpunit/phpunit": "^4 || ^5 || ^6 || ^7" + "phpunit/phpunit": "^4 || ^5 || ^6 || ^7 || ^8 || ^9" }, "type": "phpcodesniffer-standard", "notification-url": "https://packagist.org/downloads/", @@ -430,7 +424,7 @@ "source": "https://github.com/Automattic/VIP-Coding-Standards", "wiki": "https://github.com/Automattic/VIP-Coding-Standards/wiki" }, - "time": "2023-09-05T11:01:05+00:00" + "time": "2024-05-10T20:31:09+00:00" }, { "name": "dealerdirect/phpcodesniffer-composer-installer", @@ -685,16 +679,16 @@ }, { "name": "nikic/php-parser", - "version": "v5.0.0", + "version": "v5.0.2", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "4a21235f7e56e713259a6f76bf4b5ea08502b9dc" + "reference": "139676794dc1e9231bf7bcd123cfc0c99182cb13" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/4a21235f7e56e713259a6f76bf4b5ea08502b9dc", - "reference": "4a21235f7e56e713259a6f76bf4b5ea08502b9dc", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/139676794dc1e9231bf7bcd123cfc0c99182cb13", + "reference": "139676794dc1e9231bf7bcd123cfc0c99182cb13", "shasum": "" }, "require": { @@ -737,26 +731,27 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v5.0.0" + "source": "https://github.com/nikic/PHP-Parser/tree/v5.0.2" }, - "time": "2024-01-07T17:17:35+00:00" + "time": "2024-03-05T20:51:40+00:00" }, { "name": "phar-io/manifest", - "version": "2.0.3", + "version": "2.0.4", "source": { "type": "git", "url": "https://github.com/phar-io/manifest.git", - "reference": "97803eca37d319dfa7826cc2437fc020857acb53" + "reference": "54750ef60c58e43759730615a392c31c80e23176" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/manifest/zipball/97803eca37d319dfa7826cc2437fc020857acb53", - "reference": "97803eca37d319dfa7826cc2437fc020857acb53", + "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", @@ -797,9 +792,15 @@ "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.3" + "source": "https://github.com/phar-io/manifest/tree/2.0.4" }, - "time": "2021-07-20T11:28:43+00:00" + "funding": [ + { + "url": "https://github.com/theseer", + "type": "github" + } + ], + "time": "2024-03-03T12:33:53+00:00" }, { "name": "phar-io/version", @@ -916,28 +917,28 @@ }, { "name": "phpcompatibility/phpcompatibility-paragonie", - "version": "1.3.2", + "version": "1.3.3", "source": { "type": "git", "url": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie.git", - "reference": "bba5a9dfec7fcfbd679cfaf611d86b4d3759da26" + "reference": "293975b465e0e709b571cbf0c957c6c0a7b9a2ac" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityParagonie/zipball/bba5a9dfec7fcfbd679cfaf611d86b4d3759da26", - "reference": "bba5a9dfec7fcfbd679cfaf611d86b4d3759da26", + "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityParagonie/zipball/293975b465e0e709b571cbf0c957c6c0a7b9a2ac", + "reference": "293975b465e0e709b571cbf0c957c6c0a7b9a2ac", "shasum": "" }, "require": { "phpcompatibility/php-compatibility": "^9.0" }, "require-dev": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.7", + "dealerdirect/phpcodesniffer-composer-installer": "^1.0", "paragonie/random_compat": "dev-master", "paragonie/sodium_compat": "dev-master" }, "suggest": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.7 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.", + "dealerdirect/phpcodesniffer-composer-installer": "^1.0 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.", "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues." }, "type": "phpcodesniffer-standard", @@ -967,22 +968,37 @@ ], "support": { "issues": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie/issues", + "security": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie/security/policy", "source": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie" }, - "time": "2022-10-25T01:46:02+00:00" + "funding": [ + { + "url": "https://github.com/PHPCompatibility", + "type": "github" + }, + { + "url": "https://github.com/jrfnl", + "type": "github" + }, + { + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" + } + ], + "time": "2024-04-24T21:30:46+00:00" }, { "name": "phpcompatibility/phpcompatibility-wp", - "version": "2.1.4", + "version": "2.1.5", "source": { "type": "git", "url": "https://github.com/PHPCompatibility/PHPCompatibilityWP.git", - "reference": "b6c1e3ee1c35de6c41a511d5eb9bd03e447480a5" + "reference": "01c1ff2704a58e46f0cb1ca9d06aee07b3589082" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityWP/zipball/b6c1e3ee1c35de6c41a511d5eb9bd03e447480a5", - "reference": "b6c1e3ee1c35de6c41a511d5eb9bd03e447480a5", + "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityWP/zipball/01c1ff2704a58e46f0cb1ca9d06aee07b3589082", + "reference": "01c1ff2704a58e46f0cb1ca9d06aee07b3589082", "shasum": "" }, "require": { @@ -990,10 +1006,10 @@ "phpcompatibility/phpcompatibility-paragonie": "^1.0" }, "require-dev": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.7" + "dealerdirect/phpcodesniffer-composer-installer": "^1.0" }, "suggest": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.7 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.", + "dealerdirect/phpcodesniffer-composer-installer": "^1.0 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.", "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues." }, "type": "phpcodesniffer-standard", @@ -1022,9 +1038,24 @@ ], "support": { "issues": "https://github.com/PHPCompatibility/PHPCompatibilityWP/issues", + "security": "https://github.com/PHPCompatibility/PHPCompatibilityWP/security/policy", "source": "https://github.com/PHPCompatibility/PHPCompatibilityWP" }, - "time": "2022-10-24T09:00:36+00:00" + "funding": [ + { + "url": "https://github.com/PHPCompatibility", + "type": "github" + }, + { + "url": "https://github.com/jrfnl", + "type": "github" + }, + { + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" + } + ], + "time": "2024-04-24T21:37:59+00:00" }, { "name": "phpcsstandards/phpcsextra", @@ -1106,22 +1137,22 @@ }, { "name": "phpcsstandards/phpcsutils", - "version": "1.0.9", + "version": "1.0.12", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHPCSUtils.git", - "reference": "908247bc65010c7b7541a9551e002db12e9dae70" + "reference": "87b233b00daf83fb70f40c9a28692be017ea7c6c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHPCSUtils/zipball/908247bc65010c7b7541a9551e002db12e9dae70", - "reference": "908247bc65010c7b7541a9551e002db12e9dae70", + "url": "https://api.github.com/repos/PHPCSStandards/PHPCSUtils/zipball/87b233b00daf83fb70f40c9a28692be017ea7c6c", + "reference": "87b233b00daf83fb70f40c9a28692be017ea7c6c", "shasum": "" }, "require": { "dealerdirect/phpcodesniffer-composer-installer": "^0.4.1 || ^0.5 || ^0.6.2 || ^0.7 || ^1.0", "php": ">=5.4", - "squizlabs/php_codesniffer": "^3.8.0 || 4.0.x-dev@dev" + "squizlabs/php_codesniffer": "^3.10.0 || 4.0.x-dev@dev" }, "require-dev": { "ext-filter": "*", @@ -1190,20 +1221,20 @@ "type": "open_collective" } ], - "time": "2023-12-08T14:50:00+00:00" + "time": "2024-05-20T13:34:27+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "9.2.30", + "version": "9.2.31", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "ca2bd87d2f9215904682a9cb9bb37dda98e76089" + "reference": "48c34b5d8d983006bd2adc2d0de92963b9155965" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/ca2bd87d2f9215904682a9cb9bb37dda98e76089", - "reference": "ca2bd87d2f9215904682a9cb9bb37dda98e76089", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/48c34b5d8d983006bd2adc2d0de92963b9155965", + "reference": "48c34b5d8d983006bd2adc2d0de92963b9155965", "shasum": "" }, "require": { @@ -1260,7 +1291,7 @@ "support": { "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.30" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.31" }, "funding": [ { @@ -1268,7 +1299,7 @@ "type": "github" } ], - "time": "2023-12-22T06:47:57+00:00" + "time": "2024-03-02T06:37:42+00:00" }, { "name": "phpunit/php-file-iterator", @@ -1513,16 +1544,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.6.15", + "version": "9.6.19", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "05017b80304e0eb3f31d90194a563fd53a6021f1" + "reference": "a1a54a473501ef4cdeaae4e06891674114d79db8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/05017b80304e0eb3f31d90194a563fd53a6021f1", - "reference": "05017b80304e0eb3f31d90194a563fd53a6021f1", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a1a54a473501ef4cdeaae4e06891674114d79db8", + "reference": "a1a54a473501ef4cdeaae4e06891674114d79db8", "shasum": "" }, "require": { @@ -1596,7 +1627,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.15" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.19" }, "funding": [ { @@ -1612,20 +1643,20 @@ "type": "tidelift" } ], - "time": "2023-12-01T16:55:19+00:00" + "time": "2024-04-05T04:35:58+00:00" }, { "name": "sebastian/cli-parser", - "version": "1.0.1", + "version": "1.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/cli-parser.git", - "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2" + "reference": "2b56bea83a09de3ac06bb18b92f068e60cc6f50b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/442e7c7e687e42adc03470c7b668bc4b2402c0b2", - "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/2b56bea83a09de3ac06bb18b92f068e60cc6f50b", + "reference": "2b56bea83a09de3ac06bb18b92f068e60cc6f50b", "shasum": "" }, "require": { @@ -1660,7 +1691,7 @@ "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.1" + "source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.2" }, "funding": [ { @@ -1668,7 +1699,7 @@ "type": "github" } ], - "time": "2020-09-28T06:08:49+00:00" + "time": "2024-03-02T06:27:43+00:00" }, { "name": "sebastian/code-unit", @@ -1914,16 +1945,16 @@ }, { "name": "sebastian/diff", - "version": "4.0.5", + "version": "4.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "74be17022044ebaaecfdf0c5cd504fc9cd5a7131" + "reference": "ba01945089c3a293b01ba9badc29ad55b106b0bc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/74be17022044ebaaecfdf0c5cd504fc9cd5a7131", - "reference": "74be17022044ebaaecfdf0c5cd504fc9cd5a7131", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/ba01945089c3a293b01ba9badc29ad55b106b0bc", + "reference": "ba01945089c3a293b01ba9badc29ad55b106b0bc", "shasum": "" }, "require": { @@ -1968,7 +1999,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/diff/issues", - "source": "https://github.com/sebastianbergmann/diff/tree/4.0.5" + "source": "https://github.com/sebastianbergmann/diff/tree/4.0.6" }, "funding": [ { @@ -1976,7 +2007,7 @@ "type": "github" } ], - "time": "2023-05-07T05:35:17+00:00" + "time": "2024-03-02T06:30:58+00:00" }, { "name": "sebastian/environment", @@ -2043,16 +2074,16 @@ }, { "name": "sebastian/exporter", - "version": "4.0.5", + "version": "4.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d" + "reference": "78c00df8f170e02473b682df15bfcdacc3d32d72" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", - "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/78c00df8f170e02473b682df15bfcdacc3d32d72", + "reference": "78c00df8f170e02473b682df15bfcdacc3d32d72", "shasum": "" }, "require": { @@ -2108,7 +2139,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.5" + "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.6" }, "funding": [ { @@ -2116,20 +2147,20 @@ "type": "github" } ], - "time": "2022-09-14T06:03:37+00:00" + "time": "2024-03-02T06:33:00+00:00" }, { "name": "sebastian/global-state", - "version": "5.0.6", + "version": "5.0.7", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "bde739e7565280bda77be70044ac1047bc007e34" + "reference": "bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bde739e7565280bda77be70044ac1047bc007e34", - "reference": "bde739e7565280bda77be70044ac1047bc007e34", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9", + "reference": "bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9", "shasum": "" }, "require": { @@ -2172,7 +2203,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.6" + "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.7" }, "funding": [ { @@ -2180,7 +2211,7 @@ "type": "github" } ], - "time": "2023-08-02T09:26:13+00:00" + "time": "2024-03-02T06:35:11+00:00" }, { "name": "sebastian/lines-of-code", @@ -2416,16 +2447,16 @@ }, { "name": "sebastian/resource-operations", - "version": "3.0.3", + "version": "3.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8" + "reference": "05d5692a7993ecccd56a03e40cd7e5b09b1d404e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", - "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/05d5692a7993ecccd56a03e40cd7e5b09b1d404e", + "reference": "05d5692a7993ecccd56a03e40cd7e5b09b1d404e", "shasum": "" }, "require": { @@ -2437,7 +2468,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-main": "3.0-dev" } }, "autoload": { @@ -2458,8 +2489,7 @@ "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/sebastianbergmann/resource-operations/issues", - "source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.3" + "source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.4" }, "funding": [ { @@ -2467,7 +2497,7 @@ "type": "github" } ], - "time": "2020-09-28T06:45:17+00:00" + "time": "2024-03-14T16:00:52+00:00" }, { "name": "sebastian/type", @@ -2580,16 +2610,16 @@ }, { "name": "sirbrillig/phpcs-variable-analysis", - "version": "v2.11.17", + "version": "v2.11.18", "source": { "type": "git", "url": "https://github.com/sirbrillig/phpcs-variable-analysis.git", - "reference": "3b71162a6bf0cde2bff1752e40a1788d8273d049" + "reference": "ca242a0b7309e0f9d1f73b236e04ecf4ca3248d0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sirbrillig/phpcs-variable-analysis/zipball/3b71162a6bf0cde2bff1752e40a1788d8273d049", - "reference": "3b71162a6bf0cde2bff1752e40a1788d8273d049", + "url": "https://api.github.com/repos/sirbrillig/phpcs-variable-analysis/zipball/ca242a0b7309e0f9d1f73b236e04ecf4ca3248d0", + "reference": "ca242a0b7309e0f9d1f73b236e04ecf4ca3248d0", "shasum": "" }, "require": { @@ -2634,20 +2664,20 @@ "source": "https://github.com/sirbrillig/phpcs-variable-analysis", "wiki": "https://github.com/sirbrillig/phpcs-variable-analysis/wiki" }, - "time": "2023-08-05T23:46:11+00:00" + "time": "2024-04-13T16:42:46+00:00" }, { "name": "squizlabs/php_codesniffer", - "version": "3.8.1", + "version": "3.10.1", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", - "reference": "14f5fff1e64118595db5408e946f3a22c75807f7" + "reference": "8f90f7a53ce271935282967f53d0894f8f1ff877" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/14f5fff1e64118595db5408e946f3a22c75807f7", - "reference": "14f5fff1e64118595db5408e946f3a22c75807f7", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/8f90f7a53ce271935282967f53d0894f8f1ff877", + "reference": "8f90f7a53ce271935282967f53d0894f8f1ff877", "shasum": "" }, "require": { @@ -2714,20 +2744,20 @@ "type": "open_collective" } ], - "time": "2024-01-11T20:47:48+00:00" + "time": "2024-05-22T21:24:41+00:00" }, { "name": "theseer/tokenizer", - "version": "1.2.2", + "version": "1.2.3", "source": { "type": "git", "url": "https://github.com/theseer/tokenizer.git", - "reference": "b2ad5003ca10d4ee50a12da31de12a5774ba6b96" + "reference": "737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/b2ad5003ca10d4ee50a12da31de12a5774ba6b96", - "reference": "b2ad5003ca10d4ee50a12da31de12a5774ba6b96", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2", + "reference": "737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2", "shasum": "" }, "require": { @@ -2756,7 +2786,7 @@ "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.2" + "source": "https://github.com/theseer/tokenizer/tree/1.2.3" }, "funding": [ { @@ -2764,20 +2794,20 @@ "type": "github" } ], - "time": "2023-11-20T00:12:19+00:00" + "time": "2024-03-03T12:36:25+00:00" }, { "name": "wp-coding-standards/wpcs", - "version": "3.0.1", + "version": "3.1.0", "source": { "type": "git", "url": "https://github.com/WordPress/WordPress-Coding-Standards.git", - "reference": "b4caf9689f1a0e4a4c632679a44e638c1c67aff1" + "reference": "9333efcbff231f10dfd9c56bb7b65818b4733ca7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/WordPress/WordPress-Coding-Standards/zipball/b4caf9689f1a0e4a4c632679a44e638c1c67aff1", - "reference": "b4caf9689f1a0e4a4c632679a44e638c1c67aff1", + "url": "https://api.github.com/repos/WordPress/WordPress-Coding-Standards/zipball/9333efcbff231f10dfd9c56bb7b65818b4733ca7", + "reference": "9333efcbff231f10dfd9c56bb7b65818b4733ca7", "shasum": "" }, "require": { @@ -2786,16 +2816,16 @@ "ext-tokenizer": "*", "ext-xmlreader": "*", "php": ">=5.4", - "phpcsstandards/phpcsextra": "^1.1.0", - "phpcsstandards/phpcsutils": "^1.0.8", - "squizlabs/php_codesniffer": "^3.7.2" + "phpcsstandards/phpcsextra": "^1.2.1", + "phpcsstandards/phpcsutils": "^1.0.10", + "squizlabs/php_codesniffer": "^3.9.0" }, "require-dev": { "php-parallel-lint/php-console-highlighter": "^1.0.0", "php-parallel-lint/php-parallel-lint": "^1.3.2", "phpcompatibility/php-compatibility": "^9.0", "phpcsstandards/phpcsdevtools": "^1.2.0", - "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.0" }, "suggest": { "ext-iconv": "For improved results", @@ -2826,24 +2856,24 @@ }, "funding": [ { - "url": "https://opencollective.com/thewpcc/contribute/wp-php-63406", + "url": "https://opencollective.com/php_codesniffer", "type": "custom" } ], - "time": "2023-09-14T07:06:09+00:00" + "time": "2024-03-25T16:39:00+00:00" }, { "name": "wp-phpunit/wp-phpunit", - "version": "6.4.2", + "version": "6.5.3", "source": { "type": "git", "url": "https://github.com/wp-phpunit/wp-phpunit.git", - "reference": "aa3c8f5d1b7efc295fd2b37c7264d2356a8c1099" + "reference": "ef2cb44c0d991ac0c3a7a3ed0d2d1cf3fe8d8f2f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wp-phpunit/wp-phpunit/zipball/aa3c8f5d1b7efc295fd2b37c7264d2356a8c1099", - "reference": "aa3c8f5d1b7efc295fd2b37c7264d2356a8c1099", + "url": "https://api.github.com/repos/wp-phpunit/wp-phpunit/zipball/ef2cb44c0d991ac0c3a7a3ed0d2d1cf3fe8d8f2f", + "reference": "ef2cb44c0d991ac0c3a7a3ed0d2d1cf3fe8d8f2f", "shasum": "" }, "type": "library", @@ -2878,20 +2908,20 @@ "issues": "https://github.com/wp-phpunit/issues", "source": "https://github.com/wp-phpunit/wp-phpunit" }, - "time": "2023-12-07T00:50:08+00:00" + "time": "2024-05-07T16:46:52+00:00" }, { "name": "yoast/phpunit-polyfills", - "version": "2.0.0", + "version": "2.0.1", "source": { "type": "git", "url": "https://github.com/Yoast/PHPUnit-Polyfills.git", - "reference": "c758753e8f9dac251fed396a73c8305af3f17922" + "reference": "4a088f125c970d6d6ea52c927f96fe39b330d0f1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Yoast/PHPUnit-Polyfills/zipball/c758753e8f9dac251fed396a73c8305af3f17922", - "reference": "c758753e8f9dac251fed396a73c8305af3f17922", + "url": "https://api.github.com/repos/Yoast/PHPUnit-Polyfills/zipball/4a088f125c970d6d6ea52c927f96fe39b330d0f1", + "reference": "4a088f125c970d6d6ea52c927f96fe39b330d0f1", "shasum": "" }, "require": { @@ -2899,7 +2929,9 @@ "phpunit/phpunit": "^5.7.21 || ^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0" }, "require-dev": { - "yoast/yoastcs": "^2.3.0" + "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": { @@ -2936,9 +2968,10 @@ ], "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": "2023-06-06T20:28:24+00:00" + "time": "2024-04-05T16:36:44+00:00" } ], "aliases": [], @@ -2950,8 +2983,5 @@ "php": ">=8.0" }, "platform-dev": [], - "platform-overrides": { - "php": "8.0.2" - }, - "plugin-api-version": "2.3.0" + "plugin-api-version": "2.6.0" } diff --git a/tests/graphql/test-graphql-api.php b/tests/graphql/test-graphql-api.php index 32759a39..934862a4 100644 --- a/tests/graphql/test-graphql-api.php +++ b/tests/graphql/test-graphql-api.php @@ -28,28 +28,74 @@ public function test_is_graphql_enabled_false() { // get_blocks_data() tests public function test_get_blocks_data() { + $this->register_global_block_with_attributes( 'test/custom-paragraph', [ + 'content' => [ + 'type' => 'rich-text', + 'source' => 'rich-text', + 'selector' => 'p', + '__experimentalRole' => 'content', + ], + 'dropCap' => [ + 'type' => 'boolean', + 'default' => false, + ], + 'placeholder' => [ + 'type' => 'string', + ], + ] ); + + $this->register_global_block_with_attributes( 'test/custom-quote', [ + 'value' => [ + 'type' => 'string', + 'source' => 'html', + 'selector' => 'blockquote', + 'multiline' => 'p', + 'default' => '', + '__experimentalRole' => 'content', + ], + 'citation' => [ + 'type' => 'rich-text', + 'source' => 'rich-text', + 'selector' => 'cite', + '__experimentalRole' => 'content', + ], + ] ); + + $this->register_global_block_with_attributes( 'test/custom-heading', [ + 'content' => [ + 'type' => 'rich-text', + 'source' => 'rich-text', + 'selector' => 'h1,h2,h3,h4,h5,h6', + '__experimentalRole' => 'content', + ], + 'level' => [ + 'type' => 'number', + 'default' => 2, + ], + ] ); + $html = ' - +

Welcome to WordPress. This is your first post. Edit or delete it, then start writing!

- + - -
+ +

This is a heading inside a quote

- + - -
+ +

This is a heading

-
-
- +
+
+ '; $expected_blocks = [ 'blocks' => [ [ - 'name' => 'core/paragraph', + 'name' => 'test/custom-paragraph', 'attributes' => [ [ 'name' => 'content', @@ -65,7 +111,7 @@ public function test_get_blocks_data() { 'id' => '1', ], [ - 'name' => 'core/quote', + 'name' => 'test/custom-quote', 'attributes' => [ [ 'name' => 'value', @@ -75,7 +121,7 @@ public function test_get_blocks_data() { ], 'innerBlocks' => [ [ - 'name' => 'core/paragraph', + 'name' => 'test/custom-paragraph', 'attributes' => [ [ 'name' => 'content', @@ -91,7 +137,7 @@ public function test_get_blocks_data() { 'id' => '3', ], [ - 'name' => 'core/quote', + 'name' => 'test/custom-quote', 'attributes' => [ [ 'name' => 'value', @@ -101,7 +147,7 @@ public function test_get_blocks_data() { ], 'innerBlocks' => [ [ - 'name' => 'core/heading', + 'name' => 'test/custom-heading', 'attributes' => [ [ 'name' => 'content', @@ -135,8 +181,86 @@ public function test_get_blocks_data() { } public function test_array_data_in_attribute() { + $this->register_global_block_with_attributes( 'test/custom-table', [ + 'head' => [ + 'type' => 'array', + 'default' => [], + 'source' => 'query', + 'selector' => 'thead tr', + 'query' => [ + 'cells' => [ + 'type' => 'array', + 'default' => [], + 'source' => 'query', + 'selector' => 'td,th', + 'query' => [ + 'content' => [ + 'type' => 'rich-text', + 'source' => 'rich-text', + ], + 'tag' => [ + 'type' => 'string', + 'default' => 'td', + 'source' => 'tag', + ], + ], + ], + ], + ], + 'body' => [ + 'type' => 'array', + 'default' => [], + 'source' => 'query', + 'selector' => 'tbody tr', + 'query' => [ + 'cells' => [ + 'type' => 'array', + 'default' => [], + 'source' => 'query', + 'selector' => 'td,th', + 'query' => [ + 'content' => [ + 'type' => 'rich-text', + 'source' => 'rich-text', + ], + 'tag' => [ + 'type' => 'string', + 'default' => 'td', + 'source' => 'tag', + ], + ], + ], + ], + ], + 'foot' => [ + 'type' => 'array', + 'default' => [], + 'source' => 'query', + 'selector' => 'tfoot tr', + 'query' => [ + 'cells' => [ + 'type' => 'array', + 'default' => [], + 'source' => 'query', + 'selector' => 'td,th', + 'query' => [ + 'content' => [ + 'type' => 'rich-text', + 'source' => 'rich-text', + ], + 'tag' => [ + 'type' => 'string', + 'default' => 'td', + 'source' => 'tag', + ], + ], + ], + ], + ], + ] ); + $html = ' - +
@@ -163,19 +287,14 @@ public function test_array_data_in_attribute() {
- + '; $expected_blocks = [ 'blocks' => [ [ - 'name' => 'core/table', + 'name' => 'test/custom-table', 'attributes' => [ - [ - 'name' => 'hasFixedLayout', - 'value' => false, - 'isValueJsonEncoded' => false, - ], [ 'name' => 'head', 'value' => '[{"cells":[{"content":"Header A","tag":"th"},{"content":"Header B","tag":"th"}]}]', diff --git a/tests/registry-test-case.php b/tests/registry-test-case.php index 08f3359d..d2d4004c 100644 --- a/tests/registry-test-case.php +++ b/tests/registry-test-case.php @@ -13,6 +13,7 @@ class RegistryTestCase extends WP_UnitTestCase { use ArraySubsetAsserts; protected $registry; + protected $globally_registered_blocks = []; protected function setUp(): void { parent::setUp(); @@ -20,6 +21,14 @@ protected function setUp(): void { $this->registry = new WP_Block_Type_Registry(); } + protected function tearDown(): void { + foreach ( $this->globally_registered_blocks as $block_name ) { + $this->unregister_global_block( $block_name ); + } + + parent::tearDown(); + } + /* Helper methods */ protected function register_block_with_attributes( $block_name, $attributes ) { @@ -28,4 +37,25 @@ protected function register_block_with_attributes( $block_name, $attributes ) { 'attributes' => $attributes, ] ); } + + /* Global registrations */ + + protected function register_global_block_with_attributes( $block_name, $attributes ) { + // Use this function for mocking blocks definitions that need to persist across HTTP requests, like GraphQL tests. + + WP_Block_Type_Registry::get_instance()->register( $block_name, [ + 'apiVersion' => 2, + 'attributes' => $attributes, + ] ); + + $this->globally_registered_blocks[] = $block_name; + } + + protected function unregister_global_block( $block_name ) { + $registry = WP_Block_Type_Registry::get_instance(); + + if ( $registry->is_registered( $block_name ) ) { + $registry->unregister( $block_name ); + } + } } diff --git a/tests/rest/test-rest-api.php b/tests/rest/test-rest-api.php index 0995c1a9..0955bdb4 100644 --- a/tests/rest/test-rest-api.php +++ b/tests/rest/test-rest-api.php @@ -8,6 +8,7 @@ namespace WPCOMVIP\BlockDataApi; use Exception; +use WP_Block_Type_Registry; use WP_UnitTestCase; use WP_REST_Server; use WP_REST_Request; @@ -17,6 +18,7 @@ */ class RestApiTest extends WP_UnitTestCase { private $server; + private $globally_registered_blocks = []; protected function setUp(): void { parent::setUp(); @@ -32,62 +34,164 @@ protected function tearDown(): void { global $wp_rest_server; $wp_rest_server = null; + foreach ( $this->globally_registered_blocks as $block_name ) { + $this->unregister_global_block( $block_name ); + } + parent::tearDown(); } public function test_rest_api_returns_blocks_for_post() { + $this->register_global_block_with_attributes( 'test/custom-heading', [ + 'content' => [ + 'type' => 'rich-text', + 'source' => 'rich-text', + 'selector' => 'h1,h2,h3,h4,h5,h6', + '__experimentalRole' => 'content', + ], + 'level' => [ + 'type' => 'number', + 'default' => 2, + ], + ] ); + + $this->register_global_block_with_attributes( 'test/custom-quote', [ + 'value' => [ + 'type' => 'string', + 'source' => 'html', + 'selector' => 'blockquote', + 'multiline' => 'p', + 'default' => '', + '__experimentalRole' => 'content', + ], + 'citation' => [ + 'type' => 'rich-text', + 'source' => 'rich-text', + 'selector' => 'cite', + '__experimentalRole' => 'content', + ], + ] ); + + $this->register_global_block_with_attributes( 'test/custom-paragraph', [ + 'content' => [ + 'type' => 'rich-text', + 'source' => 'rich-text', + 'selector' => 'p', + '__experimentalRole' => 'content', + ], + 'dropCap' => [ + 'type' => 'boolean', + 'default' => false, + ], + 'placeholder' => [ + 'type' => 'string', + ], + ] ); + + $this->register_global_block_with_attributes( 'test/custom-separator', [ + 'opacity' => [ + 'type' => 'string', + 'default' => 'alpha-channel', + ], + ] ); + + $this->register_global_block_with_attributes( 'test/custom-media-text', [ + 'align' => [ + 'type' => 'string', + 'default' => 'none', + ], + 'mediaAlt' => [ + 'type' => 'string', + 'source' => 'attribute', + 'selector' => 'figure img', + 'attribute' => 'alt', + 'default' => '', + '__experimentalRole' => 'content', + ], + 'mediaPosition' => [ + 'type' => 'string', + 'default' => 'left', + ], + 'mediaId' => [ + 'type' => 'number', + '__experimentalRole' => 'content', + ], + 'mediaUrl' => [ + 'type' => 'string', + 'source' => 'attribute', + 'selector' => 'figure video,figure img', + 'attribute' => 'src', + '__experimentalRole' => 'content', + ], + 'mediaLink' => [ + 'type' => 'string', + ], + 'mediaType' => [ + 'type' => 'string', + '__experimentalRole' => 'content', + ], + 'mediaWidth' => [ + 'type' => 'number', + 'default' => 50, + ], + 'isStackedOnMobile' => [ + 'type' => 'boolean', + 'default' => true, + ], + ] ); + $html = ' - +

Heading 1

- + - +
- +

Text in quote

- + ~ Citation, 2023
- + - +
- + - +
- +

Content on right side of media-text.

- +
- + '; $post_id = $this->get_post_id_with_content( $html ); $expected_blocks = [ [ - 'name' => 'core/heading', + 'name' => 'test/custom-heading', 'attributes' => [ 'content' => 'Heading 1', 'level' => 2, ], ], [ - 'name' => 'core/quote', + 'name' => 'test/custom-quote', 'attributes' => [ 'value' => '', 'citation' => '~ Citation, 2023', ], 'innerBlocks' => [ [ - 'name' => 'core/paragraph', + 'name' => 'test/custom-paragraph', 'attributes' => [ 'content' => 'Text in quote', 'dropCap' => false, @@ -96,13 +200,13 @@ public function test_rest_api_returns_blocks_for_post() { ], ], [ - 'name' => 'core/separator', + 'name' => 'test/custom-separator', 'attributes' => [ 'opacity' => 'alpha-channel', ], ], [ - 'name' => 'core/media-text', + 'name' => 'test/custom-media-text', 'attributes' => [ 'mediaId' => 6, 'mediaLink' => 'https://gutenberg-block-data-api-test.go-vip.net/?attachment_id=6', @@ -116,7 +220,7 @@ public function test_rest_api_returns_blocks_for_post() { ], 'innerBlocks' => [ [ - 'name' => 'core/paragraph', + 'name' => 'test/custom-paragraph', 'attributes' => [ 'placeholder' => 'Content…', 'content' => 'Content on right side of media-text.', @@ -141,58 +245,156 @@ public function test_rest_api_returns_blocks_for_post() { } public function test_rest_api_does_not_return_excluded_blocks_for_post() { + $this->register_global_block_with_attributes( 'test/custom-heading', [ + 'content' => [ + 'type' => 'rich-text', + 'source' => 'rich-text', + 'selector' => 'h1,h2,h3,h4,h5,h6', + '__experimentalRole' => 'content', + ], + 'level' => [ + 'type' => 'number', + 'default' => 2, + ], + ] ); + + $this->register_global_block_with_attributes( 'test/custom-quote', [ + 'value' => [ + 'type' => 'string', + 'source' => 'html', + 'selector' => 'blockquote', + 'multiline' => 'p', + 'default' => '', + '__experimentalRole' => 'content', + ], + 'citation' => [ + 'type' => 'rich-text', + 'source' => 'rich-text', + 'selector' => 'cite', + '__experimentalRole' => 'content', + ], + ] ); + + $this->register_global_block_with_attributes( 'test/custom-paragraph', [ + 'content' => [ + 'type' => 'rich-text', + 'source' => 'rich-text', + 'selector' => 'p', + '__experimentalRole' => 'content', + ], + 'dropCap' => [ + 'type' => 'boolean', + 'default' => false, + ], + 'placeholder' => [ + 'type' => 'string', + ], + ] ); + + $this->register_global_block_with_attributes( 'test/custom-separator', [ + 'opacity' => [ + 'type' => 'string', + 'default' => 'alpha-channel', + ], + ] ); + + $this->register_global_block_with_attributes( 'test/custom-media-text', [ + 'align' => [ + 'type' => 'string', + 'default' => 'none', + ], + 'mediaAlt' => [ + 'type' => 'string', + 'source' => 'attribute', + 'selector' => 'figure img', + 'attribute' => 'alt', + 'default' => '', + '__experimentalRole' => 'content', + ], + 'mediaPosition' => [ + 'type' => 'string', + 'default' => 'left', + ], + 'mediaId' => [ + 'type' => 'number', + '__experimentalRole' => 'content', + ], + 'mediaUrl' => [ + 'type' => 'string', + 'source' => 'attribute', + 'selector' => 'figure video,figure img', + 'attribute' => 'src', + '__experimentalRole' => 'content', + ], + 'mediaLink' => [ + 'type' => 'string', + ], + 'mediaType' => [ + 'type' => 'string', + '__experimentalRole' => 'content', + ], + 'mediaWidth' => [ + 'type' => 'number', + 'default' => 50, + ], + 'isStackedOnMobile' => [ + 'type' => 'boolean', + 'default' => true, + ], + ] ); + $html = ' - +

Heading 1

- + - +
- +

Text in quote

- + ~ Citation, 2023
- + - +
- + - +
- +

Content on right side of media-text.

- +
- + '; $post_id = $this->get_post_id_with_content( $html ); $expected_blocks = [ [ - 'name' => 'core/heading', + 'name' => 'test/custom-heading', 'attributes' => [ 'content' => 'Heading 1', 'level' => 2, ], ], [ - 'name' => 'core/quote', + 'name' => 'test/custom-quote', 'attributes' => [ 'value' => '', 'citation' => '~ Citation, 2023', ], ], [ - 'name' => 'core/media-text', + 'name' => 'test/custom-media-text', 'attributes' => [ 'mediaId' => 6, 'mediaLink' => 'https://gutenberg-block-data-api-test.go-vip.net/?attachment_id=6', @@ -209,7 +411,7 @@ public function test_rest_api_does_not_return_excluded_blocks_for_post() { $request = new WP_REST_Request( 'GET', sprintf( '/vip-block-data-api/v1/posts/%d/blocks', $post_id ) ); // phpcs:ignore WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_exclude - $request->set_query_params( [ 'exclude' => 'core/paragraph,core/separator' ] ); + $request->set_query_params( [ 'exclude' => 'test/custom-paragraph,test/custom-separator' ] ); $response = $this->server->dispatch( $request ); @@ -224,44 +426,142 @@ public function test_rest_api_does_not_return_excluded_blocks_for_post() { } public function test_rest_api_only_returns_included_blocks_for_post() { + $this->register_global_block_with_attributes( 'test/custom-heading', [ + 'content' => [ + 'type' => 'rich-text', + 'source' => 'rich-text', + 'selector' => 'h1,h2,h3,h4,h5,h6', + '__experimentalRole' => 'content', + ], + 'level' => [ + 'type' => 'number', + 'default' => 2, + ], + ] ); + + $this->register_global_block_with_attributes( 'test/custom-quote', [ + 'value' => [ + 'type' => 'string', + 'source' => 'html', + 'selector' => 'blockquote', + 'multiline' => 'p', + 'default' => '', + '__experimentalRole' => 'content', + ], + 'citation' => [ + 'type' => 'rich-text', + 'source' => 'rich-text', + 'selector' => 'cite', + '__experimentalRole' => 'content', + ], + ] ); + + $this->register_global_block_with_attributes( 'test/custom-paragraph', [ + 'content' => [ + 'type' => 'rich-text', + 'source' => 'rich-text', + 'selector' => 'p', + '__experimentalRole' => 'content', + ], + 'dropCap' => [ + 'type' => 'boolean', + 'default' => false, + ], + 'placeholder' => [ + 'type' => 'string', + ], + ] ); + + $this->register_global_block_with_attributes( 'test/custom-separator', [ + 'opacity' => [ + 'type' => 'string', + 'default' => 'alpha-channel', + ], + ] ); + + $this->register_global_block_with_attributes( 'test/custom-media-text', [ + 'align' => [ + 'type' => 'string', + 'default' => 'none', + ], + 'mediaAlt' => [ + 'type' => 'string', + 'source' => 'attribute', + 'selector' => 'figure img', + 'attribute' => 'alt', + 'default' => '', + '__experimentalRole' => 'content', + ], + 'mediaPosition' => [ + 'type' => 'string', + 'default' => 'left', + ], + 'mediaId' => [ + 'type' => 'number', + '__experimentalRole' => 'content', + ], + 'mediaUrl' => [ + 'type' => 'string', + 'source' => 'attribute', + 'selector' => 'figure video,figure img', + 'attribute' => 'src', + '__experimentalRole' => 'content', + ], + 'mediaLink' => [ + 'type' => 'string', + ], + 'mediaType' => [ + 'type' => 'string', + '__experimentalRole' => 'content', + ], + 'mediaWidth' => [ + 'type' => 'number', + 'default' => 50, + ], + 'isStackedOnMobile' => [ + 'type' => 'boolean', + 'default' => true, + ], + ] ); + $html = ' - +

Heading 1

- + - +
- +

Text in quote

- + ~ Citation, 2023
- + - +
- + - +
- +

Content on right side of media-text.

- +
- + '; $post_id = $this->get_post_id_with_content( $html ); $expected_blocks = [ [ - 'name' => 'core/heading', + 'name' => 'test/custom-heading', 'attributes' => [ 'content' => 'Heading 1', 'level' => 2, @@ -270,7 +570,7 @@ public function test_rest_api_only_returns_included_blocks_for_post() { ]; $request = new WP_REST_Request( 'GET', sprintf( '/vip-block-data-api/v1/posts/%d/blocks', $post_id ) ); - $request->set_query_params( [ 'include' => 'core/heading' ] ); + $request->set_query_params( [ 'include' => 'test/custom-heading' ] ); $response = $this->server->dispatch( $request ); @@ -290,10 +590,23 @@ public function test_rest_api_returns_blocks_for_custom_post_type() { 'show_in_rest' => true, ]); + $this->register_global_block_with_attributes( 'test/custom-paragraph', [ + 'content' => [ + 'type' => 'rich-text', + 'source' => 'rich-text', + 'selector' => 'p', + '__experimentalRole' => 'content', + ], + 'dropCap' => [ + 'type' => 'boolean', + 'default' => false, + ], + ] ); + $html = ' - +

Text in custom post type

- + '; $post_id = $this->factory()->post->create( [ @@ -305,7 +618,7 @@ public function test_rest_api_returns_blocks_for_custom_post_type() { $expected_blocks = [ [ - 'name' => 'core/paragraph', + 'name' => 'test/custom-paragraph', 'attributes' => [ 'content' => 'Text in custom post type', 'dropCap' => false, @@ -332,10 +645,19 @@ public function test_rest_api_returns_error_for_non_public_post_type() { 'public' => false, ]); + $this->register_global_block_with_attributes( 'test/custom-paragraph', [ + 'content' => [ + 'type' => 'rich-text', + 'source' => 'rich-text', + 'selector' => 'p', + '__experimentalRole' => 'content', + ], + ] ); + $post_id = $this->factory()->post->create( [ 'post_title' => 'Custom post type', 'post_type' => $test_post_type->name, - 'post_content' => '

Custom post type content

', + 'post_content' => '

Custom post type content

', 'post_status' => 'publish', ] ); @@ -359,10 +681,19 @@ public function test_rest_api_returns_error_for_non_rest_post_type() { 'show_in_rest' => false, ]); + $this->register_global_block_with_attributes( 'test/custom-paragraph', [ + 'content' => [ + 'type' => 'rich-text', + 'source' => 'rich-text', + 'selector' => 'p', + '__experimentalRole' => 'content', + ], + ] ); + $post_id = $this->factory()->post->create( [ 'post_title' => 'Custom post type', 'post_type' => $test_post_type->name, - 'post_content' => '

Custom post type content

', + 'post_content' => '

Custom post type content

', 'post_status' => 'publish', ] ); @@ -381,10 +712,19 @@ public function test_rest_api_returns_error_for_non_rest_post_type() { } public function test_rest_api_returns_error_for_unpublished_post() { + $this->register_global_block_with_attributes( 'test/custom-paragraph', [ + 'content' => [ + 'type' => 'rich-text', + 'source' => 'rich-text', + 'selector' => 'p', + '__experimentalRole' => 'content', + ], + ] ); + $post_id = $this->factory()->post->create( [ 'post_title' => 'Unpublished post', 'post_type' => 'post', - 'post_content' => '

Unpublished content

', + 'post_content' => '

Unpublished content

', 'post_status' => 'draft', ] ); @@ -423,7 +763,16 @@ public function test_rest_api_returns_error_for_classic_content() { } public function test_rest_api_returns_error_for_include_and_exclude_filter() { - $post_id = $this->get_post_id_with_content( '

content

' ); + $this->register_global_block_with_attributes( 'test/custom-paragraph', [ + 'content' => [ + 'type' => 'rich-text', + 'source' => 'rich-text', + 'selector' => 'p', + '__experimentalRole' => 'content', + ], + ] ); + + $post_id = $this->get_post_id_with_content( '

content

' ); // Ignore exception created by PHPUnit called when trigger_error() is called internally $this->convert_next_error_to_exception(); @@ -432,7 +781,7 @@ public function test_rest_api_returns_error_for_include_and_exclude_filter() { $request = new WP_REST_Request( 'GET', sprintf( '/vip-block-data-api/v1/posts/%d/blocks', $post_id ) ); $request->set_query_params( [ // phpcs:ignore WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_exclude - 'exclude' => 'core/paragraph,core/separator', + 'exclude' => 'test/custom-paragraph,core/separator', 'include' => 'core/heading,core/quote,core/media-text', ] ); @@ -449,7 +798,16 @@ public function test_rest_api_returns_error_for_include_and_exclude_filter() { } public function test_rest_api_returns_error_for_unexpected_exception() { - $post_id = $this->get_post_id_with_content( '

Content

' ); + $this->register_global_block_with_attributes( 'test/custom-paragraph', [ + 'content' => [ + 'type' => 'rich-text', + 'source' => 'rich-text', + 'selector' => 'p', + '__experimentalRole' => 'content', + ], + ] ); + + $post_id = $this->get_post_id_with_content( '

Content

' ); $exception_causing_parser_function = function () { throw new Exception( 'Exception in parser' ); @@ -499,4 +857,21 @@ static function ( int $errno, string $errstr ): never { E_USER_WARNING ); } + + private function register_global_block_with_attributes( $block_name, $attributes ) { + WP_Block_Type_Registry::get_instance()->register( $block_name, [ + 'apiVersion' => 2, + 'attributes' => $attributes, + ] ); + + $this->globally_registered_blocks[] = $block_name; + } + + private function unregister_global_block( $block_name ) { + $registry = WP_Block_Type_Registry::get_instance(); + + if ( $registry->is_registered( $block_name ) ) { + $registry->unregister( $block_name ); + } + } } diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 746979e9..ff1d4b6d 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -2,17 +2,17 @@ "packages": [ { "name": "masterminds/html5", - "version": "2.8.1", - "version_normalized": "2.8.1.0", + "version": "2.9.0", + "version_normalized": "2.9.0.0", "source": { "type": "git", "url": "https://github.com/Masterminds/html5-php.git", - "reference": "f47dcf3c70c584de14f21143c55d9939631bc6cf" + "reference": "f5ac2c0b0a2eefca70b2ce32a5809992227e75a6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Masterminds/html5-php/zipball/f47dcf3c70c584de14f21143c55d9939631bc6cf", - "reference": "f47dcf3c70c584de14f21143c55d9939631bc6cf", + "url": "https://api.github.com/repos/Masterminds/html5-php/zipball/f5ac2c0b0a2eefca70b2ce32a5809992227e75a6", + "reference": "f5ac2c0b0a2eefca70b2ce32a5809992227e75a6", "shasum": "" }, "require": { @@ -20,9 +20,9 @@ "php": ">=5.3.0" }, "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7.21 || ^6 || ^7 || ^8" + "phpunit/phpunit": "^4.8.35 || ^5.7.21 || ^6 || ^7 || ^8 || ^9" }, - "time": "2023-05-10T11:58:31+00:00", + "time": "2024-03-31T07:05:07+00:00", "type": "library", "extra": { "branch-alias": { @@ -66,7 +66,7 @@ ], "support": { "issues": "https://github.com/Masterminds/html5-php/issues", - "source": "https://github.com/Masterminds/html5-php/tree/2.8.1" + "source": "https://github.com/Masterminds/html5-php/tree/2.9.0" }, "install-path": "../masterminds/html5" }, @@ -216,17 +216,17 @@ }, { "name": "symfony/polyfill-ctype", - "version": "v1.28.0", - "version_normalized": "1.28.0.0", + "version": "v1.29.0", + "version_normalized": "1.29.0.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb" + "reference": "ef4d7e442ca910c4764bce785146269b30cb5fc4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb", - "reference": "ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/ef4d7e442ca910c4764bce785146269b30cb5fc4", + "reference": "ef4d7e442ca910c4764bce785146269b30cb5fc4", "shasum": "" }, "require": { @@ -238,12 +238,9 @@ "suggest": { "ext-ctype": "For best performance" }, - "time": "2023-01-26T09:26:14+00:00", + "time": "2024-01-29T20:11:03+00:00", "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.28-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -281,7 +278,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.28.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.29.0" }, "funding": [ { @@ -301,17 +298,17 @@ }, { "name": "symfony/polyfill-mbstring", - "version": "v1.28.0", - "version_normalized": "1.28.0.0", + "version": "v1.29.0", + "version_normalized": "1.29.0.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "42292d99c55abe617799667f454222c54c60e229" + "reference": "9773676c8a1bb1f8d4340a62efe641cf76eda7ec" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/42292d99c55abe617799667f454222c54c60e229", - "reference": "42292d99c55abe617799667f454222c54c60e229", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9773676c8a1bb1f8d4340a62efe641cf76eda7ec", + "reference": "9773676c8a1bb1f8d4340a62efe641cf76eda7ec", "shasum": "" }, "require": { @@ -323,12 +320,9 @@ "suggest": { "ext-mbstring": "For best performance" }, - "time": "2023-07-28T09:04:16+00:00", + "time": "2024-01-29T20:11:03+00:00", "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.28-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -367,7 +361,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.28.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.29.0" }, "funding": [ { diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index 97cbe1bf..90280aec 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -3,7 +3,7 @@ 'name' => 'automattic/vip-block-data-api', 'pretty_version' => 'dev-trunk', 'version' => 'dev-trunk', - 'reference' => '6de847ac4eebc3cb19cb0bb417f8bf5c5f9be643', + 'reference' => '5539d360dc829a7ee143d046a5783789651d9e32', 'type' => 'wordpress-plugin', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -13,16 +13,16 @@ 'automattic/vip-block-data-api' => array( 'pretty_version' => 'dev-trunk', 'version' => 'dev-trunk', - 'reference' => '6de847ac4eebc3cb19cb0bb417f8bf5c5f9be643', + 'reference' => '5539d360dc829a7ee143d046a5783789651d9e32', 'type' => 'wordpress-plugin', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), 'dev_requirement' => false, ), 'masterminds/html5' => array( - 'pretty_version' => '2.8.1', - 'version' => '2.8.1.0', - 'reference' => 'f47dcf3c70c584de14f21143c55d9939631bc6cf', + 'pretty_version' => '2.9.0', + 'version' => '2.9.0.0', + 'reference' => 'f5ac2c0b0a2eefca70b2ce32a5809992227e75a6', 'type' => 'library', 'install_path' => __DIR__ . '/../masterminds/html5', 'aliases' => array(), @@ -47,18 +47,18 @@ 'dev_requirement' => false, ), 'symfony/polyfill-ctype' => array( - 'pretty_version' => 'v1.28.0', - 'version' => '1.28.0.0', - 'reference' => 'ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb', + 'pretty_version' => 'v1.29.0', + 'version' => '1.29.0.0', + 'reference' => 'ef4d7e442ca910c4764bce785146269b30cb5fc4', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/polyfill-ctype', 'aliases' => array(), 'dev_requirement' => false, ), 'symfony/polyfill-mbstring' => array( - 'pretty_version' => 'v1.28.0', - 'version' => '1.28.0.0', - 'reference' => '42292d99c55abe617799667f454222c54c60e229', + 'pretty_version' => 'v1.29.0', + 'version' => '1.29.0.0', + 'reference' => '9773676c8a1bb1f8d4340a62efe641cf76eda7ec', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/polyfill-mbstring', 'aliases' => array(), diff --git a/vendor/masterminds/html5/README.md b/vendor/masterminds/html5/README.md index e80dec50..fb6e5625 100644 --- a/vendor/masterminds/html5/README.md +++ b/vendor/masterminds/html5/README.md @@ -30,7 +30,7 @@ HTML5 provides the following features. - Interoperability with [QueryPath](https://github.com/technosophos/querypath) - Runs on **PHP** 5.3.0 or newer -[![Build Status](https://travis-ci.org/Masterminds/html5-php.png?branch=master)](https://travis-ci.org/Masterminds/html5-php) +[![CI](https://github.com/Masterminds/html5-php/actions/workflows/ci.yaml/badge.svg)](https://github.com/Masterminds/html5-php/actions/workflows/ci.yaml) [![Latest Stable Version](https://poser.pugx.org/masterminds/html5/v/stable.png)](https://packagist.org/packages/masterminds/html5) [![Code Coverage](https://scrutinizer-ci.com/g/Masterminds/html5-php/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/Masterminds/html5-php/?branch=master) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/Masterminds/html5-php/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/Masterminds/html5-php/?branch=master) diff --git a/vendor/masterminds/html5/composer.json b/vendor/masterminds/html5/composer.json index 69f5da04..35b4a573 100644 --- a/vendor/masterminds/html5/composer.json +++ b/vendor/masterminds/html5/composer.json @@ -24,7 +24,7 @@ "php" : ">=5.3.0" }, "require-dev": { - "phpunit/phpunit" : "^4.8.35 || ^5.7.21 || ^6 || ^7 || ^8" + "phpunit/phpunit" : "^4.8.35 || ^5.7.21 || ^6 || ^7 || ^8 || ^9" }, "autoload": { "psr-4": {"Masterminds\\": "src"} diff --git a/vendor/masterminds/html5/src/HTML5/Elements.php b/vendor/masterminds/html5/src/HTML5/Elements.php index 1632dcfe..5d8cfd44 100644 --- a/vendor/masterminds/html5/src/HTML5/Elements.php +++ b/vendor/masterminds/html5/src/HTML5/Elements.php @@ -71,6 +71,24 @@ class Elements */ const BLOCK_ONLY_INLINE = 128; + /** + * Elements with optional end tags that cause auto-closing of previous and parent tags, + * as example most of the table related tags, see https://www.w3.org/TR/html401/struct/tables.html + * Structure is as follows: + * TAG-NAME => [PARENT-TAG-NAME-TO-CLOSE1, PARENT-TAG-NAME-TO-CLOSE2, ...]. + * + * Order is important, after auto-closing one parent with might have to close also their parent. + * + * @var array + */ + public static $optionalEndElementsParentsToClose = array( + 'tr' => array('td', 'tr'), + 'td' => array('td', 'th'), + 'th' => array('td', 'th'), + 'tfoot' => array('td', 'th', 'tr', 'tbody', 'thead'), + 'tbody' => array('td', 'th', 'tr', 'thead'), + ); + /** * The HTML5 elements as defined in http://dev.w3.org/html5/markup/elements.html. * diff --git a/vendor/masterminds/html5/src/HTML5/Parser/DOMTreeBuilder.php b/vendor/masterminds/html5/src/HTML5/Parser/DOMTreeBuilder.php index 293d83e2..d165b66b 100644 --- a/vendor/masterminds/html5/src/HTML5/Parser/DOMTreeBuilder.php +++ b/vendor/masterminds/html5/src/HTML5/Parser/DOMTreeBuilder.php @@ -359,6 +359,16 @@ public function startTag($name, $attributes = array(), $selfClosing = false) $this->onlyInline = null; } + // some elements as table related tags might have optional end tags that force us to auto close multiple tags + // https://www.w3.org/TR/html401/struct/tables.html + if ($this->current instanceof \DOMElement && isset(Elements::$optionalEndElementsParentsToClose[$lname])) { + foreach (Elements::$optionalEndElementsParentsToClose[$lname] as $parentElName) { + if ($this->current instanceof \DOMElement && $this->current->tagName === $parentElName) { + $this->autoclose($parentElName); + } + } + } + try { $prefix = ($pos = strpos($lname, ':')) ? substr($lname, 0, $pos) : ''; diff --git a/vendor/masterminds/html5/src/HTML5/Parser/StringInputStream.php b/vendor/masterminds/html5/src/HTML5/Parser/StringInputStream.php index 0c213feb..75b08861 100644 --- a/vendor/masterminds/html5/src/HTML5/Parser/StringInputStream.php +++ b/vendor/masterminds/html5/src/HTML5/Parser/StringInputStream.php @@ -183,6 +183,7 @@ public function getColumnOffset() * * @return string The current character. */ + #[\ReturnTypeWillChange] public function current() { return $this->data[$this->char]; @@ -192,6 +193,7 @@ public function current() * Advance the pointer. * This is part of the Iterator interface. */ + #[\ReturnTypeWillChange] public function next() { ++$this->char; @@ -200,6 +202,7 @@ public function next() /** * Rewind to the start of the string. */ + #[\ReturnTypeWillChange] public function rewind() { $this->char = 0; @@ -210,6 +213,7 @@ public function rewind() * * @return bool Whether the current pointer location is valid. */ + #[\ReturnTypeWillChange] public function valid() { return $this->char < $this->EOF; @@ -324,6 +328,7 @@ public function peek() return false; } + #[\ReturnTypeWillChange] public function key() { return $this->char; diff --git a/vendor/symfony/polyfill-ctype/composer.json b/vendor/symfony/polyfill-ctype/composer.json index e5c978f1..b222fdab 100644 --- a/vendor/symfony/polyfill-ctype/composer.json +++ b/vendor/symfony/polyfill-ctype/composer.json @@ -30,9 +30,6 @@ }, "minimum-stability": "dev", "extra": { - "branch-alias": { - "dev-main": "1.28-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" diff --git a/vendor/symfony/polyfill-mbstring/composer.json b/vendor/symfony/polyfill-mbstring/composer.json index 943e5029..bd99d4b9 100644 --- a/vendor/symfony/polyfill-mbstring/composer.json +++ b/vendor/symfony/polyfill-mbstring/composer.json @@ -30,9 +30,6 @@ }, "minimum-stability": "dev", "extra": { - "branch-alias": { - "dev-main": "1.28-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" diff --git a/vip-block-data-api.php b/vip-block-data-api.php index 07d7e43d..3b9c6c4a 100644 --- a/vip-block-data-api.php +++ b/vip-block-data-api.php @@ -5,8 +5,9 @@ * Description: Access Gutenberg block data in JSON via the REST API. * Author: WordPress VIP * Text Domain: vip-block-data-api + * Version: 1.2.4 + * Requires at least: 6.0 * Version: 1.2.3 - * Requires at least: 5.9.0 * Tested up to: 6.4 * Requires PHP: 8.0 * License: GPL-3 @@ -20,7 +21,7 @@ if ( ! defined( 'VIP_BLOCK_DATA_API_LOADED' ) ) { define( 'VIP_BLOCK_DATA_API_LOADED', true ); - define( 'WPCOMVIP__BLOCK_DATA_API__PLUGIN_VERSION', '1.2.3' ); + define( 'WPCOMVIP__BLOCK_DATA_API__PLUGIN_VERSION', '1.2.4' ); define( 'WPCOMVIP__BLOCK_DATA_API__REST_ROUTE', 'vip-block-data-api/v1' ); // Analytics related configs.