Windows - tips and tricks
When using Windows to bypass the main errors we recommend to follow the next :-
Before you cloned the repo, make sure that you configure git to use the correct line endings.
- Explanation / More detailed
- Easy fix :
git config --global core.autocrlf input
-
Make sure you use Windows Linux Subsystem (WSL) or at least git bash.
-
Use the recommended versions for PHP + extensions and Composer :
- Run
composer install
to generate vendor files locally - Run
docker-compose up --build
- Open
http://localhost:8080
in your browser.
To start/restart the containers use these commands:
docker-compose down --volumes --remove-orphans && docker-compose up --build
Important : Creating composer.lock
on local and permanent updates to composer files in general should only be done from the container, be aware that if this is done from local can generate additional errors. To avoid any errors running composer update
in the container is safer than running it in the local dev env. ( ex: docker-compose run composer update elife/patterns
)
When running the site locally via Docker, the parameters are supplied by /.docker/parameters.yaml
.
To change configuration that is supplied by an environment variable, pass in the environment variable at start up. For example, to change the API URL:
docker-compose down --volumes --remove-orphans && API_URL=https://prod--gateway.elifesciences.org docker-compose up --build
.
- Create
app/config/parameters.yml
fromapp/config/parameters.yml.dist
npm install
composer install
node_modules/.bin/gulp
bin/console assets:install --symlink
docker-compose run critical_css
To run all unit tests as in ci
:
docker-compose -f docker-compose.yml -f docker-compose.ci.yml run ci .ci/phpunit
To run a single test:
APP_ENV=ci docker-compose run app vendor/bin/phpunit --filter AboutControllerTest
Behat needs the ci
image to run, so it needs to build an additional image and use the ci configuration:
docker-compose -f docker-compose.yml -f docker-compose.ci.yml up --build --detach
To run all scenarios:
docker-compose -f docker-compose.yml -f docker-compose.ci.yml run ci .ci/behat
To run a single scenario:
docker-compose -f docker-compose.yml -f docker-compose.ci.yml run ci vendor/bin/behat features/article.feature
If you have made changes to the code and want to re-run a test then you will need to rebuild your docker containers:
docker-compose -f docker-compose.yml -f docker-compose.ci.yml down && docker-compose -f docker-compose.yml -f docker-compose.ci.yml up --build --detach
docker-compose -f docker-compose.yml -f docker-compose.ci.yml down -v
SELENIUM_IMAGE_SUFFIX=-debug docker-compose -f docker-compose.yml -f docker-compose.ci.yml up --build
docker-compose -f docker-compose.yml -f docker-compose.ci.yml run ci .ci/behat
In all but the production environment the CiviCRM client is a mock. This allows the developer to demonstrate the various screens without needing to make changes to a working CiviCRM instance.
Visit http://localhost:8080/content-alerts:
- Use [email protected] to trigger existing subscription scenario
- Use any other email to trigger subscription confirmation
For user preference interface:
- Visit http://localhost:8080/content-alerts/green to prepopulate form
- Visit http://localhost:8080/content-alerts/red to trigger expired link
Expired link interface:
- Use [email protected] to trigger email sent scenario
- Use [email protected] to trigger something went wrong scenario
Unsubscribe/optout interface:
- Visit http://localhost:8080/content-alerts/unsubscribe/green to show unsubscribe form
- Visit http://localhost:8080/content-alerts/unsubscribe/red to trigger something went wrong scenario
- Visit http://localhost:8080/content-alerts/optout/green to show opt-out form
- Visit http://localhost:8080/content-alerts/optout/red to trigger something went wrong scenario
To work on the integration with CiviCRM you will have to set the environment variable APP_ENV=prod
. And also adjust the values in .docker/parameters.yml
for crm_api_key
, crm_api_site_key
, google_api_client.refresh_token
and google_api_client.optout_unsubscribe_spreadsheet_id
to be the same as in production.