fix(tests): define PR_CORE_PLUGIN_DIR + trailingslashit in bootstrap

PHP Lint (8.2) failed after the floatval removal surfaced a deeper
issue: the autoloader references PR_CORE_PLUGIN_DIR unconditionally,
which is defined in the main plugin bootstrap but not loaded by the
test runner. Same for trailingslashit (a WP function the autoloader
calls).

Added constants and a tiny trailingslashit stub to tests/bootstrap.php
so plain-php unit runs can load the autoloader and exercise the CPT
class. No runtime behavior change — test harness only.
This commit is contained in:
peptiderepo
2026-04-22 08:40:03 +00:00
parent e0ce324d00
commit 874f93b252

View File

@@ -22,6 +22,24 @@ if ( ! defined( 'PR_CORE_VERSION' ) ) {
define( 'PR_CORE_VERSION', '0.2.0' );
}
if ( ! defined( 'PR_CORE_PLUGIN_DIR' ) ) {
define( 'PR_CORE_PLUGIN_DIR', realpath( __DIR__ . '/..' ) . '/' );
}
if ( ! defined( 'PR_CORE_PLUGIN_URL' ) ) {
define( 'PR_CORE_PLUGIN_URL', 'http://example.test/wp-content/plugins/peptide-repo-core/' );
}
if ( ! defined( 'PR_CORE_PLUGIN_FILE' ) ) {
define( 'PR_CORE_PLUGIN_FILE', PR_CORE_PLUGIN_DIR . 'peptide-repo-core.php' );
}
if ( ! function_exists( 'trailingslashit' ) ) {
function trailingslashit( string $path ): string {
return rtrim( $path, '/\\' ) . '/';
}
}
/**
* Global harness state. Tests reset this between cases.
*