xarxaprod-wp-theme/vendor/wp-cli/php-cli-tools/tests/bootstrap.php

31 lines
818 B
PHP
Raw Normal View History

2024-01-09 16:13:20 +01:00
<?php
require dirname( dirname( __FILE__ ) ) . '/lib/cli/cli.php';
/**
* Compatibility with PHPUnit 6+
*/
if ( class_exists( 'PHPUnit\Runner\Version' ) ) {
require_once dirname( __FILE__ ) . '/phpunit6-compat.php';
}
function cli_autoload( $className ) {
$className = ltrim($className, '\\');
$fileName = '';
$namespace = '';
if ($lastNsPos = strrpos($className, '\\')) {
$namespace = substr($className, 0, $lastNsPos);
$className = substr($className, $lastNsPos + 1);
$fileName = str_replace('\\', DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR;
}
$fileName .= str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php';
if ( 'cli' !== substr( $fileName, 0, 3 ) ) {
return;
}
require dirname( dirname( __FILE__ ) ) . '/lib/' . $fileName;
}
spl_autoload_register( 'cli_autoload' );