Files
crm-ms1/test_autoload.php
2026-05-27 11:48:31 -04:00

30 lines
910 B
PHP

<?php
require_once __DIR__ . '/vendor/autoload.php';
use Common\Util;
echo "<pre>";
if (!class_exists('Common\Util')) {
echo "❌ La classe Common\\Util n'est pas chargée." . PHP_EOL;
echo "📁 Chemin courant : " . __DIR__ . PHP_EOL;
echo "📄 Autoloader chargé : " . (file_exists(__DIR__ . '/vendor/autoload.php') ? 'oui' : 'non') . PHP_EOL;
echo "🧠 Liste partielle des classes déclarées : " . PHP_EOL;
print_r(array_filter(get_declared_classes(), fn($c) => str_starts_with($c, 'Common')));
exit;
}
echo "✅ Classe Common\\Util chargée." . PHP_EOL;
if (method_exists('Common\Util', 'is_cli')) {
echo "✅ Méthode is_cli() détectée." . PHP_EOL;
if (Util::is_cli()) {
echo "🖥️ Exécuté en CLI." . PHP_EOL;
} else {
echo "🌐 Exécuté via navigateur web." . PHP_EOL;
}
} else {
echo "❌ Méthode is_cli() non trouvée.";
}