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:
@@ -22,6 +22,24 @@ if ( ! defined( 'PR_CORE_VERSION' ) ) {
|
|||||||
define( 'PR_CORE_VERSION', '0.2.0' );
|
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.
|
* Global harness state. Tests reset this between cases.
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user