feat: Complete Woles Framework v1.0 with enterprise-grade UI

- Add comprehensive error handling system with custom error pages
- Implement professional enterprise-style design with Tailwind CSS
- Create modular HMVC architecture with clean separation of concerns
- Add security features: CSRF protection, XSS filtering, Argon2ID hashing
- Include CLI tools for development workflow
- Add error reporting dashboard with system monitoring
- Implement responsive design with consistent slate color scheme
- Replace all emoji icons with professional SVG icons
- Add comprehensive test suite with PHPUnit
- Include database migrations and seeders
- Add proper exception handling with fallback pages
- Implement template engine with custom syntax support
- Add helper functions and facades for clean code
- Include proper logging and debugging capabilities
This commit is contained in:
mwpn
2025-10-11 07:08:23 +07:00
commit 0b42271bfe
90 changed files with 8315 additions and 0 deletions

86
tests/RouterTest.php Normal file
View File

@@ -0,0 +1,86 @@
<?php
namespace Tests;
use App\Core\Router;
/**
* Router test cases
*/
class RouterTest extends TestCase
{
private Router $router;
protected function setUp(): void
{
parent::setUp();
$this->router = new Router();
}
public function testCanRegisterGetRoute(): void
{
$this->router->get('/test', 'TestController@index');
$routes = $this->router->getRoutes();
$this->assertArrayHasKey('GET', $routes);
$this->assertCount(1, $routes['GET']);
}
public function testCanRegisterPostRoute(): void
{
$this->router->post('/test', 'TestController@store');
$routes = $this->router->getRoutes();
$this->assertArrayHasKey('POST', $routes);
$this->assertCount(1, $routes['POST']);
}
public function testCanMatchSimpleRoute(): void
{
$this->router->get('/test', 'TestController@index');
$route = $this->router->match('GET', '/test');
$this->assertNotNull($route);
$this->assertEquals('TestController@index', $route['handler']);
}
public function testCanMatchRouteWithParameters(): void
{
$this->router->get('/users/{id}', 'UserController@show');
$route = $this->router->match('GET', '/users/123');
$this->assertNotNull($route);
$this->assertEquals('UserController@show', $route['handler']);
$this->assertEquals('123', $route['params']['id']);
}
public function testReturnsNullForNonMatchingRoute(): void
{
$this->router->get('/test', 'TestController@index');
$route = $this->router->match('GET', '/nonexistent');
$this->assertNull($route);
}
public function testCanMatchMultipleRoutes(): void
{
$this->router->get('/users', 'UserController@index');
$this->router->get('/users/{id}', 'UserController@show');
$this->router->post('/users', 'UserController@store');
$indexRoute = $this->router->match('GET', '/users');
$showRoute = $this->router->match('GET', '/users/123');
$storeRoute = $this->router->match('POST', '/users');
$this->assertNotNull($indexRoute);
$this->assertNotNull($showRoute);
$this->assertNotNull($storeRoute);
$this->assertEquals('UserController@index', $indexRoute['handler']);
$this->assertEquals('UserController@show', $showRoute['handler']);
$this->assertEquals('UserController@store', $storeRoute['handler']);
}
}