Skip to content

Commit 4fc0f53

Browse files
committed
Merge branch '1.x'
2 parents 4702361 + d0a3174 commit 4fc0f53

193 files changed

Lines changed: 11171 additions & 7102 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ jobs:
88
timeout-minutes: 45
99
strategy:
1010
matrix:
11-
php: [ '8.3' ]
12-
laravel: [ '11.45' ]
11+
php: [ '8.4' ]
12+
laravel: [ '11.47' ]
1313
name: PHP ${{ matrix.php }} Laravel ${{ matrix.laravel }}
1414
steps:
1515
- name: Checkout

.junie/guidelines.md

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
# Towerify — Development Guidelines
2+
3+
This document captures project-specific knowledge to onboard advanced contributors quickly and to prevent common
4+
pitfalls.
5+
6+
## Build and Configuration
7+
8+
- Stack: Laravel (Wave starter kit (https://devdojo.com/wave)), Volt for UI, Tailwind + Vite, MySQL, PHP 8.2+.
9+
- Wave/Volt: Public and admin pages are Volt-powered and live under the Wave theme; see structure below.
10+
- Node tooling: Vite for asset build, Tailwind configured via `tailwind.config.js`.
11+
12+
Environment basics (local):
13+
14+
- PHP dependencies: `composer install`
15+
- Node dependencies: `npm ci` (or `npm i`)
16+
- Environment file: copy `.env.example` to `.env`, then adjust values (mail, DB, external services). For testing
17+
specifics, see the Testing section.
18+
- App key: `php artisan key:generate` (not needed during PHPUnit runs because a testing key is already provided in
19+
`phpunit.xml`).
20+
- Build assets (development): `npm run dev` (hot reload: `npm run dev -- --watch`), production: `npm run build`.
21+
- Start app: `php artisan serve` or your preferred container orchestration. A `compose.yaml` exists if you standardize
22+
on Docker Compose.
23+
24+
Laravel/Wave configuration notes:
25+
26+
- Theme location: `resources/themes/cywise`.
27+
- Translations: update `lang/fr.json` when adding/modifying UI strings. Keep French in sync with English.
28+
29+
Adding Navigation and Pages to the website:
30+
31+
- Add a new page (Laravel Folio): create a Blade view in `resources/themes/cywise/pages`.
32+
- Modify the website header: edit `resources/themes/cywise/components/marketing/elements/header.blade.php`.
33+
- Modify the website footer: edit `resources/themes/cywise/partials/footer.blade.php`.
34+
- Modify the website homepage: edit `resources/themes/cywise/pages/index.blade.php`.
35+
- Always use Tailwind classes for UI components. Only create new CSS classes if absolutely necessary.
36+
37+
Adding Navigation and Pages to the webapp:
38+
39+
- Add a menu item: edit `resources/themes/cywise/components/app/sidebar.blade.php`.
40+
- Add a new page (iframe pattern used by the app):
41+
1) Create the Blade view in `resources/themes/cywise/iframes`.
42+
2) Create a controller in `app/Http/Controllers/Iframes` that returns that Blade view.
43+
3) Register a route in `routes/web.php` pointing to the controller.
44+
4) Create a loader page (Laravel Folio) in `resources/themes/cywise/pages` that embeds the route via an `<iframe>`.
45+
- Add a new JavaScript API call to a JSON-RPC endpoint: edit `resources/themes/cywise/iframes/_json-rpc.blade.php`.
46+
- Add a new image to a page: copy the image to `public/cywise/img` and reference it in the Blade view.
47+
- Add a new CSS class: edit `public/cywise/css/app.css`.
48+
- Add a new JavaScript file: add new js files to `public/cywise/js` and import them in the Blade view.
49+
- Always use FastBootstrap (https://fastbootstrap.com/) for UI components. Only create new CSS classes if absolutely
50+
necessary.
51+
- Our custom BlockNoteJs (https://www.blocknotejs.org/) component lives in `resources/js/block-note.jsx` and is imported
52+
in `resources/themes/cywise/iframes/cyberscribe.blade.php`.
53+
- The `resources/views` directory mosty contains deprecated views.
54+
55+
API (JSON‑RPC 2.0):
56+
57+
- Procedures live in `app/Http/Procedures` and follow Sajya (https://sajya.github.io/). When creating new procedures,
58+
ensure they are registered in `routes/api.php` and covered by tests.
59+
60+
Filament Admin Theming:
61+
62+
- Admin theme overrides live in `resources/css/filament/admin/theme.css`. This file imports the base Filament theme,
63+
overrides several classes, and is built via Tailwind/Vite (see `@config 'tailwind.config.js';`).
64+
65+
## Testing
66+
67+
Overview:
68+
69+
- Test runner: PHPUnit 10 (configured by `phpunit.xml`).
70+
- Suites: `tests/Unit` and `tests/Feature` with files ending in `*Test.php`.
71+
- Bootstrap: `vendor/autoload.php` (no Laravel kernel boot in the default bootstrap).
72+
- Test environment: `phpunit.xml` forces `APP_ENV=testing` and provides an application key. It also defines DB
73+
credentials for MySQL tests (see below).
74+
75+
Running tests:
76+
77+
- Composer script (if available) or direct: `vendor/bin/phpunit`
78+
- Run a single test file: `vendor/bin/phpunit tests/Unit/SmokeTest.php`
79+
80+
Database‑backed tests:
81+
82+
- Some unit tests rely on MySQL and `FastRefreshDatabase` (see `tests/TestCaseWithDb.php`).
83+
- To enable DB tests locally, provision a test database and user as documented inline in `tests/TestCaseWithDb.php`:
84+
- Create DB: `CREATE DATABASE tw_testdb DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;`
85+
- Create user: `CREATE USER 'tw_testuser'@'localhost' IDENTIFIED BY 'z0rglub';`
86+
- Grant rights: `GRANT ALL ON tw_testdb.* TO 'tw_testuser'@'localhost'; FLUSH PRIVILEGES;`
87+
- Alternatively, point the `DB_*` envs in `phpunit.xml` to a containerized MySQL instance.
88+
89+
Non‑DB, fast tests:
90+
91+
- You can add plain PHPUnit tests that do not boot Laravel or touch the DB. This is recommended for pure logic and smoke
92+
checks to keep the suite fast.
93+
94+
How to add a new simple test (demonstrated and verified):
95+
96+
1) Create a test file under `tests/Unit`, for example `tests/Unit/SmokeTest.php` with the following content:
97+
98+
```
99+
<?php
100+
101+
declare(strict_types=1);
102+
103+
use PHPUnit\Framework\TestCase;
104+
105+
final class SmokeTest extends TestCase
106+
{
107+
public function test_truth(): void
108+
{
109+
$this->assertTrue(true);
110+
}
111+
}
112+
```
113+
114+
2) Run the tests: `vendor/bin/phpunit` (or target just that file).
115+
116+
3) Expectation: the test passes without requiring the Laravel application or a database.
117+
118+
Notes:
119+
120+
- If you need Laravel features (routing, HTTP, models), create tests that extend a base TestCase which boots the app.
121+
For DB usage, extend `Tests\TestCaseWithDb` and ensure the test DB is reachable. For no‑DB but Laravel HTTP helpers,
122+
consider adding a proper `tests/TestCase.php` with `CreatesApplication` if needed.
123+
124+
## Code Style and Conventions
125+
126+
- Follow the repository’s existing formatting. A Pint configuration (`pint.json`) is present; run `./vendor/bin/pint` to
127+
auto‑fix style.
128+
- Tailwind classes and FastBootstrap are used for UI — remain consistent with existing utility classes.
129+
- Blade views for Wave/Volt pages live under `resources/themes/cywise`. Keep components idiomatic and translations
130+
updated in `lang/fr.json`.
131+
- When touching Filament admin styles, update `resources/css/filament/admin/theme.css` and rebuild assets via Vite.
132+
133+
## Troubleshooting
134+
135+
- “Environment is not testing. I quit” — `tests/TestCaseWithDb.php` enforces `APP_ENV=testing` to protect data. Ensure
136+
you run via PHPUnit or set the env accordingly.
137+
- Missing DB during tests — either skip DB tests or configure `DB_*` envs per `phpunit.xml`.
138+
- Tailwind classes not applied — ensure `npm run dev`/`build` has run and that Vite is serving the correct assets.

0 commit comments

Comments
 (0)