Skip to content

Commit

Permalink
Refactor LOCAL_DEVELOPMENT.
Browse files Browse the repository at this point in the history
  • Loading branch information
david_smith committed Jan 14, 2025
1 parent 48a079d commit f84f9d7
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 58 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
/CONTRIBUTING.md export-ignore
/docker-compose.yml export-ignore
/LICENSE.md export-ignore
/LOCAL_DEVELOPMENT.md export-ignore
/phpunit.xml export-ignore
/README.md export-ignore
/SECURITY.md export-ignore
Expand Down
60 changes: 60 additions & 0 deletions LOCAL_DEVELOPMENT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Local Development

## Contents

- [Introduction](#introduction)
- [Prerequisites](#prerequisites)
- [Initializing](#initializing)
- [Testing](#testing)
- [Configuration](#configuration)

## Introduction

This project provides a convenient [dock](https://github.com/zero-to-prod/dock) script to simplify local development workflows within Docker
containers.

You can use this script to initialize the project, manage Composer dependencies, and run tests in a consistent PHP environment.

## Prerequisites

- Docker installed and running
- A `.env` file (created automatically via the `dock init` command, if it doesn’t already exist)

## Initializing

Use the following commands to set up the project:

```shell
sh dock init
sh dock composer update
```

## Testing

This command runs PHPUnit inside the Docker container, using the PHP version specified in your `.env` file.
You can modify or extend this script to include additional tests or commands as needed.

```shell
sh dock test
```

Run the test suite with all versions of php:

```shell
sh test.sh
```

## Configuration

Before starting development, verify that your `.env` file contains the correct settings.

You can specify which PHP version to use for local development, debugging, and Composer operations by updating these variables in your `.env` file:

```dotenv
PHP_VERSION=8.1
PHP_DEBUG=8.1
PHP_COMPOSER=8.1
```

Make sure these values reflect the PHP versions you intend to use.
If the `.env` file does not exist, run the `sh dock init` command to create one from the `.env.example` template.
59 changes: 1 addition & 58 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,7 @@
- [search()](#search)
- [Factories](#factories)
- [Mocking](#mocking)
- [Local Development](#local-development)
- [Prerequisites](#prerequisites)
- [Initializing](#initializing)
- [Testing](#testing)
- [Configuration](#configuration)
- [Local Development](./LOCAL_DEVELOPMENT.md)
- [Contributing](#contributing)

## Introduction
Expand Down Expand Up @@ -154,59 +150,6 @@ $Omdb = new Omdb(new OmdbApiFake());
$Omdb->search('Avatar');
```

## Local Development

This project provides a convenient [dock](https://github.com/zero-to-prod/dock) script to simplify local development workflows within Docker
containers.

You can use this script to initialize the project, manage Composer dependencies, and run tests in a consistent PHP environment.

### Prerequisites

- Docker installed and running
- A `.env` file (created automatically via the `dock init` command, if it doesn’t already exist)

### Initializing

Use the following commands to set up the project:

```shell
sh dock init
sh dock composer update
```

### Testing

This command runs PHPUnit inside the Docker container, using the PHP version specified in your `.env` file.
You can modify or extend this script to include additional tests or commands as needed.

```shell
sh dock test
```

Run the test suite with all versions of php:

```shell
sh test.sh
```

### Configuration

Before starting development, verify that your `.env` file contains the correct settings.

You can specify which PHP version to use for local development, debugging, and Composer operations by updating these variables in your `.env` file:

```dotenv
PHP_VERSION=8.1
PHP_DEBUG=8.1
PHP_COMPOSER=8.1
```

Make sure these values reflect the PHP versions you intend to use.
If the `.env` file does not exist, run the `sh dock init` command to create one from the `.env.example` template.

Ensure you have installed all the development dependencies (composer install) before running the tests.

## Contributing

Contributions, issues, and feature requests are welcome!
Expand Down

0 comments on commit f84f9d7

Please sign in to comment.