PHP code example of cleaniquecoders / uat

1. Go to this page and download the library: Download cleaniquecoders/uat library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

cleaniquecoders / uat example snippets


return [
    // Output directory for UAT documentation
    'directory' => env('UAT_DIRECTORY', 'uat'),

    // Available output formats
    'formats' => [
        'markdown' => MarkdownGenerator::class,
        'json' => JsonGenerator::class,
    ],

    // Middleware rule mappings
    'rules' => [
        'middleware' => [
            'auth' => [
                'type' => 'authentication',
                'description' => 'User must be logged in',
                'action' => 'Navigate to /login and authenticate',
                'validation' => 'Verify user session is active',
            ],
        ],
        'pattern' => [
            'role:*' => [
                'type' => 'role_authorization',
                'description' => "User must have '{placeholder}' role",
                'action' => "Login with user assigned to '{placeholder}' role",
            ],
        ],
    ],

    // Controller policy mappings
    'policy_mappings' => [
        'UserController' => [
            'policy' => 'UserPolicy',
            'methods' => [
                'index' => [
                    'description' => 'User must have user security view permissions',
                    'permissions' => ['view-user-security'],
                    'roles' => ['superadmin', 'administrator'],
                ],
            ],
        ],
    ],
];

use CleaniqueCoders\Uat\Actions\GenerateUatScript;

// Generate UAT scripts
$result = GenerateUatScript::run(
    outputDir: storage_path('uat-docs'),
    format: 'markdown'
);

// Result contains:
// - directory: Path to generated files
// - generated_files: Array of created file paths
// - date: Generation date

use CleaniqueCoders\Uat\Facades\Uat;

// Access UAT services through the facade
$projectInfo = Uat::getProjectInformation();
$modules = Uat::getAvailableModules();
$users = Uat::getUsers();

use CleaniqueCoders\Uat\Contracts\Data;

class CustomDataService implements Data
{
    public function getProjectInformation(): array
    {
        // Custom project info logic
    }

    public function getUsers(): Collection
    {
        // Custom user data logic
    }

    public function getAvailableModules(): array
    {
        // Custom module discovery logic
    }
}

use CleaniqueCoders\Uat\Contracts\Presentation;

class CustomPresentationFormat implements Presentation
{
    public function getExtension(): string
    {
        return 'custom';
    }

    public function generateProjectInfo(array $projectInfo): string
    {
        // Custom formatting logic
    }

    // Implement other 
bash
php artisan vendor:publish --tag="uat-config"
bash
# Generate Markdown documentation (default)
php artisan uat:generate

# Generate JSON documentation
php artisan uat:generate --format=json

# Specify custom output directory
php artisan uat:generate --output-dir=/path/to/custom/directory

# Generate with verbose output for debugging
php artisan uat:generate --verbose