Skip to content

Commit

Permalink
Merge pull request #277 from faisalill/better-readme
Browse files Browse the repository at this point in the history
Updated Documentation.
  • Loading branch information
abnegate authored Jul 26, 2023
2 parents a9f7060 + 7c3b5c5 commit 540ec7e
Show file tree
Hide file tree
Showing 2 changed files with 811 additions and 127 deletions.
74 changes: 74 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,80 @@ This is also important for the Utopia-php lead developers to be able to give tec

You can follow our [Adding new Database Adapter](docs/add-new-adapter.md) tutorial to add new database support in this library.

## Tests

To run tests, you first need to bring up the example Docker stack with the following command:

```bash
docker compose up -d --build
```

To run all unit tests, use the following Docker command:

```bash
docker compose exec tests vendor/bin/phpunit --configuration phpunit.xml tests
```

To run tests for a single file, use the following Docker command structure:

```bash
docker compose exec tests vendor/bin/phpunit --configuration phpunit.xml tests/Database/[FILE_PATH]
```

To run static code analysis, use the following phpstan command:

```bash
composer check
```

### Load testing

Three commands have been added to `bin/` to fill, index, and query the DB to test changes:

- `bin/load` invokes `bin/tasks/load.php`
- `bin/index` invokes `bin/tasks/index.php`
- `bin/query` invokes `bin/tasks/query.php`

To test your DB changes under load:

#### Load the database

```bash
docker compose exec tests bin/load --adapter=[adapter] --limit=[limit] [--name=[name]]

# [adapter]: either 'mongodb' or 'mariadb', no quotes
# [limit]: integer of total documents to generate
# [name]: (optional) name for new database
```
#### Create indexes
```bash
docker compose exec tests bin/index --adapter=[adapter] --name=[name]

# [adapter]: either 'mongodb' or 'mariadb', no quotes
# [name]: name of filled database by bin/load
```
#### Run Query Suite
```bash
docker compose exec tests bin/query --adapter=[adapter] --limit=[limit] --name=[name]

# [adapter]: either 'mongodb' or 'mariadb', no quotes
# [limit]: integer of query limit (default 25)
# [name]: name of filled database by bin/load
```
#### Visualize Query Results
```bash
docker compose exec tests bin/compare
```
Navigate to `localhost:8708` to visualize query results.
## Other Ways to Help
Pull requests are great, but there are many other areas where you can help Utopia-php.
Expand Down
Loading

0 comments on commit 540ec7e

Please sign in to comment.