A project management app derived from Mind-Vision-Code
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

139 Zeilen
3.8KB

  1. <?php
  2. declare(strict_types=1);
  3. require_once __DIR__ . '/../autoload.php';
  4. use Core\App;
  5. use Core\Database;
  6. use Core\Dispatcher;
  7. use Core\MigrationManager;
  8. use Core\Request;
  9. use Core\Router;
  10. $tempMigrationPath = sys_get_temp_dir() . '/project_compass_migrations_' . uniqid('', true);
  11. mkdir($tempMigrationPath, 0777, true);
  12. copy(__DIR__ . '/../database/migrations/20260509_000001_create_project_management_tables.php', $tempMigrationPath . '/20260509_000001_create_projects_tables.php');
  13. $memoryDatabase = new Database([
  14. 'dsn' => 'sqlite::memory:',
  15. 'options' => [
  16. PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
  17. PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
  18. ],
  19. ]);
  20. set_database($memoryDatabase);
  21. (new MigrationManager($memoryDatabase, $tempMigrationPath))->runPending();
  22. require_once __DIR__ . '/../database/seed_projects.php';
  23. seed_projects(4, true);
  24. $router = new Router();
  25. $app = new App();
  26. require_once __DIR__ . '/../routes/web.php';
  27. $dispatcher = new Dispatcher($router, $app);
  28. $home = $dispatcher->dispatch(new Request([], [], [
  29. 'REQUEST_METHOD' => 'GET',
  30. 'REQUEST_URI' => '/',
  31. ]));
  32. if ($home->status() !== 200 || strpos($home->content(), 'Project Compass') === false) {
  33. echo "FAIL: dashboard did not render\n";
  34. exit(1);
  35. }
  36. $projectsPage = $dispatcher->dispatch(new Request([], [], [
  37. 'REQUEST_METHOD' => 'GET',
  38. 'REQUEST_URI' => '/projects',
  39. ]));
  40. if ($projectsPage->status() !== 200 || strpos($projectsPage->content(), 'Projects') === false) {
  41. echo "FAIL: projects list did not render\n";
  42. exit(1);
  43. }
  44. $createPage = $dispatcher->dispatch(new Request([], [], [
  45. 'REQUEST_METHOD' => 'GET',
  46. 'REQUEST_URI' => '/projects/create',
  47. ]));
  48. if ($createPage->status() !== 200 || strpos($createPage->content(), 'Create project') === false) {
  49. echo "FAIL: create project page did not render\n";
  50. exit(1);
  51. }
  52. $projectPage = $dispatcher->dispatch(new Request([], [], [
  53. 'REQUEST_METHOD' => 'GET',
  54. 'REQUEST_URI' => '/projects/1',
  55. ]));
  56. if ($projectPage->status() !== 200 || strpos($projectPage->content(), 'Kanban board') === false) {
  57. echo "FAIL: project board did not render\n";
  58. exit(1);
  59. }
  60. $newProjectRequest = new Request([
  61. '_token' => csrf_token(),
  62. ], [
  63. '_token' => csrf_token(),
  64. 'name' => 'Orbit Mobile Relaunch',
  65. 'code' => '',
  66. 'client_name' => 'Orbit Labs',
  67. 'description' => 'A fresh mobile experience with project tracking and delivery visibility.',
  68. 'status' => 'planned',
  69. 'start_date' => '2026-05-09',
  70. 'due_date' => '2026-08-09',
  71. 'budget_cents' => '750000',
  72. 'owner_name' => 'Jordan Ellis',
  73. 'color_token' => 'emerald',
  74. 'members_text' => "Jordan Ellis\nRiley Kim",
  75. ], [
  76. 'REQUEST_METHOD' => 'POST',
  77. 'REQUEST_URI' => '/projects',
  78. ]);
  79. $created = $dispatcher->dispatch($newProjectRequest);
  80. if ($created->status() !== 302) {
  81. echo "FAIL: project creation did not redirect\n";
  82. exit(1);
  83. }
  84. $taskRequest = new Request([
  85. '_token' => csrf_token(),
  86. ], [
  87. '_token' => csrf_token(),
  88. 'title' => 'Design the intake flow',
  89. 'description' => 'Create a simple intake flow for requests and approvals.',
  90. 'priority' => 'high',
  91. 'status' => 'backlog',
  92. 'assignee' => 'Jordan Ellis',
  93. 'estimate_hours' => '10',
  94. 'due_date' => '2026-05-20',
  95. ], [
  96. 'REQUEST_METHOD' => 'POST',
  97. 'REQUEST_URI' => '/projects/5/tasks',
  98. ]);
  99. $taskCreated = $dispatcher->dispatch($taskRequest);
  100. if ($taskCreated->status() !== 302) {
  101. echo "FAIL: task creation did not redirect\n";
  102. exit(1);
  103. }
  104. $activity = $dispatcher->dispatch(new Request([], [], [
  105. 'REQUEST_METHOD' => 'GET',
  106. 'REQUEST_URI' => '/activity',
  107. ]));
  108. if ($activity->status() !== 200 || strpos($activity->content(), 'Activity feed') === false) {
  109. echo "FAIL: activity feed did not render\n";
  110. exit(1);
  111. }
  112. echo "PASS: project management app routes and data flow work\n";

Powered by TurnKey Linux.