PHP Classes

File: src/Tools/ModuleGeneratorEnhanced/tests/generate-test.php

Recommend this page to a friend!
  Packages of Adrian M   upMVC   src/Tools/ModuleGeneratorEnhanced/tests/generate-test.php   Download  
File: src/Tools/ModuleGeneratorEnhanced/tests/generate-test.php
Role: Example script
Content type: text/plain
Description: Example script
Class: upMVC
Pure PHP web development without other frameworks
Author: By
Last change:
Date: 2 months ago
Size: 1,002 bytes
 

Contents

Class file image Download
<?php
/**
 * Simple test to generate a module and verify namespace convention
 */

require_once 'ModuleGeneratorEnhanced.php';

use
App\Tools\ModuleGeneratorEnhanced\ModuleGeneratorEnhanced;

echo
"? Generating Test Module: 'TestNamespace'\n";
echo
"==========================================\n";

// Test with mixed case input
$config = [
   
'name' => 'TestNamespace',
   
'type' => 'basic',
   
'create_table' => false,
   
'use_middleware' => false,
   
'create_submodules' => false
];

try {
   
$generator = new ModuleGeneratorEnhanced($config);
   
    echo
"? Starting generation...\n";
   
$success = $generator->generate();
   
    if (
$success) {
        echo
"\n? Module generated successfully!\n";
        echo
"? Check: modules/testnamespace/ directory\n";
        echo
"?? Expected namespace: 'Testnamespace'\n";
    } else {
        echo
"\n? Module generation failed!\n";
    }
   
} catch (
Exception $e) {
    echo
"? Error: " . $e->getMessage() . "\n";
}