Files
crmPRO/tests/Controllers/TasksControllerTest.php
Jacek Pyziak 5161d0f979 Refactor work time management and billing summary
- Introduced a new `TasksController` to handle work time logic, moving it from the factory layer to the domain layer.
- Created `WorkTimeRepository` to encapsulate data access for work time tasks, including methods to retrieve clients with unsettled tasks and calculate task times.
- Updated the work time view to display a consolidated billing summary with improved UI elements and AJAX functionality for closing tasks.
- Added new styles for the billing summary section in `style.scss`.
- Implemented tests for the `TasksController` and `WorkTimeRepository` to ensure functionality and correctness.
- Established a refactoring plan for future improvements and migrations within the CRM system.
2026-02-06 21:32:11 +01:00

25 lines
704 B
PHP

<?php
require_once __DIR__ . '/../../autoload/Controllers/class.TasksController.php';
use Controllers\TasksController;
function assert_same( $expected, $actual, $message )
{
if ( $expected !== $actual )
throw new Exception( $message );
}
function run_tasks_controller_tests()
{
$clients = [
[ 'id' => 1, 'firm' => 'ACME', 'tasks' => [ '2026-01' => [] ] ]
];
$settings = [ 'hourly_rate' => 250 ];
$view_model = TasksController::workTimeViewModel( $clients, $settings );
assert_same( $clients, $view_model['work_time_clients'], 'Expected work_time_clients to be passed through.' );
assert_same( $settings, $view_model['settings'], 'Expected settings to be passed through.' );
}