> For the complete documentation index, see [llms.txt](https://wonder-image.gitbook.io/wonder-image-gestionale/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://wonder-image.gitbook.io/wonder-image-gestionale/guida-introduttiva/sviluppo-e-test.md).

# Sviluppo, test e sito di prova

## Sito di prova

`boilerplates/ecommerce-site` risponde su `https://ecommerce.test` con il database `ecommerce_site` e ha il modulo collegato da repository `path`. È lì che si prova tutto: `forge update`, il backend nel browser, gli screenshot della guida.

```bash
cd /Users/andreamarinoni/Developer/boilerplates/ecommerce-site
php forge update
```

`APP_ENV=local` nel `.env` tiene il sito in locale; mettendo `production` si provano la sola lettura e la sincronizzazione — ricordarsi di rimetterlo.

## Test

```bash
php tests/run.php            # tutto
php tests/TaxTotalsTest.php  # un file solo
```

| Livello      | Cosa copre                                                                                          | Database         |
| ------------ | --------------------------------------------------------------------------------------------------- | ---------------- |
| Unitari      | classi pure: codici, numeri, IVA, stato delle funzionalità, controlli dei Primi passi               | no               |
| Convenzioni  | ogni Resource dichiara la sua funzionalità, prefisso `gst_`, id stabili nelle tabelle sincronizzate | no               |
| Integrazione | righe precaricate, numerazione, log degli stati, sync, sola lettura                                 | `ecommerce_site` |

I test d'integrazione stanno in `tests/integrazione/` e girano **dentro una transazione che annulla sempre**, anche quando falliscono: il database del sito resta com'era. Le righe che servono se le creano da soli, senza dare per scontato cosa c'è nel sito.

GitHub Actions esegue unitari e convenzioni a ogni push; l'integrazione resta locale, perché vuole il database.

## Comandi

```bash
php forge gestionale:demo              # dati di prova, solo in locale
php forge gestionale:demo --fresh      # toglie i dati di prova e li rifà
php forge gestionale:features-doc      # riscrive la tabella nella guida
```

## Trappole già pagate

* Il registro dei Model legge la **prima** parola `class` del file, commenti compresi: un esempio di codice in un docblock fa fallire il boot.
* `Model::prepare()` non genera i codici `uniqueCode()`: chi inserisce da codice se li fa dare dal Model.
* Una colonna che vive in un'altra tabella si mostra nell'elenco con un formatter a closure, non dichiarandola e basta.
* `$ALERT` non vuoto significa errore e blocca il salvataggio: per dire che è andata bene c'è il toast.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://wonder-image.gitbook.io/wonder-image-gestionale/guida-introduttiva/sviluppo-e-test.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `build a script that syncs our docs to a CMS` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
