mirror of
https://github.com/Frumph/comic-easel.git
synced 2026-08-24 12:02:53 -04:00
1a405071aa
The plugin has never had a test of any kind. The obstacle has always been that testing a WordPress plugin appears to require WordPress, and therefore a database. It does not, for the part that matters. The plugin's logic -- escaping decisions, SQL construction, payment validation -- depends only on its arguments plus a small set of WordPress helpers. Stubbing those gives a suite that runs in milliseconds with no database, no Docker and no WordPress checkout. Three of the stubs have to be faithful or the tests they support quietly stop meaning anything, and this is documented at the top of tests/stubs.php: - esc_html()/esc_attr() call _wp_specialchars() with $double_encode = false, so they leave existing entities alone, while esc_textarea() double-encodes. Much of this plugin's escaping behaviour turns on that difference, so a naive htmlspecialchars() stub would give the wrong answer. - wp_kses_post() is a recorder returning a sentinel rather than a reimplementation. The question worth asking is "was filtering applied", not "what did it strip". - apply_filters() passes through by default but is overridable, because the plugin's filters are the seams the tests need. Also included is a $wpdb spy that records the SQL it is handed. That is what allows the query construction to be tested without a database at all -- which matters here, because the plugin's queries use MySQL-only date functions that a SQLite test database would misreport. HarnessTest.php asserts these properties of the harness itself. If it fails, nothing else in the suite should be trusted. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
27 lines
689 B
JSON
27 lines
689 B
JSON
{
|
|
"name": "frumph/comic-easel",
|
|
"description": "Comic Easel — post webcomics to your WordPress theme.",
|
|
"type": "wordpress-plugin",
|
|
"license": "GPL-3.0-or-later",
|
|
"require": {
|
|
"php": ">=7.4"
|
|
},
|
|
"require-dev": {
|
|
"phpunit/phpunit": "^11.5",
|
|
"squizlabs/php_codesniffer": "^3.10",
|
|
"wp-coding-standards/wpcs": "^3.1",
|
|
"dealerdirect/phpcodesniffer-composer-installer": "^1.0"
|
|
},
|
|
"config": {
|
|
"allow-plugins": {
|
|
"dealerdirect/phpcodesniffer-composer-installer": true
|
|
}
|
|
},
|
|
"scripts": {
|
|
"test": "phpunit",
|
|
"lint": "phpcs",
|
|
"lint:fix": "phpcbf",
|
|
"lint:php": "find . -name '*.php' -not -path './vendor/*' -not -path './.git/*' -print0 | xargs -0 -n1 php -l"
|
|
}
|
|
}
|