Skip to content

Commit

Permalink
add a note on PHP setup, merge instructions for test db and productio…
Browse files Browse the repository at this point in the history
…n db
  • Loading branch information
creme332 committed Apr 18, 2024
1 parent fc20dd2 commit f778b45
Showing 1 changed file with 25 additions and 19 deletions.
44 changes: 25 additions & 19 deletions docs/INSTALLATION_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ some commands may differ. Please adapt accordingly.
- MySQL (v15.1 preferred)
- Composer with its executable on your $PATH
- Git
- NPM (optional)

## Setup project
## Project setup

Navigate to the document root of your server:

Expand Down Expand Up @@ -56,14 +57,14 @@ BUSINESS_GMAIL_PASSWORD=""
Some important notes:

- Update the values assigned to `DB_USERNAME` and `DB_PASSWORD` with your MySQL login details.
- If your Apache server is serving from a port other than the default one, add the new port number to `PUBLIC_ROOT` (
- If your Apache server is serving from a port other than the default one, include the port number to `PUBLIC_ROOT` (
e.g., `http://localhost:443/steamy-sips/public`) .
- `BUSINESS_GMAIL` and `BUSINESS_GMAIL_PASSWORD` are the credentials of the Gmail account from which emails will be sent
whenever a client places an order. It is recommended to use
a [Gmail App password](https://knowledge.workspace.google.com/kb/how-to-create-app-passwords-000009237)
for `BUSINESS_GMAIL_PASSWORD` instead of your actual gmail account password.

## Setup production database
## Database setup

Start your MySQL server and connect to its monitor:

Expand All @@ -76,32 +77,37 @@ mysql -u <username> -p
Create a database `cafe`:

```bash
```sql
create database cafe;
```

Select the database:

```
use cafe;
source resources/database/dump/cafe.sql;
exit;
```

Import data to the database from the SQL dump:
The path to the SQL dump might must be modified if you are not in the root directory of the project.

```bash
source resources/database/dump/cafe.sql
```
If you want to run unit tests with composer, you must first set up a separate database for testing. To do so, repeat the
same
instructions as above except name the testing database `cafe_test`:

The path to the SQL dump might must be modified if you are not in the root directory of the project.
```sql
create database cafe_test;
use cafe_test;
source resources/database/dump/cafe.sql;
exit;
```

## Setup testing database
## PHP setup

If you want to run tests for the application, you must set up a database for testing. To do so, repeat the same
instructions as the setup for the production database except name the testing database `cafe_test`.
Ensure that the [`variables_order`](https://www.php.net/manual/en/ini.core.php#ini.variables-) directive in
your `php.ini`
file is set to `"EGPCS"`. Without this, the application will
not be able to load environment variables properly in `src/core/config.php` and you will get an array key error.
You can use `php --ini` to find the location of your `php.ini` file.

## Setup linting and formatting
## Linting and formatting setup

This step is optional if you do not plan on editing the JS and CSS files. Node.js is required to install the linter and
This step is optional if you do not plan on editing the JS and CSS files. NPM is required to install the linter and
formatter for JS and CSS files. For more details on the linters and formatters used, see
our [coding standards](CODING_STANDARDS.md).

Expand Down

0 comments on commit f778b45

Please sign in to comment.