2017-12-01 03:40:04 +00:00
|
|
|
<?xml version="1.0"?>
|
|
|
|
<ruleset name="WordPress Coding Standards">
|
|
|
|
<description>Apply WordPress Coding Standards to all Core files</description>
|
|
|
|
|
2019-09-25 14:01:51 +00:00
|
|
|
<!-- Only scan PHP files. -->
|
|
|
|
<arg name="extensions" value="php"/>
|
|
|
|
|
|
|
|
<!-- Whenever possible, cache the scan results and re-use those for unchanged files on the next scan. -->
|
2021-11-16 14:17:26 +00:00
|
|
|
<arg name="cache" value=".cache/phpcs.json"/>
|
2019-09-25 14:01:51 +00:00
|
|
|
|
|
|
|
<!-- Set the memory limit to 256M.
|
|
|
|
For most standard PHP configurations, this means the memory limit will temporarily be raised.
|
|
|
|
Ref: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Advanced-Usage#specifying-phpini-settings
|
|
|
|
-->
|
|
|
|
<ini name="memory_limit" value="256M"/>
|
|
|
|
|
|
|
|
<!-- Strip the filepaths down to the relevant bit. -->
|
|
|
|
<arg name="basepath" value="./"/>
|
|
|
|
|
|
|
|
<!-- Check up to 20 files simultaneously. -->
|
|
|
|
<arg name="parallel" value="20"/>
|
|
|
|
|
2020-01-29 00:43:23 +00:00
|
|
|
<!-- Show sniff codes in all reports. -->
|
2019-09-25 14:01:51 +00:00
|
|
|
<arg value="ps"/>
|
|
|
|
|
|
|
|
<file>.</file>
|
|
|
|
|
2017-12-01 03:40:04 +00:00
|
|
|
<rule ref="WordPress-Core"/>
|
|
|
|
<rule ref="WordPress.CodeAnalysis.EmptyStatement"/>
|
|
|
|
|
Coding Standards: Move the remaining PHPCS errors to report as warnings, and add Travis tests.
The remaining error-level coding standards issues (specifically, associated with the sniffs `WordPress.PHP.YodaConditions.NotYoda`, `WordPress.NamingConventions.ValidVariableName.VariableNotSnakeCase`, `WordPress.DB.PreparedSQL.InterpolatedNotPrepared`, `WordPress.DB.PreparedSQL.NotPrepared`, and `WordPress.Files.FileName.InvalidClassFileName`) are marked as warnings, until they're all addressed.
This change allows us to run linting on Travis across the entire codebase, ensuring no other error-level violations can be introduced.
Additionally, PHPCS will now cache results locally, drastically improving performance for subsequent checks: scanning the entire codebase takes 1-2 minutes the first time, and less than one second for subsequent checks.
See #47632.
git-svn-id: https://develop.svn.wordpress.org/trunk@45665 602fd350-edb4-49c9-b593-d223f7449a82
2019-07-19 07:47:16 +00:00
|
|
|
<!-- These rules are being set as warnings instead of errors, so we can error check the entire codebase. -->
|
|
|
|
<rule ref="WordPress.NamingConventions.ValidVariableName.VariableNotSnakeCase">
|
|
|
|
<type>warning</type>
|
|
|
|
</rule>
|
|
|
|
<rule ref="WordPress.DB.PreparedSQL.InterpolatedNotPrepared">
|
|
|
|
<type>warning</type>
|
|
|
|
</rule>
|
|
|
|
<rule ref="WordPress.DB.PreparedSQL.NotPrepared">
|
|
|
|
<type>warning</type>
|
|
|
|
</rule>
|
|
|
|
<rule ref="WordPress.Files.FileName.InvalidClassFileName">
|
|
|
|
<type>warning</type>
|
|
|
|
</rule>
|
|
|
|
|
2019-01-12 06:05:55 +00:00
|
|
|
<rule ref="WordPress.NamingConventions.ValidVariableName">
|
|
|
|
<properties>
|
|
|
|
<property name="customPropertiesWhitelist" type="array">
|
2020-01-29 00:43:23 +00:00
|
|
|
<!-- From database structure queries. -->
|
2019-01-12 06:05:55 +00:00
|
|
|
<element value="Collation"/>
|
|
|
|
<element value="Column_name"/>
|
|
|
|
<element value="Default"/>
|
|
|
|
<element value="Extra"/>
|
|
|
|
<element value="Field"/>
|
|
|
|
<element value="Index_type"/>
|
|
|
|
<element value="Key"/>
|
|
|
|
<element value="Key_name"/>
|
|
|
|
<element value="Msg_text"/>
|
|
|
|
<element value="Non_unique"/>
|
|
|
|
<element value="Null"/>
|
|
|
|
<element value="Sub_part"/>
|
|
|
|
<element value="Type"/>
|
2020-01-29 00:43:23 +00:00
|
|
|
<!-- From plugin/theme data. -->
|
2019-01-12 06:05:55 +00:00
|
|
|
<element value="authorAndUri"/>
|
|
|
|
<element value="Name"/>
|
|
|
|
<element value="Version"/>
|
2020-01-29 00:43:23 +00:00
|
|
|
<!-- From the result of wp_xmlrpc_server::wp_getPageList(). -->
|
2019-01-12 06:05:55 +00:00
|
|
|
<element value="dateCreated"/>
|
|
|
|
|
2020-01-29 00:43:23 +00:00
|
|
|
<!-- From DOMDocument. -->
|
2019-01-12 06:05:55 +00:00
|
|
|
<element value="childNodes"/>
|
Script Loader: Add support for HTML 5 "async" and "defer" attributes.
This allows developers to register scripts with an intended loading strategy by changing the `$in_footer` parameter of `wp_register_script` and `wp_enqueue_script` to an array that accepts both an `in_footer` and `strategy` argument. If present, the loading strategy attribute will be added to the script tag when that script is printed to the page as long as it is not a dependency of any blocking scripts, including any inline scripts attached to the script or any of its dependents.
Props 10upsimon, thekt12, westonruter, costdev, flixos90, spacedmonkey, adamsilverstein, azaozz, mukeshpanchal27, mor10, scep, wpnook, vanaf1979, Otto42.
Fixes #12009.
git-svn-id: https://develop.svn.wordpress.org/trunk@56033 602fd350-edb4-49c9-b593-d223f7449a82
2023-06-26 13:40:31 +00:00
|
|
|
<element value="firstChild"/>
|
2019-01-12 06:05:55 +00:00
|
|
|
<element value="formatOutput"/>
|
Script Loader: Add support for HTML 5 "async" and "defer" attributes.
This allows developers to register scripts with an intended loading strategy by changing the `$in_footer` parameter of `wp_register_script` and `wp_enqueue_script` to an array that accepts both an `in_footer` and `strategy` argument. If present, the loading strategy attribute will be added to the script tag when that script is printed to the page as long as it is not a dependency of any blocking scripts, including any inline scripts attached to the script or any of its dependents.
Props 10upsimon, thekt12, westonruter, costdev, flixos90, spacedmonkey, adamsilverstein, azaozz, mukeshpanchal27, mor10, scep, wpnook, vanaf1979, Otto42.
Fixes #12009.
git-svn-id: https://develop.svn.wordpress.org/trunk@56033 602fd350-edb4-49c9-b593-d223f7449a82
2023-06-26 13:40:31 +00:00
|
|
|
<element value="lastChild"/>
|
2019-01-12 06:05:55 +00:00
|
|
|
<element value="nodeName"/>
|
|
|
|
<element value="nodeType"/>
|
|
|
|
<element value="parentNode"/>
|
|
|
|
<element value="preserveWhiteSpace"/>
|
|
|
|
<element value="textContent"/>
|
2020-01-29 00:43:23 +00:00
|
|
|
<!-- From PHPMailer. -->
|
2019-01-12 06:05:55 +00:00
|
|
|
<element value="AltBody"/>
|
|
|
|
<element value="Body"/>
|
|
|
|
<element value="CharSet"/>
|
|
|
|
<element value="ContentType"/>
|
|
|
|
<element value="Encoding"/>
|
|
|
|
<element value="Hostname"/>
|
|
|
|
<element value="mailHeader"/>
|
|
|
|
<element value="MIMEBody"/>
|
|
|
|
<element value="MIMEHeader"/>
|
|
|
|
<element value="Sender"/>
|
|
|
|
<element value="Subject"/>
|
2020-01-29 00:43:23 +00:00
|
|
|
<!-- From PHPUnit_Util_Getopt. -->
|
2019-01-12 06:05:55 +00:00
|
|
|
<element value="longOptions"/>
|
2020-01-29 00:43:23 +00:00
|
|
|
<!-- From POP3. -->
|
2019-01-12 06:05:55 +00:00
|
|
|
<element value="ERROR"/>
|
2020-01-29 00:43:23 +00:00
|
|
|
<!-- From ZipArchive. -->
|
2019-01-12 06:05:55 +00:00
|
|
|
<element value="numFiles"/>
|
|
|
|
</property>
|
|
|
|
</properties>
|
|
|
|
</rule>
|
|
|
|
|
2021-04-10 12:05:50 +00:00
|
|
|
<!-- Exclude the build folder in the current directory. -->
|
2018-08-17 01:50:26 +00:00
|
|
|
<exclude-pattern type="relative">^build/*</exclude-pattern>
|
|
|
|
|
2020-01-29 00:43:23 +00:00
|
|
|
<!-- Directories and third party library exclusions. -->
|
2017-12-01 03:40:04 +00:00
|
|
|
<exclude-pattern>/node_modules/*</exclude-pattern>
|
|
|
|
<exclude-pattern>/vendor/*</exclude-pattern>
|
|
|
|
|
|
|
|
<exclude-pattern>/src/wp-admin/includes/class-ftp*</exclude-pattern>
|
|
|
|
<exclude-pattern>/src/wp-admin/includes/class-pclzip\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>/src/wp-admin/includes/deprecated\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>/src/wp-admin/includes/ms-deprecated\.php</exclude-pattern>
|
|
|
|
|
|
|
|
<exclude-pattern>/src/wp-includes/atomlib\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>/src/wp-includes/class-IXR\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>/src/wp-includes/class-json\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>/src/wp-includes/class-phpass\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>/src/wp-includes/class-pop3\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>/src/wp-includes/class-requests\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>/src/wp-includes/class-simplepie\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>/src/wp-includes/class-snoopy\.php</exclude-pattern>
|
2019-01-12 04:00:42 +00:00
|
|
|
<exclude-pattern>/src/wp-includes/class-wp-block-parser\.php</exclude-pattern>
|
2017-12-01 03:40:04 +00:00
|
|
|
<exclude-pattern>/src/wp-includes/deprecated\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>/src/wp-includes/ms-deprecated\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>/src/wp-includes/pluggable-deprecated\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>/src/wp-includes/rss\.php</exclude-pattern>
|
|
|
|
|
2020-01-03 13:15:33 +00:00
|
|
|
<exclude-pattern>/src/wp-includes/assets/*</exclude-pattern>
|
2019-01-12 04:00:42 +00:00
|
|
|
<exclude-pattern>/src/wp-includes/blocks/*</exclude-pattern>
|
2017-12-01 03:40:04 +00:00
|
|
|
<exclude-pattern>/src/wp-includes/ID3/*</exclude-pattern>
|
|
|
|
<exclude-pattern>/src/wp-includes/IXR/*</exclude-pattern>
|
2019-07-02 23:41:16 +00:00
|
|
|
<exclude-pattern>/src/wp-includes/js/*</exclude-pattern>
|
2020-06-13 12:34:12 +00:00
|
|
|
<exclude-pattern>/src/wp-includes/PHPMailer/*</exclude-pattern>
|
2017-12-01 03:40:04 +00:00
|
|
|
<exclude-pattern>/src/wp-includes/random_compat/*</exclude-pattern>
|
|
|
|
<exclude-pattern>/src/wp-includes/Requests/*</exclude-pattern>
|
|
|
|
<exclude-pattern>/src/wp-includes/SimplePie/*</exclude-pattern>
|
2019-03-21 05:55:05 +00:00
|
|
|
<exclude-pattern>/src/wp-includes/sodium_compat/*</exclude-pattern>
|
2020-06-13 12:34:12 +00:00
|
|
|
<exclude-pattern>/src/wp-includes/Text/*</exclude-pattern>
|
2017-12-01 03:40:04 +00:00
|
|
|
|
2020-01-29 00:43:23 +00:00
|
|
|
<!-- Test data and fixtures. -->
|
2017-12-01 03:40:04 +00:00
|
|
|
<exclude-pattern>/tests/phpunit/build*</exclude-pattern>
|
|
|
|
<exclude-pattern>/tests/phpunit/data/*</exclude-pattern>
|
|
|
|
|
|
|
|
<exclude-pattern>/tools/*</exclude-pattern>
|
|
|
|
|
2020-05-02 18:15:30 +00:00
|
|
|
<!-- Drop-in plugins. -->
|
|
|
|
<exclude-pattern>/src/wp-content/advanced-cache\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>/src/wp-content/blog-deleted\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>/src/wp-content/blog-inactive\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>/src/wp-content/blog-suspended\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>/src/wp-content/db-error\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>/src/wp-content/db\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>/src/wp-content/fatal-error-handler\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>/src/wp-content/install\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>/src/wp-content/maintenance\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>/src/wp-content/object-cache\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>/src/wp-content/php-error\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>/src/wp-content/sunrise\.php</exclude-pattern>
|
|
|
|
|
|
|
|
<!-- Must-Use plugins. -->
|
|
|
|
<exclude-pattern>/src/wp-content/mu-plugins/*</exclude-pattern>
|
|
|
|
|
|
|
|
<!-- Plugins. -->
|
|
|
|
<exclude-pattern>/src/wp-content/plugins/*</exclude-pattern>
|
|
|
|
|
|
|
|
<!-- Themes except the twenty* themes. -->
|
|
|
|
<exclude-pattern>/src/wp-content/themes/(?!twenty)*</exclude-pattern>
|
|
|
|
|
2022-07-30 14:08:13 +00:00
|
|
|
<!-- Allow the WP DB Class and related tests for usage of direct database access functions. -->
|
2017-12-01 03:40:04 +00:00
|
|
|
<rule ref="WordPress.DB.RestrictedFunctions">
|
2022-07-21 15:58:51 +00:00
|
|
|
<exclude-pattern>/src/wp-includes/class-wpdb\.php</exclude-pattern>
|
2017-12-01 03:40:04 +00:00
|
|
|
<exclude-pattern>/tests/phpunit/tests/db/charset\.php</exclude-pattern>
|
|
|
|
</rule>
|
|
|
|
|
2022-07-30 14:08:13 +00:00
|
|
|
<!-- Allow the WP DB related tests for issues with prepared SQL placeholders
|
2017-12-01 03:40:04 +00:00
|
|
|
(as the handling of those are being tested). -->
|
|
|
|
<rule ref="WordPress.DB.PreparedSQLPlaceholders.UnfinishedPrepare">
|
|
|
|
<exclude-pattern>/tests/phpunit/tests/db\.php</exclude-pattern>
|
|
|
|
</rule>
|
|
|
|
<rule ref="WordPress.DB.PreparedSQLPlaceholders.UnsupportedPlaceholder">
|
|
|
|
<exclude-pattern>/tests/phpunit/tests/db\.php</exclude-pattern>
|
|
|
|
</rule>
|
|
|
|
<rule ref="WordPress.DB.PreparedSQLPlaceholders.UnescapedLiteral">
|
|
|
|
<exclude-pattern>/tests/phpunit/tests/db\.php</exclude-pattern>
|
|
|
|
</rule>
|
2018-09-14 07:54:53 +00:00
|
|
|
<rule ref="WordPress.DB.PreparedSQL.NotPrepared">
|
|
|
|
<exclude-pattern>/tests/phpunit/tests/admin/includesSchema\.php</exclude-pattern>
|
2018-09-24 15:22:01 +00:00
|
|
|
<exclude-pattern>/tests/phpunit/tests/multisite/site\.php</exclude-pattern>
|
2018-09-14 07:54:53 +00:00
|
|
|
</rule>
|
2018-06-15 15:56:58 +00:00
|
|
|
|
2022-07-30 14:08:13 +00:00
|
|
|
<!-- Allow the I18n functions file for issues identified by the I18n sniff
|
2020-02-07 19:14:29 +00:00
|
|
|
(such as calling the low-level translate() function). -->
|
2018-06-15 15:56:58 +00:00
|
|
|
<rule ref="WordPress.WP.I18n">
|
|
|
|
<exclude-pattern>/src/wp-includes/l10n\.php</exclude-pattern>
|
2019-01-11 06:03:46 +00:00
|
|
|
<exclude-pattern>/tests/phpunit/tests/l10n\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>/tests/phpunit/tests/l10n/loadTextdomainJustInTime\.php</exclude-pattern>
|
2018-06-15 15:56:58 +00:00
|
|
|
</rule>
|
2017-12-01 03:40:04 +00:00
|
|
|
|
2019-07-05 08:03:40 +00:00
|
|
|
<!-- Translator comments aren't needed in unit tests. -->
|
|
|
|
<rule ref="WordPress.WP.I18n.MissingTranslatorsComment">
|
|
|
|
<exclude-pattern>/tests/*</exclude-pattern>
|
|
|
|
</rule>
|
|
|
|
|
2017-12-01 03:40:04 +00:00
|
|
|
<rule ref="Generic.Functions.FunctionCallArgumentSpacing">
|
|
|
|
<exclude-pattern>/wp-config\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>/wp-config-sample\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>/wp-tests-config\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>/wp-tests-config-sample\.php</exclude-pattern>
|
|
|
|
</rule>
|
|
|
|
|
2019-05-28 00:25:42 +00:00
|
|
|
<!-- Exclude checking of line endings when reporting errors, but fix them when running phpcbf.
|
2020-02-07 19:14:29 +00:00
|
|
|
Git and SVN manage these pretty well cross-platform as "native".
|
2022-07-30 14:08:13 +00:00
|
|
|
Allow configuration files. -->
|
2018-08-17 01:50:26 +00:00
|
|
|
<rule ref="Generic.Files.LineEndings">
|
|
|
|
<exclude-pattern>/wp-config\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>/wp-config-sample\.php</exclude-pattern>
|
2019-05-28 00:25:42 +00:00
|
|
|
<exclude phpcs-only="true" name="Generic.Files.LineEndings"/>
|
2018-08-17 01:50:26 +00:00
|
|
|
</rule>
|
|
|
|
|
2019-01-11 04:59:23 +00:00
|
|
|
<!-- WPCS1620: template.php isn't a template tag file. -->
|
|
|
|
<rule ref="WordPress.Files.FileName.InvalidTemplateTagFileName">
|
|
|
|
<exclude-pattern>/src/wp-includes/template\.php</exclude-pattern>
|
|
|
|
</rule>
|
|
|
|
|
2019-01-11 06:16:35 +00:00
|
|
|
<!-- WPCS1621: These files are expected to use _ instead of -. -->
|
|
|
|
<rule ref="WordPress.Files.FileName.NotHyphenatedLowercase">
|
|
|
|
<exclude-pattern>/src/_index\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>/src/wp-admin/_index\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>/src/wp-content/themes/twentythirteen/taxonomy-post_format\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>/src/wp-content/themes/twentyfourteen/taxonomy-post_format\.php</exclude-pattern>
|
|
|
|
</rule>
|
|
|
|
|
2022-07-30 14:08:13 +00:00
|
|
|
<!-- Allow test classes for select sniffs. -->
|
2017-12-01 03:40:04 +00:00
|
|
|
<rule ref="WordPress.Files.FileName">
|
|
|
|
<properties>
|
2019-07-08 00:55:20 +00:00
|
|
|
<property name="custom_test_class_whitelist" type="array">
|
2021-08-26 13:35:16 +00:00
|
|
|
<!-- Test case parent classes in the "includes" folder, not yet accounted for in WPCS. -->
|
Build/Test Tools: Use the PHPUnit Polyfill TestCase as `void` workaround.
> PHPUnit 8.0.0 introduced a `void` return type declaration to the "fixture" methods – `setUpBeforeClass()`, `setUp()`, `tearDown()` and `tearDownAfterClass()`. As the `void` return type was not introduced until PHP 7.1, this makes it more difficult to create cross-version compatible tests when using fixtures, due to signature mismatches.
>
> The `Yoast\PHPUnitPolyfills\TestCases\TestCase` overcomes the signature mismatch by having two versions. The correct one will be loaded depending on the PHPUnit version being used.
>
> When using this TestCase, if an individual test, or another TestCase which extends this TestCase, needs to overload any of the "fixture" methods, it should do so by using a snake_case variant of the original fixture method name, i.e. `set_up_before_class()`, `set_up()`, `assert_pre_conditions()`, `assert_post_conditions()`, `tear_down()`, and `tear_down_after_class()`.
>
> The snake_case methods will automatically be called by PHPUnit.
>
> > IMPORTANT: The snake_case methods should not call the PHPUnit parent, i.e. do not use `parent::setUp()` from within an overloaded `set_up()` method. If necessary, DO call `parent::set_up()`.
Reference: https://github.com/Yoast/PHPUnit-Polyfills#testcases
This commit:
* Lets the `PHPUnit_Adapter_TestCase` extend the `Yoast\PHPUnitPolyfills\TestCases\TestCase`, which makes this solution for the `void` return type available to the WordPress test suite.
* Removes the individual import and trait `use` statements for the Polyfill traits. These are no longer necessary as the `Yoast\PHPUnitPolyfills\TestCases\TestCase` already includes those.
Follow-up to [51559-51566].
Props jrf, hellofromTonya, johnbillion, netweb, SergeyBiryukov.
See #46149.
git-svn-id: https://develop.svn.wordpress.org/trunk@51567 602fd350-edb4-49c9-b593-d223f7449a82
2021-08-07 10:20:05 +00:00
|
|
|
<element value="PHPUnit_Adapter_TestCase"/>
|
2021-08-26 13:35:16 +00:00
|
|
|
<element value="WP_Test_XML_TestCase"/>
|
|
|
|
|
|
|
|
<!-- Test case parent classes outside of the "includes" folder. -->
|
|
|
|
<element value="Tests_Query_Conditionals"/>
|
Editor: Adds template types, `is_wp_suggestion`, and fallback template content.
This commit improves site editor templates by:
* Adds a post meta `is_wp_suggestion` to templates created from the site editor.
Why? To differentiate the templates created from the post editor in the Template panel in inspector controls and the templates suggested in site editor.
See [https://github.com/WordPress/gutenberg/pull/41387 Gutenberg PR 41387] for more details.
* Expands the template types that can be added to the site editor to include single custom post type and specific posts templates.
See [https://github.com/WordPress/gutenberg/pull/41189 Gutenberg PR 41189] for more details.
* Adds fallback template content on creation in site editor:
* Introduces `get_template_hierarchy()` to get the template hierarchy for a given template slug to be created.
* Adds a `lookup` route to `WP_REST_Templates_Controller` to get the fallback template content.
See [https://github.com/WordPress/gutenberg/pull/42520 Gutenberg PR 42520] for more details.
* Fixes a typo in default category template's description within `get_default_block_template_types()`.
See [https://github.com/WordPress/gutenberg/pull/42586 Gutenberg PR 42586] for more details.
* Changes field checks from `in_array()` to `rest_is_field_included()` in `WP_REST_Post_Types_Controller`.
* Adds an `icon` field to `WP_REST_Post_Types_Controller`
Follow-up to [53129], [52331], [52275], [52062], [51962], [43087].
Props ntsekouras, spacedmonkey, mamaduka, mburridge, jameskoster, bernhard-reiter, mcsf, hellofromTonya.
See #56467.
git-svn-id: https://develop.svn.wordpress.org/trunk@54269 602fd350-edb4-49c9-b593-d223f7449a82
2022-09-20 21:19:10 +00:00
|
|
|
<element value="WP_Block_Templates_UnitTestCase"/>
|
2019-07-08 00:55:20 +00:00
|
|
|
<element value="WP_Filesystem_UnitTestCase"/>
|
|
|
|
<element value="WP_HTTP_UnitTestCase"/>
|
2021-08-26 13:35:16 +00:00
|
|
|
<element value="WP_Image_UnitTestCase"/>
|
2019-07-08 00:55:20 +00:00
|
|
|
<element value="WP_Import_UnitTestCase"/>
|
2021-06-08 23:12:22 +00:00
|
|
|
<element value="WP_Test_Adjacent_Image_Link_TestCase"/>
|
2021-08-26 13:35:16 +00:00
|
|
|
<element value="WP_Tests_Image_Resize_UnitTestCase"/>
|
Editor: Ensure global styles are rendered for third-party blocks.
This change ensures custom styles for all third-party blocks are rendered on the front end if assets are set to be loaded on a per-block basis. Additionally, this change includes new unit tests to help prevent a similar bug in the future.
Props scruffian, aristath, poena, wildworks, ajlende, andraganescu, ndiego, gigitux, cbravobernal, ramonopoly, andrewserong, oandregal, hellofromTonya, bernhard-reiter.
Fixes #56915.
git-svn-id: https://develop.svn.wordpress.org/trunk@54703 602fd350-edb4-49c9-b593-d223f7449a82
2022-10-27 15:39:20 +00:00
|
|
|
<element value="WP_Theme_UnitTestCase"/>
|
2019-07-08 00:55:20 +00:00
|
|
|
|
2020-01-29 00:43:23 +00:00
|
|
|
<!-- Mock classes. -->
|
2019-07-08 00:55:20 +00:00
|
|
|
<element value="Spy_REST_Server"/>
|
|
|
|
<element value="WP_REST_Test_Controller"/>
|
|
|
|
<element value="WP_Image_Editor_Mock"/>
|
|
|
|
<element value="WP_Filesystem_MockFS"/>
|
2021-11-23 18:55:23 +00:00
|
|
|
<element value="Mock_Invokable"/>
|
2019-07-08 00:55:20 +00:00
|
|
|
<element value="MockPHPMailer"/>
|
|
|
|
<element value="MockAction"/>
|
|
|
|
<element value="WP_Object_Cache"/>
|
|
|
|
|
2020-01-29 00:43:23 +00:00
|
|
|
<!-- PHPUnit helpers. -->
|
2019-07-08 00:55:20 +00:00
|
|
|
<element value="TracTickets"/>
|
|
|
|
<element value="WP_PHPUnit_Util_Getopt"/>
|
|
|
|
<element value="PHPUnit_Util_Test"/>
|
|
|
|
<element value="WPProfiler"/>
|
|
|
|
<element value="PHPUnit_Framework_Exception"/>
|
Build/Test Tools: Use the PHPUnit Polyfill TestCase as `void` workaround.
> PHPUnit 8.0.0 introduced a `void` return type declaration to the "fixture" methods – `setUpBeforeClass()`, `setUp()`, `tearDown()` and `tearDownAfterClass()`. As the `void` return type was not introduced until PHP 7.1, this makes it more difficult to create cross-version compatible tests when using fixtures, due to signature mismatches.
>
> The `Yoast\PHPUnitPolyfills\TestCases\TestCase` overcomes the signature mismatch by having two versions. The correct one will be loaded depending on the PHPUnit version being used.
>
> When using this TestCase, if an individual test, or another TestCase which extends this TestCase, needs to overload any of the "fixture" methods, it should do so by using a snake_case variant of the original fixture method name, i.e. `set_up_before_class()`, `set_up()`, `assert_pre_conditions()`, `assert_post_conditions()`, `tear_down()`, and `tear_down_after_class()`.
>
> The snake_case methods will automatically be called by PHPUnit.
>
> > IMPORTANT: The snake_case methods should not call the PHPUnit parent, i.e. do not use `parent::setUp()` from within an overloaded `set_up()` method. If necessary, DO call `parent::set_up()`.
Reference: https://github.com/Yoast/PHPUnit-Polyfills#testcases
This commit:
* Lets the `PHPUnit_Adapter_TestCase` extend the `Yoast\PHPUnitPolyfills\TestCases\TestCase`, which makes this solution for the `void` return type available to the WordPress test suite.
* Removes the individual import and trait `use` statements for the Polyfill traits. These are no longer necessary as the `Yoast\PHPUnitPolyfills\TestCases\TestCase` already includes those.
Follow-up to [51559-51566].
Props jrf, hellofromTonya, johnbillion, netweb, SergeyBiryukov.
See #46149.
git-svn-id: https://develop.svn.wordpress.org/trunk@51567 602fd350-edb4-49c9-b593-d223f7449a82
2021-08-07 10:20:05 +00:00
|
|
|
<element value="Polyfill_TestCase"/>
|
2019-07-08 00:55:20 +00:00
|
|
|
</property>
|
2017-12-01 03:40:04 +00:00
|
|
|
</properties>
|
|
|
|
</rule>
|
|
|
|
|
2019-07-09 05:44:42 +00:00
|
|
|
<rule ref="WordPress.PHP.NoSilencedErrors">
|
|
|
|
<properties>
|
|
|
|
<property name="custom_whitelist" type="array">
|
|
|
|
<element value="ssh2_connect"/>
|
|
|
|
<element value="ssh2_auth_password"/>
|
|
|
|
<element value="ssh2_auth_pubkey_file"/>
|
|
|
|
<element value="ftp_ssl_connect"/>
|
|
|
|
<element value="ftp_connect"/>
|
|
|
|
<element value="ftp_get_option"/>
|
|
|
|
<element value="ftp_set_option"/>
|
|
|
|
<element value="disk_free_space"/>
|
|
|
|
<element value="getimagesize"/>
|
|
|
|
<element value="iptcparse"/>
|
|
|
|
<element value="exif_read_data"/>
|
|
|
|
<element value="gzinflate"/>
|
|
|
|
<element value="gzuncompress"/>
|
|
|
|
<element value="gzdecode"/>
|
2021-08-26 13:19:17 +00:00
|
|
|
<element value="imagecreatefromwebp"/>
|
2019-07-09 05:44:42 +00:00
|
|
|
</property>
|
|
|
|
</properties>
|
|
|
|
</rule>
|
|
|
|
|
2020-02-07 19:14:29 +00:00
|
|
|
<!-- Enforce no parenthesis for language constructs, and only one space immediately after.
|
|
|
|
Including this rule is temporary until it is moved from the WordPress-Extra ruleset to
|
|
|
|
the WordPress-Core ruleset upstream.
|
|
|
|
-->
|
|
|
|
<rule ref="PEAR.Files.IncludingFile.BracketsNotRequired">
|
|
|
|
<type>warning</type>
|
|
|
|
</rule>
|
|
|
|
<rule ref="PEAR.Files.IncludingFile.UseRequire">
|
|
|
|
<type>warning</type>
|
|
|
|
</rule>
|
|
|
|
<rule ref="PEAR.Files.IncludingFile.UseRequireOnce">
|
|
|
|
<type>warning</type>
|
|
|
|
</rule>
|
|
|
|
<rule ref="Squiz.WhiteSpace.LanguageConstructSpacing"/>
|
|
|
|
|
2020-01-29 00:43:23 +00:00
|
|
|
<!-- Assignments in while conditions are a valid method of looping over iterables. -->
|
2019-07-05 03:13:31 +00:00
|
|
|
<rule ref="WordPress.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition">
|
|
|
|
<exclude-pattern>*</exclude-pattern>
|
|
|
|
</rule>
|
|
|
|
|
2017-12-01 03:40:04 +00:00
|
|
|
<!-- Exclude the unit tests from select sniffs. -->
|
|
|
|
<rule ref="WordPress.Files.FileName.NotHyphenatedLowercase">
|
|
|
|
<exclude-pattern>/tests/phpunit/tests/*</exclude-pattern>
|
|
|
|
</rule>
|
|
|
|
<rule ref="PEAR.NamingConventions.ValidClassName.Invalid">
|
|
|
|
<exclude-pattern>/tests/phpunit/tests/*</exclude-pattern>
|
|
|
|
</rule>
|
|
|
|
|
Administration: Replace contracted verb forms for better consistency.
This changeset replaces contracted verb forms like `doesn't`, `can't`, or `isn't` with non-contracted forms like `does not`, `cannot`, or `is not`, for better consistency across the WordPress administration. It also updates some corresponding unit tests strings.
Props Presskopp, socalchristina, aandrewdixon, francina, SergeyBiryukov, JeffPaul, audrasjb, hellofromTonya.
Fixes #38913.
See #39176.
git-svn-id: https://develop.svn.wordpress.org/trunk@52978 602fd350-edb4-49c9-b593-d223f7449a82
2022-03-22 16:23:32 +00:00
|
|
|
<!-- Exclude some old classes that cannot be renamed, as it would break back compat. -->
|
2019-07-17 04:33:27 +00:00
|
|
|
<rule ref="PEAR.NamingConventions.ValidClassName.Invalid">
|
|
|
|
<exclude-pattern>/src/wp-admin/includes/class-wp-filesystem-ftpsockets\.php</exclude-pattern>
|
2019-07-19 04:42:00 +00:00
|
|
|
<exclude-pattern>/src/wp-includes/class-wp-oembed\.php</exclude-pattern>
|
2019-07-17 04:33:27 +00:00
|
|
|
<exclude-pattern>/src/wp-includes/class-wp-oembed-controller\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>/src/wp-includes/class-wp-xmlrpc-server\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>/src/wp-includes/class-wp-text-diff-renderer-inline\.php</exclude-pattern>
|
|
|
|
</rule>
|
|
|
|
<rule ref="PEAR.NamingConventions.ValidClassName.StartWithCapital">
|
|
|
|
<exclude-pattern>/src/wp-admin/includes/class-wp-list-table-compat\.php</exclude-pattern>
|
2022-07-21 15:58:51 +00:00
|
|
|
<exclude-pattern>/src/wp-includes/class-wp-dependency\.php</exclude-pattern>
|
2019-07-17 04:33:27 +00:00
|
|
|
<exclude-pattern>/src/wp-includes/class-wp-editor\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>/src/wp-includes/class-wp-xmlrpc-server\.php</exclude-pattern>
|
2022-07-21 15:58:51 +00:00
|
|
|
<exclude-pattern>/src/wp-includes/class-wpdb\.php</exclude-pattern>
|
2019-07-17 04:33:27 +00:00
|
|
|
</rule>
|
2019-07-19 03:49:26 +00:00
|
|
|
|
|
|
|
<!-- Exclude some incorrectly named files that won't be renamed. -->
|
|
|
|
<rule ref="WordPress.Files.FileName.InvalidClassFileName">
|
|
|
|
<exclude-pattern>/src/wp-admin/includes/class-wp-list-table-compat\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>/src/wp-includes/class-wp-dependency\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>/src/wp-includes/class-wp-editor\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>/src/wp-content/themes/twentyeleven/inc/widgets\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>/src/wp-content/themes/twentyfourteen/inc/widgets\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>/src/wp-content/themes/twentyfourteen/inc/featured-content\.php</exclude-pattern>
|
|
|
|
</rule>
|
2017-12-01 03:40:04 +00:00
|
|
|
</ruleset>
|