laradock/DOCUMENTATION/content/guides/index.md

869 lines
27 KiB
Markdown
Raw Normal View History

2017-04-14 16:43:26 +08:00
---
2019-07-16 00:59:43 +08:00
title: 4. Guides
2017-04-14 16:43:26 +08:00
type: index
weight: 4
---
2017-05-02 03:00:32 +08:00
<a name="Digital-Ocean"></a>
2019-07-16 00:59:43 +08:00
## Production Setup on Digital Ocean
2017-04-14 16:43:26 +08:00
2019-07-16 00:59:43 +08:00
### Install Docker
2017-04-14 16:43:26 +08:00
- Visit [DigitalOcean](https://cloud.digitalocean.com/login) and login.
- Click the `Create Droplet` button.
- Open the `One-click apps` tab.
- Select Docker with your preferred version.
- Continue creating the droplet as you normally would.
- If needed, check your e-mail for the droplet root password.
2019-07-16 00:59:43 +08:00
### SSH to your Server
2017-04-14 16:43:26 +08:00
Find the IP address of the droplet in the DigitalOcean interface. Use it to connect to the server.
```
ssh root@ipaddress
```
You may be prompted for a password. Type the one you found within your e-mailbox. It'll then ask you to change the password.
You can now check if Docker is available:
```
$root@server:~# docker
```
2019-07-16 00:59:43 +08:00
### Set Up Your Laravel Project
2017-04-14 16:43:26 +08:00
```
$root@server:~# apt-get install git
$root@server:~# git clone https://github.com/laravel/laravel
$root@server:~# cd laravel
2017-04-21 01:55:09 +08:00
$root@server:~/laravel/ git submodule add https://github.com/Laradock/laradock.git
2017-04-14 16:43:26 +08:00
$root@server:~/laravel/ cd laradock
```
2019-07-16 00:59:43 +08:00
### Enter the laradock folder and rename env-example to .env.
2017-05-14 01:51:19 +08:00
```
$root@server:~/laravel/laradock# cp env-example .env
```
2017-04-14 16:43:26 +08:00
2019-07-16 00:59:43 +08:00
### Create Your Laradock Containers
2017-04-14 16:43:26 +08:00
```
$root@server:~/laravel/laradock# docker-compose up -d nginx mysql
```
Note that more containers are available, find them in the [docs](http://laradock.io/introduction/#supported-software-containers) or the `docker-compose.yml` file.
2019-07-16 00:59:43 +08:00
### Go to Your Workspace
2017-04-14 16:43:26 +08:00
```
docker-compose exec workspace bash
```
2019-07-16 00:59:43 +08:00
### Execute commands
If you want to only execute some command and don't want to enter bash, you can execute `docker-compose run workspace <command>`.
```
docker-compose run workspace php artisan migrate
```
2019-07-16 00:59:43 +08:00
### Install and configure Laravel
2017-04-14 16:43:26 +08:00
Let's install Laravel's dependencies, add the `.env` file, generate the key and give proper permissions to the cache folder.
```
$ root@workspace:/var/www# composer install
$ root@workspace:/var/www# cp .env.example .env
$ root@workspace:/var/www# php artisan key:generate
$ root@workspace:/var/www# exit
$root@server:~/laravel/laradock# cd ..
$root@server:~/laravel# sudo chmod -R 777 storage bootstrap/cache
```
You can then view your Laravel site by visiting the IP address of your server in your browser. For example:
```
http://192.168.1.1
```
It should show you the Laravel default welcome page.
However, we want it to show up using your custom domain name, as well.
2019-07-16 00:59:43 +08:00
### Using Your Own Domain Name
2017-04-14 16:43:26 +08:00
Login to your DNS provider, such as Godaddy, Namecheap.
Point the Custom Domain Name Server to:
```
ns1.digitalocean.com
ns2.digitalocean.com
ns3.digitalocean.com
```
Within DigitalOcean, you'll need to change some settings, too.
2017-05-02 03:00:32 +08:00
Visit: https://cloud.digitalocean.com/networking/domains
2017-04-14 16:43:26 +08:00
Add your domain name and choose the server IP you'd provision earlier.
2019-07-16 00:59:43 +08:00
### Serving Site With NGINX (HTTP ONLY)
2017-04-14 16:43:26 +08:00
Go back to command line.
```
$root@server:~/laravel/laradock# cd nginx
$root@server:~/laravel/laradock/nginx# vim laravel.conf
```
Remove `default_server`
```
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
```
And add `server_name` (your custom domain)
```
listen 80;
listen [::]:80 ipv6only=on;
server_name yourdomain.com;
```
2019-07-16 00:59:43 +08:00
### Rebuild Your Nginx
2017-04-14 16:43:26 +08:00
```
2017-05-14 01:51:19 +08:00
$root@server:~/laravel/laradock# docker-compose down
$root@server:~/laravel/laradock# docker-compose build nginx
2017-04-14 16:43:26 +08:00
```
2019-07-16 00:59:43 +08:00
### Re Run Your Containers MYSQL and NGINX
2017-04-14 16:43:26 +08:00
```
$root@server:~/laravel/laradock/nginx# docker-compose up -d nginx mysql
```
2017-05-02 03:00:32 +08:00
**View Your Site with HTTP ONLY (http://yourdomain.com)**
2017-04-14 16:43:26 +08:00
2019-07-16 00:59:43 +08:00
### Run Site on SSL with Let's Encrypt Certificate
2017-04-14 16:43:26 +08:00
**Note: You need to Use Caddy here Instead of Nginx**
To go Caddy Folders and Edit CaddyFile
```
$root@server:~/laravel/laradock# cd caddy
$root@server:~/laravel/laradock/caddy# vim Caddyfile
```
Remove 0.0.0.0:80
```
0.0.0.0:80
2017-05-01 18:36:31 +08:00
root /var/www/public
2017-04-14 16:43:26 +08:00
```
2017-05-02 03:00:32 +08:00
and replace with your https://yourdomain.com
2017-04-14 16:43:26 +08:00
```
https://yourdomain.com
2017-05-01 18:36:31 +08:00
root /var/www/public
2017-04-14 16:43:26 +08:00
```
uncomment tls
```
#tls self-signed
```
and replace self-signed with your email address
```
tls serverbreaker@gmai.com
```
This is needed Prior to Creating Let's Encypt
2019-07-16 00:59:43 +08:00
### Run Your Caddy Container without the -d flag and Generate SSL with Let's Encrypt
2017-04-14 16:43:26 +08:00
```
$root@server:~/laravel/laradock# docker-compose up caddy
2017-04-14 16:43:26 +08:00
```
You'll be prompt here to enter your email... you may enter it or not
```
Attaching to laradock_mysql_1, laradock_caddy_1
caddy_1 | Activating privacy features...
caddy_1 | Your sites will be served over HTTPS automatically using Let's Encrypt.
caddy_1 | By continuing, you agree to the Let's Encrypt Subscriber Agreement at:
caddy_1 | https://letsencrypt.org/documents/LE-SA-v1.0.1-July-27-2015.pdf
caddy_1 | Activating privacy features... done.
caddy_1 | https://yourdomain.com
caddy_1 | http://yourdomain.com
```
After it finishes, press `Ctrl` + `C` to exit.
2019-07-16 00:59:43 +08:00
### Stop All Containers and ReRun Caddy and Other Containers on Background
2017-04-14 16:43:26 +08:00
```
$root@server:~/laravel/laradock# docker-compose down
$root@server:~/laravel/laradock# docker-compose up -d mysql caddy
2017-04-14 16:43:26 +08:00
```
2017-05-02 03:00:32 +08:00
View your Site in the Browser Securely Using HTTPS (https://yourdomain.com)
2017-04-14 16:43:26 +08:00
**Note that Certificate will be Automatically Renew By Caddy**
2017-05-02 03:00:32 +08:00
>References:
>
- [https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-16-04](https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-16-04)
- [https://www.digitalocean.com/products/one-click-apps/docker/](https://www.digitalocean.com/products/one-click-apps/docker/)
- [https://docs.docker.com/engine/installation/linux/ubuntulinux/](https://docs.docker.com/engine/installation/linux/ubuntulinux/)
- [https://docs.docker.com/compose/install/](https://docs.docker.com/compose/install/)
- [https://caddyserver.com/docs/automatic-https](https://caddyserver.com/docs/automatic-https)
- [https://caddyserver.com/docs/tls](https://caddyserver.com/docs/tls)
- [https://caddyserver.com/docs/caddyfile](https://caddyserver.com/docs/caddyfile)
<br>
<br>
<br>
<br>
<br>
2017-04-14 16:43:26 +08:00
2019-07-16 00:59:43 +08:00
<a name="Laravel-Dusk"></a>
## Running Laravel Dusk Tests
LaraDock-PHPStorm Debugging Guide - modified: README.md - new file: _guides/photos/KiTTY/Connection.png - new file: _guides/photos/KiTTY/ConnectionData.png - new file: _guides/photos/KiTTY/ConnectionSSH.png - new file: _guides/photos/KiTTY/ConnectionSSHAuth.png - new file: _guides/photos/KiTTY/Session.png - new file: _guides/photos/KiTTY/Terminal.png - new file: _guides/photos/KiTTY/TerminalKeyboard.png - new file: _guides/photos/KiTTY/TerminalShell.png - new file: _guides/photos/KiTTY/Window.png - new file: _guides/photos/KiTTY/WindowAppearance.png - new file: _guides/photos/PHPStorm/DebugRemoteOn.png - new file: _guides/photos/PHPStorm/RemoteDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteHost.png - new file: _guides/photos/PHPStorm/RemoteTestDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteWebDebuggingSuccess.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnection.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnectionMappings.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentDebugger.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteExampleTestDebug.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteWebDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPInterpreters.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPPHPUnit.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPServers.png - new file: _guides/photos/PHPStorm/Settings/WindowsFirewallAllowedApps.png - new file: _guides/photos/PHPStorm/Settings/WindowsHyperVManager.png - new file: _guides/photos/PHPStorm/Settings/hosts.png - new file: _guides/photos/SimpleHostsEditor/AddHost_laravel.png - new file: _guides/phpstorm.md
2016-11-19 04:12:10 +08:00
2019-07-16 00:59:43 +08:00
### Option 1: Without Selenium
LaraDock-PHPStorm Debugging Guide - modified: README.md - new file: _guides/photos/KiTTY/Connection.png - new file: _guides/photos/KiTTY/ConnectionData.png - new file: _guides/photos/KiTTY/ConnectionSSH.png - new file: _guides/photos/KiTTY/ConnectionSSHAuth.png - new file: _guides/photos/KiTTY/Session.png - new file: _guides/photos/KiTTY/Terminal.png - new file: _guides/photos/KiTTY/TerminalKeyboard.png - new file: _guides/photos/KiTTY/TerminalShell.png - new file: _guides/photos/KiTTY/Window.png - new file: _guides/photos/KiTTY/WindowAppearance.png - new file: _guides/photos/PHPStorm/DebugRemoteOn.png - new file: _guides/photos/PHPStorm/RemoteDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteHost.png - new file: _guides/photos/PHPStorm/RemoteTestDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteWebDebuggingSuccess.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnection.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnectionMappings.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentDebugger.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteExampleTestDebug.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteWebDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPInterpreters.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPPHPUnit.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPServers.png - new file: _guides/photos/PHPStorm/Settings/WindowsFirewallAllowedApps.png - new file: _guides/photos/PHPStorm/Settings/WindowsHyperVManager.png - new file: _guides/photos/PHPStorm/Settings/hosts.png - new file: _guides/photos/SimpleHostsEditor/AddHost_laravel.png - new file: _guides/phpstorm.md
2016-11-19 04:12:10 +08:00
2019-07-16 00:59:43 +08:00
- [Intro](#option1-dusk-intro)
- [Workspace Setup](#option1-workspace-setup)
- [Application Setup](#option1-application-setup)
- [Choose Chrome Driver Version (Optional)](#option1-choose-chrome-driver-version)
- [Run Dusk Tests](#option1-run-dusk-tests)
2017-04-14 16:43:26 +08:00
2019-07-16 00:59:43 +08:00
#### Intro
LaraDock-PHPStorm Debugging Guide - modified: README.md - new file: _guides/photos/KiTTY/Connection.png - new file: _guides/photos/KiTTY/ConnectionData.png - new file: _guides/photos/KiTTY/ConnectionSSH.png - new file: _guides/photos/KiTTY/ConnectionSSHAuth.png - new file: _guides/photos/KiTTY/Session.png - new file: _guides/photos/KiTTY/Terminal.png - new file: _guides/photos/KiTTY/TerminalKeyboard.png - new file: _guides/photos/KiTTY/TerminalShell.png - new file: _guides/photos/KiTTY/Window.png - new file: _guides/photos/KiTTY/WindowAppearance.png - new file: _guides/photos/PHPStorm/DebugRemoteOn.png - new file: _guides/photos/PHPStorm/RemoteDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteHost.png - new file: _guides/photos/PHPStorm/RemoteTestDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteWebDebuggingSuccess.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnection.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnectionMappings.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentDebugger.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteExampleTestDebug.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteWebDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPInterpreters.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPPHPUnit.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPServers.png - new file: _guides/photos/PHPStorm/Settings/WindowsFirewallAllowedApps.png - new file: _guides/photos/PHPStorm/Settings/WindowsHyperVManager.png - new file: _guides/photos/PHPStorm/Settings/hosts.png - new file: _guides/photos/SimpleHostsEditor/AddHost_laravel.png - new file: _guides/phpstorm.md
2016-11-19 04:12:10 +08:00
2019-07-16 00:59:43 +08:00
This is a guide to run Dusk tests in your `workspace` container with headless
google-chrome and chromedriver. It has been tested with Laravel 5.4 and 5.5.
LaraDock-PHPStorm Debugging Guide - modified: README.md - new file: _guides/photos/KiTTY/Connection.png - new file: _guides/photos/KiTTY/ConnectionData.png - new file: _guides/photos/KiTTY/ConnectionSSH.png - new file: _guides/photos/KiTTY/ConnectionSSHAuth.png - new file: _guides/photos/KiTTY/Session.png - new file: _guides/photos/KiTTY/Terminal.png - new file: _guides/photos/KiTTY/TerminalKeyboard.png - new file: _guides/photos/KiTTY/TerminalShell.png - new file: _guides/photos/KiTTY/Window.png - new file: _guides/photos/KiTTY/WindowAppearance.png - new file: _guides/photos/PHPStorm/DebugRemoteOn.png - new file: _guides/photos/PHPStorm/RemoteDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteHost.png - new file: _guides/photos/PHPStorm/RemoteTestDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteWebDebuggingSuccess.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnection.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnectionMappings.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentDebugger.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteExampleTestDebug.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteWebDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPInterpreters.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPPHPUnit.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPServers.png - new file: _guides/photos/PHPStorm/Settings/WindowsFirewallAllowedApps.png - new file: _guides/photos/PHPStorm/Settings/WindowsHyperVManager.png - new file: _guides/photos/PHPStorm/Settings/hosts.png - new file: _guides/photos/SimpleHostsEditor/AddHost_laravel.png - new file: _guides/phpstorm.md
2016-11-19 04:12:10 +08:00
2019-07-16 00:59:43 +08:00
#### Workspace Setup
LaraDock-PHPStorm Debugging Guide - modified: README.md - new file: _guides/photos/KiTTY/Connection.png - new file: _guides/photos/KiTTY/ConnectionData.png - new file: _guides/photos/KiTTY/ConnectionSSH.png - new file: _guides/photos/KiTTY/ConnectionSSHAuth.png - new file: _guides/photos/KiTTY/Session.png - new file: _guides/photos/KiTTY/Terminal.png - new file: _guides/photos/KiTTY/TerminalKeyboard.png - new file: _guides/photos/KiTTY/TerminalShell.png - new file: _guides/photos/KiTTY/Window.png - new file: _guides/photos/KiTTY/WindowAppearance.png - new file: _guides/photos/PHPStorm/DebugRemoteOn.png - new file: _guides/photos/PHPStorm/RemoteDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteHost.png - new file: _guides/photos/PHPStorm/RemoteTestDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteWebDebuggingSuccess.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnection.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnectionMappings.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentDebugger.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteExampleTestDebug.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteWebDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPInterpreters.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPPHPUnit.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPServers.png - new file: _guides/photos/PHPStorm/Settings/WindowsFirewallAllowedApps.png - new file: _guides/photos/PHPStorm/Settings/WindowsHyperVManager.png - new file: _guides/photos/PHPStorm/Settings/hosts.png - new file: _guides/photos/SimpleHostsEditor/AddHost_laravel.png - new file: _guides/phpstorm.md
2016-11-19 04:12:10 +08:00
2019-07-16 00:59:43 +08:00
Update your .env with following entries:
LaraDock-PHPStorm Debugging Guide - modified: README.md - new file: _guides/photos/KiTTY/Connection.png - new file: _guides/photos/KiTTY/ConnectionData.png - new file: _guides/photos/KiTTY/ConnectionSSH.png - new file: _guides/photos/KiTTY/ConnectionSSHAuth.png - new file: _guides/photos/KiTTY/Session.png - new file: _guides/photos/KiTTY/Terminal.png - new file: _guides/photos/KiTTY/TerminalKeyboard.png - new file: _guides/photos/KiTTY/TerminalShell.png - new file: _guides/photos/KiTTY/Window.png - new file: _guides/photos/KiTTY/WindowAppearance.png - new file: _guides/photos/PHPStorm/DebugRemoteOn.png - new file: _guides/photos/PHPStorm/RemoteDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteHost.png - new file: _guides/photos/PHPStorm/RemoteTestDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteWebDebuggingSuccess.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnection.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnectionMappings.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentDebugger.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteExampleTestDebug.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteWebDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPInterpreters.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPPHPUnit.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPServers.png - new file: _guides/photos/PHPStorm/Settings/WindowsFirewallAllowedApps.png - new file: _guides/photos/PHPStorm/Settings/WindowsHyperVManager.png - new file: _guides/photos/PHPStorm/Settings/hosts.png - new file: _guides/photos/SimpleHostsEditor/AddHost_laravel.png - new file: _guides/phpstorm.md
2016-11-19 04:12:10 +08:00
```
2019-07-16 00:59:43 +08:00
...
# Install Laravel installer bin to setup demo app
WORKSPACE_INSTALL_LARAVEL_INSTALLER=true
...
# Install all the necessary dependencies for running Dusk tests
WORKSPACE_INSTALL_DUSK_DEPS=true
...
```
LaraDock-PHPStorm Debugging Guide - modified: README.md - new file: _guides/photos/KiTTY/Connection.png - new file: _guides/photos/KiTTY/ConnectionData.png - new file: _guides/photos/KiTTY/ConnectionSSH.png - new file: _guides/photos/KiTTY/ConnectionSSHAuth.png - new file: _guides/photos/KiTTY/Session.png - new file: _guides/photos/KiTTY/Terminal.png - new file: _guides/photos/KiTTY/TerminalKeyboard.png - new file: _guides/photos/KiTTY/TerminalShell.png - new file: _guides/photos/KiTTY/Window.png - new file: _guides/photos/KiTTY/WindowAppearance.png - new file: _guides/photos/PHPStorm/DebugRemoteOn.png - new file: _guides/photos/PHPStorm/RemoteDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteHost.png - new file: _guides/photos/PHPStorm/RemoteTestDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteWebDebuggingSuccess.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnection.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnectionMappings.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentDebugger.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteExampleTestDebug.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteWebDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPInterpreters.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPPHPUnit.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPServers.png - new file: _guides/photos/PHPStorm/Settings/WindowsFirewallAllowedApps.png - new file: _guides/photos/PHPStorm/Settings/WindowsHyperVManager.png - new file: _guides/photos/PHPStorm/Settings/hosts.png - new file: _guides/photos/SimpleHostsEditor/AddHost_laravel.png - new file: _guides/phpstorm.md
2016-11-19 04:12:10 +08:00
2019-07-16 00:59:43 +08:00
Then run below to build your workspace.
2017-04-14 16:43:26 +08:00
2019-07-16 00:59:43 +08:00
```
docker-compose build workspace
```
2017-04-14 16:43:26 +08:00
2019-07-16 00:59:43 +08:00
#### Application Setup
LaraDock-PHPStorm Debugging Guide - modified: README.md - new file: _guides/photos/KiTTY/Connection.png - new file: _guides/photos/KiTTY/ConnectionData.png - new file: _guides/photos/KiTTY/ConnectionSSH.png - new file: _guides/photos/KiTTY/ConnectionSSHAuth.png - new file: _guides/photos/KiTTY/Session.png - new file: _guides/photos/KiTTY/Terminal.png - new file: _guides/photos/KiTTY/TerminalKeyboard.png - new file: _guides/photos/KiTTY/TerminalShell.png - new file: _guides/photos/KiTTY/Window.png - new file: _guides/photos/KiTTY/WindowAppearance.png - new file: _guides/photos/PHPStorm/DebugRemoteOn.png - new file: _guides/photos/PHPStorm/RemoteDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteHost.png - new file: _guides/photos/PHPStorm/RemoteTestDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteWebDebuggingSuccess.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnection.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnectionMappings.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentDebugger.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteExampleTestDebug.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteWebDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPInterpreters.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPPHPUnit.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPServers.png - new file: _guides/photos/PHPStorm/Settings/WindowsFirewallAllowedApps.png - new file: _guides/photos/PHPStorm/Settings/WindowsHyperVManager.png - new file: _guides/photos/PHPStorm/Settings/hosts.png - new file: _guides/photos/SimpleHostsEditor/AddHost_laravel.png - new file: _guides/phpstorm.md
2016-11-19 04:12:10 +08:00
2019-07-16 00:59:43 +08:00
Run a `workspace` container and you will be inside the container at `/var/www` directory.
2017-05-02 03:00:32 +08:00
LaraDock-PHPStorm Debugging Guide - modified: README.md - new file: _guides/photos/KiTTY/Connection.png - new file: _guides/photos/KiTTY/ConnectionData.png - new file: _guides/photos/KiTTY/ConnectionSSH.png - new file: _guides/photos/KiTTY/ConnectionSSHAuth.png - new file: _guides/photos/KiTTY/Session.png - new file: _guides/photos/KiTTY/Terminal.png - new file: _guides/photos/KiTTY/TerminalKeyboard.png - new file: _guides/photos/KiTTY/TerminalShell.png - new file: _guides/photos/KiTTY/Window.png - new file: _guides/photos/KiTTY/WindowAppearance.png - new file: _guides/photos/PHPStorm/DebugRemoteOn.png - new file: _guides/photos/PHPStorm/RemoteDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteHost.png - new file: _guides/photos/PHPStorm/RemoteTestDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteWebDebuggingSuccess.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnection.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnectionMappings.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentDebugger.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteExampleTestDebug.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteWebDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPInterpreters.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPPHPUnit.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPServers.png - new file: _guides/photos/PHPStorm/Settings/WindowsFirewallAllowedApps.png - new file: _guides/photos/PHPStorm/Settings/WindowsHyperVManager.png - new file: _guides/photos/PHPStorm/Settings/hosts.png - new file: _guides/photos/SimpleHostsEditor/AddHost_laravel.png - new file: _guides/phpstorm.md
2016-11-19 04:12:10 +08:00
```
2019-07-16 00:59:43 +08:00
docker-compose run workspace bash
LaraDock-PHPStorm Debugging Guide - modified: README.md - new file: _guides/photos/KiTTY/Connection.png - new file: _guides/photos/KiTTY/ConnectionData.png - new file: _guides/photos/KiTTY/ConnectionSSH.png - new file: _guides/photos/KiTTY/ConnectionSSHAuth.png - new file: _guides/photos/KiTTY/Session.png - new file: _guides/photos/KiTTY/Terminal.png - new file: _guides/photos/KiTTY/TerminalKeyboard.png - new file: _guides/photos/KiTTY/TerminalShell.png - new file: _guides/photos/KiTTY/Window.png - new file: _guides/photos/KiTTY/WindowAppearance.png - new file: _guides/photos/PHPStorm/DebugRemoteOn.png - new file: _guides/photos/PHPStorm/RemoteDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteHost.png - new file: _guides/photos/PHPStorm/RemoteTestDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteWebDebuggingSuccess.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnection.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnectionMappings.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentDebugger.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteExampleTestDebug.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteWebDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPInterpreters.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPPHPUnit.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPServers.png - new file: _guides/photos/PHPStorm/Settings/WindowsFirewallAllowedApps.png - new file: _guides/photos/PHPStorm/Settings/WindowsHyperVManager.png - new file: _guides/photos/PHPStorm/Settings/hosts.png - new file: _guides/photos/SimpleHostsEditor/AddHost_laravel.png - new file: _guides/phpstorm.md
2016-11-19 04:12:10 +08:00
2019-07-16 00:59:43 +08:00
/var/www#> _
```
LaraDock-PHPStorm Debugging Guide - modified: README.md - new file: _guides/photos/KiTTY/Connection.png - new file: _guides/photos/KiTTY/ConnectionData.png - new file: _guides/photos/KiTTY/ConnectionSSH.png - new file: _guides/photos/KiTTY/ConnectionSSHAuth.png - new file: _guides/photos/KiTTY/Session.png - new file: _guides/photos/KiTTY/Terminal.png - new file: _guides/photos/KiTTY/TerminalKeyboard.png - new file: _guides/photos/KiTTY/TerminalShell.png - new file: _guides/photos/KiTTY/Window.png - new file: _guides/photos/KiTTY/WindowAppearance.png - new file: _guides/photos/PHPStorm/DebugRemoteOn.png - new file: _guides/photos/PHPStorm/RemoteDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteHost.png - new file: _guides/photos/PHPStorm/RemoteTestDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteWebDebuggingSuccess.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnection.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnectionMappings.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentDebugger.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteExampleTestDebug.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteWebDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPInterpreters.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPPHPUnit.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPServers.png - new file: _guides/photos/PHPStorm/Settings/WindowsFirewallAllowedApps.png - new file: _guides/photos/PHPStorm/Settings/WindowsHyperVManager.png - new file: _guides/photos/PHPStorm/Settings/hosts.png - new file: _guides/photos/SimpleHostsEditor/AddHost_laravel.png - new file: _guides/phpstorm.md
2016-11-19 04:12:10 +08:00
2019-07-16 00:59:43 +08:00
Create new Laravel application named `dusk-test` and install Laravel Dusk package.
LaraDock-PHPStorm Debugging Guide - modified: README.md - new file: _guides/photos/KiTTY/Connection.png - new file: _guides/photos/KiTTY/ConnectionData.png - new file: _guides/photos/KiTTY/ConnectionSSH.png - new file: _guides/photos/KiTTY/ConnectionSSHAuth.png - new file: _guides/photos/KiTTY/Session.png - new file: _guides/photos/KiTTY/Terminal.png - new file: _guides/photos/KiTTY/TerminalKeyboard.png - new file: _guides/photos/KiTTY/TerminalShell.png - new file: _guides/photos/KiTTY/Window.png - new file: _guides/photos/KiTTY/WindowAppearance.png - new file: _guides/photos/PHPStorm/DebugRemoteOn.png - new file: _guides/photos/PHPStorm/RemoteDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteHost.png - new file: _guides/photos/PHPStorm/RemoteTestDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteWebDebuggingSuccess.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnection.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnectionMappings.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentDebugger.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteExampleTestDebug.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteWebDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPInterpreters.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPPHPUnit.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPServers.png - new file: _guides/photos/PHPStorm/Settings/WindowsFirewallAllowedApps.png - new file: _guides/photos/PHPStorm/Settings/WindowsHyperVManager.png - new file: _guides/photos/PHPStorm/Settings/hosts.png - new file: _guides/photos/SimpleHostsEditor/AddHost_laravel.png - new file: _guides/phpstorm.md
2016-11-19 04:12:10 +08:00
```
2019-07-16 00:59:43 +08:00
/var/www> laravel new dusk-test
/var/www> cd dusk-test
/var/www/dusk-test> composer require --dev laravel/dusk
/var/www/dusk-test> php artisan dusk:install
LaraDock-PHPStorm Debugging Guide - modified: README.md - new file: _guides/photos/KiTTY/Connection.png - new file: _guides/photos/KiTTY/ConnectionData.png - new file: _guides/photos/KiTTY/ConnectionSSH.png - new file: _guides/photos/KiTTY/ConnectionSSHAuth.png - new file: _guides/photos/KiTTY/Session.png - new file: _guides/photos/KiTTY/Terminal.png - new file: _guides/photos/KiTTY/TerminalKeyboard.png - new file: _guides/photos/KiTTY/TerminalShell.png - new file: _guides/photos/KiTTY/Window.png - new file: _guides/photos/KiTTY/WindowAppearance.png - new file: _guides/photos/PHPStorm/DebugRemoteOn.png - new file: _guides/photos/PHPStorm/RemoteDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteHost.png - new file: _guides/photos/PHPStorm/RemoteTestDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteWebDebuggingSuccess.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnection.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnectionMappings.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentDebugger.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteExampleTestDebug.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteWebDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPInterpreters.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPPHPUnit.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPServers.png - new file: _guides/photos/PHPStorm/Settings/WindowsFirewallAllowedApps.png - new file: _guides/photos/PHPStorm/Settings/WindowsHyperVManager.png - new file: _guides/photos/PHPStorm/Settings/hosts.png - new file: _guides/photos/SimpleHostsEditor/AddHost_laravel.png - new file: _guides/phpstorm.md
2016-11-19 04:12:10 +08:00
```
2019-07-16 00:59:43 +08:00
Create `.env.dusk.local` by copying from `.env` file.
LaraDock-PHPStorm Debugging Guide - modified: README.md - new file: _guides/photos/KiTTY/Connection.png - new file: _guides/photos/KiTTY/ConnectionData.png - new file: _guides/photos/KiTTY/ConnectionSSH.png - new file: _guides/photos/KiTTY/ConnectionSSHAuth.png - new file: _guides/photos/KiTTY/Session.png - new file: _guides/photos/KiTTY/Terminal.png - new file: _guides/photos/KiTTY/TerminalKeyboard.png - new file: _guides/photos/KiTTY/TerminalShell.png - new file: _guides/photos/KiTTY/Window.png - new file: _guides/photos/KiTTY/WindowAppearance.png - new file: _guides/photos/PHPStorm/DebugRemoteOn.png - new file: _guides/photos/PHPStorm/RemoteDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteHost.png - new file: _guides/photos/PHPStorm/RemoteTestDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteWebDebuggingSuccess.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnection.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnectionMappings.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentDebugger.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteExampleTestDebug.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteWebDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPInterpreters.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPPHPUnit.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPServers.png - new file: _guides/photos/PHPStorm/Settings/WindowsFirewallAllowedApps.png - new file: _guides/photos/PHPStorm/Settings/WindowsHyperVManager.png - new file: _guides/photos/PHPStorm/Settings/hosts.png - new file: _guides/photos/SimpleHostsEditor/AddHost_laravel.png - new file: _guides/phpstorm.md
2016-11-19 04:12:10 +08:00
2019-07-16 00:59:43 +08:00
```
/var/www/dusk-test> cp .env .env.dusk.local
```
2019-07-16 00:59:43 +08:00
Update the `APP_URL` entry in `.env.dusk.local` to local Laravel server.
LaraDock-PHPStorm Debugging Guide - modified: README.md - new file: _guides/photos/KiTTY/Connection.png - new file: _guides/photos/KiTTY/ConnectionData.png - new file: _guides/photos/KiTTY/ConnectionSSH.png - new file: _guides/photos/KiTTY/ConnectionSSHAuth.png - new file: _guides/photos/KiTTY/Session.png - new file: _guides/photos/KiTTY/Terminal.png - new file: _guides/photos/KiTTY/TerminalKeyboard.png - new file: _guides/photos/KiTTY/TerminalShell.png - new file: _guides/photos/KiTTY/Window.png - new file: _guides/photos/KiTTY/WindowAppearance.png - new file: _guides/photos/PHPStorm/DebugRemoteOn.png - new file: _guides/photos/PHPStorm/RemoteDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteHost.png - new file: _guides/photos/PHPStorm/RemoteTestDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteWebDebuggingSuccess.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnection.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnectionMappings.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentDebugger.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteExampleTestDebug.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteWebDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPInterpreters.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPPHPUnit.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPServers.png - new file: _guides/photos/PHPStorm/Settings/WindowsFirewallAllowedApps.png - new file: _guides/photos/PHPStorm/Settings/WindowsHyperVManager.png - new file: _guides/photos/PHPStorm/Settings/hosts.png - new file: _guides/photos/SimpleHostsEditor/AddHost_laravel.png - new file: _guides/phpstorm.md
2016-11-19 04:12:10 +08:00
2019-07-16 00:59:43 +08:00
```
APP_URL=http://localhost:8000
```
2019-07-16 00:59:43 +08:00
You will need to run chromedriver with `headless` and `no-sandbox` flag. In Laravel Dusk 2.x it is
already set `headless` so you just need to add `no-sandbox` flag. If you on previous version 1.x,
you will need to update your `DustTestCase#driver` as shown below.
LaraDock-PHPStorm Debugging Guide - modified: README.md - new file: _guides/photos/KiTTY/Connection.png - new file: _guides/photos/KiTTY/ConnectionData.png - new file: _guides/photos/KiTTY/ConnectionSSH.png - new file: _guides/photos/KiTTY/ConnectionSSHAuth.png - new file: _guides/photos/KiTTY/Session.png - new file: _guides/photos/KiTTY/Terminal.png - new file: _guides/photos/KiTTY/TerminalKeyboard.png - new file: _guides/photos/KiTTY/TerminalShell.png - new file: _guides/photos/KiTTY/Window.png - new file: _guides/photos/KiTTY/WindowAppearance.png - new file: _guides/photos/PHPStorm/DebugRemoteOn.png - new file: _guides/photos/PHPStorm/RemoteDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteHost.png - new file: _guides/photos/PHPStorm/RemoteTestDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteWebDebuggingSuccess.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnection.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnectionMappings.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentDebugger.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteExampleTestDebug.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteWebDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPInterpreters.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPPHPUnit.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPServers.png - new file: _guides/photos/PHPStorm/Settings/WindowsFirewallAllowedApps.png - new file: _guides/photos/PHPStorm/Settings/WindowsHyperVManager.png - new file: _guides/photos/PHPStorm/Settings/hosts.png - new file: _guides/photos/SimpleHostsEditor/AddHost_laravel.png - new file: _guides/phpstorm.md
2016-11-19 04:12:10 +08:00
2019-07-16 00:59:43 +08:00
```
<?php
LaraDock-PHPStorm Debugging Guide - modified: README.md - new file: _guides/photos/KiTTY/Connection.png - new file: _guides/photos/KiTTY/ConnectionData.png - new file: _guides/photos/KiTTY/ConnectionSSH.png - new file: _guides/photos/KiTTY/ConnectionSSHAuth.png - new file: _guides/photos/KiTTY/Session.png - new file: _guides/photos/KiTTY/Terminal.png - new file: _guides/photos/KiTTY/TerminalKeyboard.png - new file: _guides/photos/KiTTY/TerminalShell.png - new file: _guides/photos/KiTTY/Window.png - new file: _guides/photos/KiTTY/WindowAppearance.png - new file: _guides/photos/PHPStorm/DebugRemoteOn.png - new file: _guides/photos/PHPStorm/RemoteDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteHost.png - new file: _guides/photos/PHPStorm/RemoteTestDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteWebDebuggingSuccess.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnection.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnectionMappings.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentDebugger.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteExampleTestDebug.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteWebDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPInterpreters.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPPHPUnit.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPServers.png - new file: _guides/photos/PHPStorm/Settings/WindowsFirewallAllowedApps.png - new file: _guides/photos/PHPStorm/Settings/WindowsHyperVManager.png - new file: _guides/photos/PHPStorm/Settings/hosts.png - new file: _guides/photos/SimpleHostsEditor/AddHost_laravel.png - new file: _guides/phpstorm.md
2016-11-19 04:12:10 +08:00
2019-07-16 00:59:43 +08:00
...
2019-07-16 00:59:43 +08:00
abstract class DuskTestCase extends BaseTestCase
{
...
2019-07-16 00:59:43 +08:00
/**
* Update chrome driver with below flags
*/
protected function driver()
{
$options = (new ChromeOptions)->addArguments([
'--disable-gpu',
'--headless',
'--no-sandbox'
]);
return RemoteWebDriver::create(
'http://localhost:9515', DesiredCapabilities::chrome()->setCapability(
ChromeOptions::CAPABILITY, $options
)
);
}
}
```
LaraDock-PHPStorm Debugging Guide - modified: README.md - new file: _guides/photos/KiTTY/Connection.png - new file: _guides/photos/KiTTY/ConnectionData.png - new file: _guides/photos/KiTTY/ConnectionSSH.png - new file: _guides/photos/KiTTY/ConnectionSSHAuth.png - new file: _guides/photos/KiTTY/Session.png - new file: _guides/photos/KiTTY/Terminal.png - new file: _guides/photos/KiTTY/TerminalKeyboard.png - new file: _guides/photos/KiTTY/TerminalShell.png - new file: _guides/photos/KiTTY/Window.png - new file: _guides/photos/KiTTY/WindowAppearance.png - new file: _guides/photos/PHPStorm/DebugRemoteOn.png - new file: _guides/photos/PHPStorm/RemoteDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteHost.png - new file: _guides/photos/PHPStorm/RemoteTestDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteWebDebuggingSuccess.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnection.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnectionMappings.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentDebugger.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteExampleTestDebug.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteWebDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPInterpreters.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPPHPUnit.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPServers.png - new file: _guides/photos/PHPStorm/Settings/WindowsFirewallAllowedApps.png - new file: _guides/photos/PHPStorm/Settings/WindowsHyperVManager.png - new file: _guides/photos/PHPStorm/Settings/hosts.png - new file: _guides/photos/SimpleHostsEditor/AddHost_laravel.png - new file: _guides/phpstorm.md
2016-11-19 04:12:10 +08:00
2019-07-16 00:59:43 +08:00
#### Choose Chrome Driver Version (Optional)
2019-07-16 00:59:43 +08:00
You could choose to use either:
LaraDock-PHPStorm Debugging Guide - modified: README.md - new file: _guides/photos/KiTTY/Connection.png - new file: _guides/photos/KiTTY/ConnectionData.png - new file: _guides/photos/KiTTY/ConnectionSSH.png - new file: _guides/photos/KiTTY/ConnectionSSHAuth.png - new file: _guides/photos/KiTTY/Session.png - new file: _guides/photos/KiTTY/Terminal.png - new file: _guides/photos/KiTTY/TerminalKeyboard.png - new file: _guides/photos/KiTTY/TerminalShell.png - new file: _guides/photos/KiTTY/Window.png - new file: _guides/photos/KiTTY/WindowAppearance.png - new file: _guides/photos/PHPStorm/DebugRemoteOn.png - new file: _guides/photos/PHPStorm/RemoteDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteHost.png - new file: _guides/photos/PHPStorm/RemoteTestDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteWebDebuggingSuccess.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnection.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnectionMappings.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentDebugger.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteExampleTestDebug.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteWebDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPInterpreters.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPPHPUnit.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPServers.png - new file: _guides/photos/PHPStorm/Settings/WindowsFirewallAllowedApps.png - new file: _guides/photos/PHPStorm/Settings/WindowsHyperVManager.png - new file: _guides/photos/PHPStorm/Settings/hosts.png - new file: _guides/photos/SimpleHostsEditor/AddHost_laravel.png - new file: _guides/phpstorm.md
2016-11-19 04:12:10 +08:00
2019-07-16 00:59:43 +08:00
1. Chrome Driver shipped with Laravel Dusk. (Default)
2. Chrome Driver installed in `workspace` container. (Required tweak on DuskTestCase class)
2017-05-01 18:36:31 +08:00
For Laravel Dusk 2.x, you need to update `DuskTestCase#prepare` method if you wish to go with option #2.
2017-05-01 18:36:31 +08:00
2017-05-02 03:00:32 +08:00
```
LaraDock-PHPStorm Debugging Guide - modified: README.md - new file: _guides/photos/KiTTY/Connection.png - new file: _guides/photos/KiTTY/ConnectionData.png - new file: _guides/photos/KiTTY/ConnectionSSH.png - new file: _guides/photos/KiTTY/ConnectionSSHAuth.png - new file: _guides/photos/KiTTY/Session.png - new file: _guides/photos/KiTTY/Terminal.png - new file: _guides/photos/KiTTY/TerminalKeyboard.png - new file: _guides/photos/KiTTY/TerminalShell.png - new file: _guides/photos/KiTTY/Window.png - new file: _guides/photos/KiTTY/WindowAppearance.png - new file: _guides/photos/PHPStorm/DebugRemoteOn.png - new file: _guides/photos/PHPStorm/RemoteDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteHost.png - new file: _guides/photos/PHPStorm/RemoteTestDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteWebDebuggingSuccess.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnection.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnectionMappings.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentDebugger.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteExampleTestDebug.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteWebDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPInterpreters.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPPHPUnit.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPServers.png - new file: _guides/photos/PHPStorm/Settings/WindowsFirewallAllowedApps.png - new file: _guides/photos/PHPStorm/Settings/WindowsHyperVManager.png - new file: _guides/photos/PHPStorm/Settings/hosts.png - new file: _guides/photos/SimpleHostsEditor/AddHost_laravel.png - new file: _guides/phpstorm.md
2016-11-19 04:12:10 +08:00
2019-07-16 00:59:43 +08:00
<?php
...
abstract class DuskTestCase extends BaseTestCase
{
...
public static function prepare()
{
// Only add this line if you wish to use chrome driver installed in workspace container.
// You might want to read the file path from env file.
static::useChromedriver('/usr/local/bin/chromedriver');
LaraDock-PHPStorm Debugging Guide - modified: README.md - new file: _guides/photos/KiTTY/Connection.png - new file: _guides/photos/KiTTY/ConnectionData.png - new file: _guides/photos/KiTTY/ConnectionSSH.png - new file: _guides/photos/KiTTY/ConnectionSSHAuth.png - new file: _guides/photos/KiTTY/Session.png - new file: _guides/photos/KiTTY/Terminal.png - new file: _guides/photos/KiTTY/TerminalKeyboard.png - new file: _guides/photos/KiTTY/TerminalShell.png - new file: _guides/photos/KiTTY/Window.png - new file: _guides/photos/KiTTY/WindowAppearance.png - new file: _guides/photos/PHPStorm/DebugRemoteOn.png - new file: _guides/photos/PHPStorm/RemoteDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteHost.png - new file: _guides/photos/PHPStorm/RemoteTestDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteWebDebuggingSuccess.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnection.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnectionMappings.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentDebugger.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteExampleTestDebug.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteWebDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPInterpreters.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPPHPUnit.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPServers.png - new file: _guides/photos/PHPStorm/Settings/WindowsFirewallAllowedApps.png - new file: _guides/photos/PHPStorm/Settings/WindowsHyperVManager.png - new file: _guides/photos/PHPStorm/Settings/hosts.png - new file: _guides/photos/SimpleHostsEditor/AddHost_laravel.png - new file: _guides/phpstorm.md
2016-11-19 04:12:10 +08:00
2019-07-16 00:59:43 +08:00
static::startChromeDriver();
}
LaraDock-PHPStorm Debugging Guide - modified: README.md - new file: _guides/photos/KiTTY/Connection.png - new file: _guides/photos/KiTTY/ConnectionData.png - new file: _guides/photos/KiTTY/ConnectionSSH.png - new file: _guides/photos/KiTTY/ConnectionSSHAuth.png - new file: _guides/photos/KiTTY/Session.png - new file: _guides/photos/KiTTY/Terminal.png - new file: _guides/photos/KiTTY/TerminalKeyboard.png - new file: _guides/photos/KiTTY/TerminalShell.png - new file: _guides/photos/KiTTY/Window.png - new file: _guides/photos/KiTTY/WindowAppearance.png - new file: _guides/photos/PHPStorm/DebugRemoteOn.png - new file: _guides/photos/PHPStorm/RemoteDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteHost.png - new file: _guides/photos/PHPStorm/RemoteTestDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteWebDebuggingSuccess.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnection.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnectionMappings.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentDebugger.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteExampleTestDebug.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteWebDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPInterpreters.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPPHPUnit.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPServers.png - new file: _guides/photos/PHPStorm/Settings/WindowsFirewallAllowedApps.png - new file: _guides/photos/PHPStorm/Settings/WindowsHyperVManager.png - new file: _guides/photos/PHPStorm/Settings/hosts.png - new file: _guides/photos/SimpleHostsEditor/AddHost_laravel.png - new file: _guides/phpstorm.md
2016-11-19 04:12:10 +08:00
```
For Laravel Dusk 1.x, you need to add `DuskTestCase#buildChromeProcess` method if you wish to go with option #2.
LaraDock-PHPStorm Debugging Guide - modified: README.md - new file: _guides/photos/KiTTY/Connection.png - new file: _guides/photos/KiTTY/ConnectionData.png - new file: _guides/photos/KiTTY/ConnectionSSH.png - new file: _guides/photos/KiTTY/ConnectionSSHAuth.png - new file: _guides/photos/KiTTY/Session.png - new file: _guides/photos/KiTTY/Terminal.png - new file: _guides/photos/KiTTY/TerminalKeyboard.png - new file: _guides/photos/KiTTY/TerminalShell.png - new file: _guides/photos/KiTTY/Window.png - new file: _guides/photos/KiTTY/WindowAppearance.png - new file: _guides/photos/PHPStorm/DebugRemoteOn.png - new file: _guides/photos/PHPStorm/RemoteDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteHost.png - new file: _guides/photos/PHPStorm/RemoteTestDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteWebDebuggingSuccess.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnection.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnectionMappings.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentDebugger.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteExampleTestDebug.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteWebDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPInterpreters.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPPHPUnit.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPServers.png - new file: _guides/photos/PHPStorm/Settings/WindowsFirewallAllowedApps.png - new file: _guides/photos/PHPStorm/Settings/WindowsHyperVManager.png - new file: _guides/photos/PHPStorm/Settings/hosts.png - new file: _guides/photos/SimpleHostsEditor/AddHost_laravel.png - new file: _guides/phpstorm.md
2016-11-19 04:12:10 +08:00
2017-05-02 03:00:32 +08:00
```
2019-07-16 00:59:43 +08:00
<?php
2017-05-01 18:36:31 +08:00
2019-07-16 00:59:43 +08:00
...
use Symfony\Component\Process\ProcessBuilder;
2019-07-16 00:59:43 +08:00
abstract class DuskTestCase extends BaseTestCase
{
...
2019-07-16 00:59:43 +08:00
/**
* Only add this method if you wish to use chrome driver installed in workspace container
*/
protected static function buildChromeProcess()
{
return (new ProcessBuilder())
->setPrefix('chromedriver')
->getProcess()
->setEnv(static::chromeEnvironment());
}
...
}
LaraDock-PHPStorm Debugging Guide - modified: README.md - new file: _guides/photos/KiTTY/Connection.png - new file: _guides/photos/KiTTY/ConnectionData.png - new file: _guides/photos/KiTTY/ConnectionSSH.png - new file: _guides/photos/KiTTY/ConnectionSSHAuth.png - new file: _guides/photos/KiTTY/Session.png - new file: _guides/photos/KiTTY/Terminal.png - new file: _guides/photos/KiTTY/TerminalKeyboard.png - new file: _guides/photos/KiTTY/TerminalShell.png - new file: _guides/photos/KiTTY/Window.png - new file: _guides/photos/KiTTY/WindowAppearance.png - new file: _guides/photos/PHPStorm/DebugRemoteOn.png - new file: _guides/photos/PHPStorm/RemoteDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteHost.png - new file: _guides/photos/PHPStorm/RemoteTestDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteWebDebuggingSuccess.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnection.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnectionMappings.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentDebugger.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteExampleTestDebug.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteWebDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPInterpreters.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPPHPUnit.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPServers.png - new file: _guides/photos/PHPStorm/Settings/WindowsFirewallAllowedApps.png - new file: _guides/photos/PHPStorm/Settings/WindowsHyperVManager.png - new file: _guides/photos/PHPStorm/Settings/hosts.png - new file: _guides/photos/SimpleHostsEditor/AddHost_laravel.png - new file: _guides/phpstorm.md
2016-11-19 04:12:10 +08:00
```
2019-07-16 00:59:43 +08:00
#### Run Dusk Tests
LaraDock-PHPStorm Debugging Guide - modified: README.md - new file: _guides/photos/KiTTY/Connection.png - new file: _guides/photos/KiTTY/ConnectionData.png - new file: _guides/photos/KiTTY/ConnectionSSH.png - new file: _guides/photos/KiTTY/ConnectionSSHAuth.png - new file: _guides/photos/KiTTY/Session.png - new file: _guides/photos/KiTTY/Terminal.png - new file: _guides/photos/KiTTY/TerminalKeyboard.png - new file: _guides/photos/KiTTY/TerminalShell.png - new file: _guides/photos/KiTTY/Window.png - new file: _guides/photos/KiTTY/WindowAppearance.png - new file: _guides/photos/PHPStorm/DebugRemoteOn.png - new file: _guides/photos/PHPStorm/RemoteDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteHost.png - new file: _guides/photos/PHPStorm/RemoteTestDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteWebDebuggingSuccess.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnection.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnectionMappings.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentDebugger.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteExampleTestDebug.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteWebDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPInterpreters.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPPHPUnit.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPServers.png - new file: _guides/photos/PHPStorm/Settings/WindowsFirewallAllowedApps.png - new file: _guides/photos/PHPStorm/Settings/WindowsHyperVManager.png - new file: _guides/photos/PHPStorm/Settings/hosts.png - new file: _guides/photos/SimpleHostsEditor/AddHost_laravel.png - new file: _guides/phpstorm.md
2016-11-19 04:12:10 +08:00
2019-07-16 00:59:43 +08:00
Run local server in `workspace` container and run Dusk tests.
LaraDock-PHPStorm Debugging Guide - modified: README.md - new file: _guides/photos/KiTTY/Connection.png - new file: _guides/photos/KiTTY/ConnectionData.png - new file: _guides/photos/KiTTY/ConnectionSSH.png - new file: _guides/photos/KiTTY/ConnectionSSHAuth.png - new file: _guides/photos/KiTTY/Session.png - new file: _guides/photos/KiTTY/Terminal.png - new file: _guides/photos/KiTTY/TerminalKeyboard.png - new file: _guides/photos/KiTTY/TerminalShell.png - new file: _guides/photos/KiTTY/Window.png - new file: _guides/photos/KiTTY/WindowAppearance.png - new file: _guides/photos/PHPStorm/DebugRemoteOn.png - new file: _guides/photos/PHPStorm/RemoteDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteHost.png - new file: _guides/photos/PHPStorm/RemoteTestDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteWebDebuggingSuccess.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnection.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnectionMappings.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentDebugger.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteExampleTestDebug.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteWebDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPInterpreters.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPPHPUnit.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPServers.png - new file: _guides/photos/PHPStorm/Settings/WindowsFirewallAllowedApps.png - new file: _guides/photos/PHPStorm/Settings/WindowsHyperVManager.png - new file: _guides/photos/PHPStorm/Settings/hosts.png - new file: _guides/photos/SimpleHostsEditor/AddHost_laravel.png - new file: _guides/phpstorm.md
2016-11-19 04:12:10 +08:00
2019-07-16 00:59:43 +08:00
```
# alias to run Laravel server in the background (php artisan serve --quiet &)
/var/www/dusk-test> serve
# alias to run Dusk tests (php artisan dusk)
/var/www/dusk-test> dusk
LaraDock-PHPStorm Debugging Guide - modified: README.md - new file: _guides/photos/KiTTY/Connection.png - new file: _guides/photos/KiTTY/ConnectionData.png - new file: _guides/photos/KiTTY/ConnectionSSH.png - new file: _guides/photos/KiTTY/ConnectionSSHAuth.png - new file: _guides/photos/KiTTY/Session.png - new file: _guides/photos/KiTTY/Terminal.png - new file: _guides/photos/KiTTY/TerminalKeyboard.png - new file: _guides/photos/KiTTY/TerminalShell.png - new file: _guides/photos/KiTTY/Window.png - new file: _guides/photos/KiTTY/WindowAppearance.png - new file: _guides/photos/PHPStorm/DebugRemoteOn.png - new file: _guides/photos/PHPStorm/RemoteDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteHost.png - new file: _guides/photos/PHPStorm/RemoteTestDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteWebDebuggingSuccess.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnection.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnectionMappings.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentDebugger.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteExampleTestDebug.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteWebDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPInterpreters.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPPHPUnit.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPServers.png - new file: _guides/photos/PHPStorm/Settings/WindowsFirewallAllowedApps.png - new file: _guides/photos/PHPStorm/Settings/WindowsHyperVManager.png - new file: _guides/photos/PHPStorm/Settings/hosts.png - new file: _guides/photos/SimpleHostsEditor/AddHost_laravel.png - new file: _guides/phpstorm.md
2016-11-19 04:12:10 +08:00
2019-07-16 00:59:43 +08:00
PHPUnit 6.4.0 by Sebastian Bergmann and contributors.
2019-07-16 00:59:43 +08:00
. 1 / 1 (100%)
2017-04-14 16:43:26 +08:00
2019-07-16 00:59:43 +08:00
Time: 837 ms, Memory: 6.00MB
```
2017-04-14 16:43:26 +08:00
2019-07-16 00:59:43 +08:00
### Option 2: With Selenium
2017-04-14 16:43:26 +08:00
2019-07-16 00:59:43 +08:00
- [Intro](#dusk-intro)
- [DNS Setup](#dns-setup)
- [Docker Compose Setup](#docker-compose)
- [Laravel Dusk Setup](#laravel-dusk-setup)
- [Running Laravel Dusk Tests](#running-tests)
2017-04-14 16:43:26 +08:00
2019-07-16 00:59:43 +08:00
#### Intro
Setting up Laravel Dusk tests to run with Laradock appears be something that
eludes most Laradock users. This guide is designed to show you how to wire them
up to work together. This guide is written with macOS and Linux in mind. As such,
it's only been tested on macOS. Feel free to create pull requests to update the guide
for Windows-specific instructions.
2017-04-14 16:43:26 +08:00
2019-07-16 00:59:43 +08:00
This guide assumes you know how to use a DNS forwarder such as `dnsmasq` or are comfortable
with editing the `/etc/hosts` file for one-off DNS changes.
2017-04-14 16:43:26 +08:00
2019-07-16 00:59:43 +08:00
#### DNS Setup
According to RFC-2606, only four TLDs are reserved for local testing[^1]:
2017-04-14 16:43:26 +08:00
2019-07-16 00:59:43 +08:00
- `.test`
- `.example`
- `.invalid`
- `.localhost`
2017-04-14 16:43:26 +08:00
2019-07-16 00:59:43 +08:00
A common TLD used for local development is `.dev`, but newer versions of Google
Chrome (such as the one bundled with the Selenium Docker image), will fail to
resolve that DNS as there will appear to be a name collision.
2017-04-14 16:43:26 +08:00
2019-07-16 00:59:43 +08:00
The recommended extension is `.test` for your Laravel web apps because you're
running tests. Using a DNS forwarder such as `dnsmasq` or by editing the `/etc/hosts`
file, configure the host to point to `localhost`.
2017-04-14 16:43:26 +08:00
2019-07-16 00:59:43 +08:00
For example, in your `/etc/hosts` file:
```
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
127.0.0.1 myapp.test
```
LaraDock-PHPStorm Debugging Guide - modified: README.md - new file: _guides/photos/KiTTY/Connection.png - new file: _guides/photos/KiTTY/ConnectionData.png - new file: _guides/photos/KiTTY/ConnectionSSH.png - new file: _guides/photos/KiTTY/ConnectionSSHAuth.png - new file: _guides/photos/KiTTY/Session.png - new file: _guides/photos/KiTTY/Terminal.png - new file: _guides/photos/KiTTY/TerminalKeyboard.png - new file: _guides/photos/KiTTY/TerminalShell.png - new file: _guides/photos/KiTTY/Window.png - new file: _guides/photos/KiTTY/WindowAppearance.png - new file: _guides/photos/PHPStorm/DebugRemoteOn.png - new file: _guides/photos/PHPStorm/RemoteDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteHost.png - new file: _guides/photos/PHPStorm/RemoteTestDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteWebDebuggingSuccess.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnection.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnectionMappings.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentDebugger.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteExampleTestDebug.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteWebDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPInterpreters.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPPHPUnit.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPServers.png - new file: _guides/photos/PHPStorm/Settings/WindowsFirewallAllowedApps.png - new file: _guides/photos/PHPStorm/Settings/WindowsHyperVManager.png - new file: _guides/photos/PHPStorm/Settings/hosts.png - new file: _guides/photos/SimpleHostsEditor/AddHost_laravel.png - new file: _guides/phpstorm.md
2016-11-19 04:12:10 +08:00
2019-07-16 00:59:43 +08:00
This will ensure that when navigating to `myapp.test`, it will route the
request to `127.0.0.1` which will be handled by Nginx in Laradock.
LaraDock-PHPStorm Debugging Guide - modified: README.md - new file: _guides/photos/KiTTY/Connection.png - new file: _guides/photos/KiTTY/ConnectionData.png - new file: _guides/photos/KiTTY/ConnectionSSH.png - new file: _guides/photos/KiTTY/ConnectionSSHAuth.png - new file: _guides/photos/KiTTY/Session.png - new file: _guides/photos/KiTTY/Terminal.png - new file: _guides/photos/KiTTY/TerminalKeyboard.png - new file: _guides/photos/KiTTY/TerminalShell.png - new file: _guides/photos/KiTTY/Window.png - new file: _guides/photos/KiTTY/WindowAppearance.png - new file: _guides/photos/PHPStorm/DebugRemoteOn.png - new file: _guides/photos/PHPStorm/RemoteDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteHost.png - new file: _guides/photos/PHPStorm/RemoteTestDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteWebDebuggingSuccess.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnection.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnectionMappings.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentDebugger.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteExampleTestDebug.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteWebDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPInterpreters.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPPHPUnit.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPServers.png - new file: _guides/photos/PHPStorm/Settings/WindowsFirewallAllowedApps.png - new file: _guides/photos/PHPStorm/Settings/WindowsHyperVManager.png - new file: _guides/photos/PHPStorm/Settings/hosts.png - new file: _guides/photos/SimpleHostsEditor/AddHost_laravel.png - new file: _guides/phpstorm.md
2016-11-19 04:12:10 +08:00
2019-07-16 00:59:43 +08:00
#### Docker Compose setup
In order to make the Selenium container talk to the Nginx container appropriately,
the `docker-compose.yml` needs to be edited to accommodate this. Make the following
changes:
LaraDock-PHPStorm Debugging Guide - modified: README.md - new file: _guides/photos/KiTTY/Connection.png - new file: _guides/photos/KiTTY/ConnectionData.png - new file: _guides/photos/KiTTY/ConnectionSSH.png - new file: _guides/photos/KiTTY/ConnectionSSHAuth.png - new file: _guides/photos/KiTTY/Session.png - new file: _guides/photos/KiTTY/Terminal.png - new file: _guides/photos/KiTTY/TerminalKeyboard.png - new file: _guides/photos/KiTTY/TerminalShell.png - new file: _guides/photos/KiTTY/Window.png - new file: _guides/photos/KiTTY/WindowAppearance.png - new file: _guides/photos/PHPStorm/DebugRemoteOn.png - new file: _guides/photos/PHPStorm/RemoteDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteHost.png - new file: _guides/photos/PHPStorm/RemoteTestDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteWebDebuggingSuccess.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnection.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnectionMappings.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentDebugger.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteExampleTestDebug.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteWebDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPInterpreters.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPPHPUnit.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPServers.png - new file: _guides/photos/PHPStorm/Settings/WindowsFirewallAllowedApps.png - new file: _guides/photos/PHPStorm/Settings/WindowsHyperVManager.png - new file: _guides/photos/PHPStorm/Settings/hosts.png - new file: _guides/photos/SimpleHostsEditor/AddHost_laravel.png - new file: _guides/phpstorm.md
2016-11-19 04:12:10 +08:00
2019-07-16 00:59:43 +08:00
```yaml
...
selenium:
...
depends_on:
- nginx
links:
- nginx:<your_domain>
```
LaraDock-PHPStorm Debugging Guide - modified: README.md - new file: _guides/photos/KiTTY/Connection.png - new file: _guides/photos/KiTTY/ConnectionData.png - new file: _guides/photos/KiTTY/ConnectionSSH.png - new file: _guides/photos/KiTTY/ConnectionSSHAuth.png - new file: _guides/photos/KiTTY/Session.png - new file: _guides/photos/KiTTY/Terminal.png - new file: _guides/photos/KiTTY/TerminalKeyboard.png - new file: _guides/photos/KiTTY/TerminalShell.png - new file: _guides/photos/KiTTY/Window.png - new file: _guides/photos/KiTTY/WindowAppearance.png - new file: _guides/photos/PHPStorm/DebugRemoteOn.png - new file: _guides/photos/PHPStorm/RemoteDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteHost.png - new file: _guides/photos/PHPStorm/RemoteTestDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteWebDebuggingSuccess.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnection.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnectionMappings.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentDebugger.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteExampleTestDebug.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteWebDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPInterpreters.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPPHPUnit.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPServers.png - new file: _guides/photos/PHPStorm/Settings/WindowsFirewallAllowedApps.png - new file: _guides/photos/PHPStorm/Settings/WindowsHyperVManager.png - new file: _guides/photos/PHPStorm/Settings/hosts.png - new file: _guides/photos/SimpleHostsEditor/AddHost_laravel.png - new file: _guides/phpstorm.md
2016-11-19 04:12:10 +08:00
2019-07-16 00:59:43 +08:00
This allows network communication between the Nginx and Selenium containers
and it also ensures that when starting the Selenium container, the Nginx
container starts up first unless it's already running. This allows
the Selenium container to make requests to the Nginx container, which is
necessary for running Dusk tests. These changes also link the `nginx` environment
variable to the domain you wired up in your hosts file.
LaraDock-PHPStorm Debugging Guide - modified: README.md - new file: _guides/photos/KiTTY/Connection.png - new file: _guides/photos/KiTTY/ConnectionData.png - new file: _guides/photos/KiTTY/ConnectionSSH.png - new file: _guides/photos/KiTTY/ConnectionSSHAuth.png - new file: _guides/photos/KiTTY/Session.png - new file: _guides/photos/KiTTY/Terminal.png - new file: _guides/photos/KiTTY/TerminalKeyboard.png - new file: _guides/photos/KiTTY/TerminalShell.png - new file: _guides/photos/KiTTY/Window.png - new file: _guides/photos/KiTTY/WindowAppearance.png - new file: _guides/photos/PHPStorm/DebugRemoteOn.png - new file: _guides/photos/PHPStorm/RemoteDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteHost.png - new file: _guides/photos/PHPStorm/RemoteTestDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteWebDebuggingSuccess.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnection.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnectionMappings.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentDebugger.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteExampleTestDebug.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteWebDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPInterpreters.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPPHPUnit.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPServers.png - new file: _guides/photos/PHPStorm/Settings/WindowsFirewallAllowedApps.png - new file: _guides/photos/PHPStorm/Settings/WindowsHyperVManager.png - new file: _guides/photos/PHPStorm/Settings/hosts.png - new file: _guides/photos/SimpleHostsEditor/AddHost_laravel.png - new file: _guides/phpstorm.md
2016-11-19 04:12:10 +08:00
2019-07-16 00:59:43 +08:00
#### Laravel Dusk Setup
LaraDock-PHPStorm Debugging Guide - modified: README.md - new file: _guides/photos/KiTTY/Connection.png - new file: _guides/photos/KiTTY/ConnectionData.png - new file: _guides/photos/KiTTY/ConnectionSSH.png - new file: _guides/photos/KiTTY/ConnectionSSHAuth.png - new file: _guides/photos/KiTTY/Session.png - new file: _guides/photos/KiTTY/Terminal.png - new file: _guides/photos/KiTTY/TerminalKeyboard.png - new file: _guides/photos/KiTTY/TerminalShell.png - new file: _guides/photos/KiTTY/Window.png - new file: _guides/photos/KiTTY/WindowAppearance.png - new file: _guides/photos/PHPStorm/DebugRemoteOn.png - new file: _guides/photos/PHPStorm/RemoteDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteHost.png - new file: _guides/photos/PHPStorm/RemoteTestDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteWebDebuggingSuccess.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnection.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnectionMappings.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentDebugger.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteExampleTestDebug.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteWebDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPInterpreters.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPPHPUnit.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPServers.png - new file: _guides/photos/PHPStorm/Settings/WindowsFirewallAllowedApps.png - new file: _guides/photos/PHPStorm/Settings/WindowsHyperVManager.png - new file: _guides/photos/PHPStorm/Settings/hosts.png - new file: _guides/photos/SimpleHostsEditor/AddHost_laravel.png - new file: _guides/phpstorm.md
2016-11-19 04:12:10 +08:00
2019-07-16 00:59:43 +08:00
In order to make Laravel Dusk make the proper request to the Selenium container,
you have to edit the `DuskTestCase.php` file that's provided on the initial
installation of Laravel Dusk. The change you have to make deals with the URL the
Remote Web Driver attempts to use to set up the Selenium session.
LaraDock-PHPStorm Debugging Guide - modified: README.md - new file: _guides/photos/KiTTY/Connection.png - new file: _guides/photos/KiTTY/ConnectionData.png - new file: _guides/photos/KiTTY/ConnectionSSH.png - new file: _guides/photos/KiTTY/ConnectionSSHAuth.png - new file: _guides/photos/KiTTY/Session.png - new file: _guides/photos/KiTTY/Terminal.png - new file: _guides/photos/KiTTY/TerminalKeyboard.png - new file: _guides/photos/KiTTY/TerminalShell.png - new file: _guides/photos/KiTTY/Window.png - new file: _guides/photos/KiTTY/WindowAppearance.png - new file: _guides/photos/PHPStorm/DebugRemoteOn.png - new file: _guides/photos/PHPStorm/RemoteDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteHost.png - new file: _guides/photos/PHPStorm/RemoteTestDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteWebDebuggingSuccess.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnection.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnectionMappings.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentDebugger.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteExampleTestDebug.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteWebDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPInterpreters.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPPHPUnit.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPServers.png - new file: _guides/photos/PHPStorm/Settings/WindowsFirewallAllowedApps.png - new file: _guides/photos/PHPStorm/Settings/WindowsHyperVManager.png - new file: _guides/photos/PHPStorm/Settings/hosts.png - new file: _guides/photos/SimpleHostsEditor/AddHost_laravel.png - new file: _guides/phpstorm.md
2016-11-19 04:12:10 +08:00
2019-07-16 00:59:43 +08:00
One recommendation for this is to add a separate config option in your `.env.dusk.local`
so it's still possible to run your Dusk tests locally should you want to.
LaraDock-PHPStorm Debugging Guide - modified: README.md - new file: _guides/photos/KiTTY/Connection.png - new file: _guides/photos/KiTTY/ConnectionData.png - new file: _guides/photos/KiTTY/ConnectionSSH.png - new file: _guides/photos/KiTTY/ConnectionSSHAuth.png - new file: _guides/photos/KiTTY/Session.png - new file: _guides/photos/KiTTY/Terminal.png - new file: _guides/photos/KiTTY/TerminalKeyboard.png - new file: _guides/photos/KiTTY/TerminalShell.png - new file: _guides/photos/KiTTY/Window.png - new file: _guides/photos/KiTTY/WindowAppearance.png - new file: _guides/photos/PHPStorm/DebugRemoteOn.png - new file: _guides/photos/PHPStorm/RemoteDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteHost.png - new file: _guides/photos/PHPStorm/RemoteTestDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteWebDebuggingSuccess.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnection.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnectionMappings.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentDebugger.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteExampleTestDebug.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteWebDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPInterpreters.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPPHPUnit.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPServers.png - new file: _guides/photos/PHPStorm/Settings/WindowsFirewallAllowedApps.png - new file: _guides/photos/PHPStorm/Settings/WindowsHyperVManager.png - new file: _guides/photos/PHPStorm/Settings/hosts.png - new file: _guides/photos/SimpleHostsEditor/AddHost_laravel.png - new file: _guides/phpstorm.md
2016-11-19 04:12:10 +08:00
2019-07-16 00:59:43 +08:00
##### .env.dusk.local
```
...
USE_SELENIUM=true
```
LaraDock-PHPStorm Debugging Guide - modified: README.md - new file: _guides/photos/KiTTY/Connection.png - new file: _guides/photos/KiTTY/ConnectionData.png - new file: _guides/photos/KiTTY/ConnectionSSH.png - new file: _guides/photos/KiTTY/ConnectionSSHAuth.png - new file: _guides/photos/KiTTY/Session.png - new file: _guides/photos/KiTTY/Terminal.png - new file: _guides/photos/KiTTY/TerminalKeyboard.png - new file: _guides/photos/KiTTY/TerminalShell.png - new file: _guides/photos/KiTTY/Window.png - new file: _guides/photos/KiTTY/WindowAppearance.png - new file: _guides/photos/PHPStorm/DebugRemoteOn.png - new file: _guides/photos/PHPStorm/RemoteDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteHost.png - new file: _guides/photos/PHPStorm/RemoteTestDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteWebDebuggingSuccess.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnection.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnectionMappings.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentDebugger.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteExampleTestDebug.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteWebDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPInterpreters.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPPHPUnit.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPServers.png - new file: _guides/photos/PHPStorm/Settings/WindowsFirewallAllowedApps.png - new file: _guides/photos/PHPStorm/Settings/WindowsHyperVManager.png - new file: _guides/photos/PHPStorm/Settings/hosts.png - new file: _guides/photos/SimpleHostsEditor/AddHost_laravel.png - new file: _guides/phpstorm.md
2016-11-19 04:12:10 +08:00
2019-07-16 00:59:43 +08:00
##### DuskTestCase.php
```php
abstract class DuskTestCase extends BaseTestCase
{
...
protected function driver()
{
if (env('USE_SELENIUM', 'false') == 'true') {
return RemoteWebDriver::create(
'http://selenium:4444/wd/hub', DesiredCapabilities::chrome()
);
} else {
return RemoteWebDriver::create(
'http://localhost:9515', DesiredCapabilities::chrome()
);
}
}
}
```
LaraDock-PHPStorm Debugging Guide - modified: README.md - new file: _guides/photos/KiTTY/Connection.png - new file: _guides/photos/KiTTY/ConnectionData.png - new file: _guides/photos/KiTTY/ConnectionSSH.png - new file: _guides/photos/KiTTY/ConnectionSSHAuth.png - new file: _guides/photos/KiTTY/Session.png - new file: _guides/photos/KiTTY/Terminal.png - new file: _guides/photos/KiTTY/TerminalKeyboard.png - new file: _guides/photos/KiTTY/TerminalShell.png - new file: _guides/photos/KiTTY/Window.png - new file: _guides/photos/KiTTY/WindowAppearance.png - new file: _guides/photos/PHPStorm/DebugRemoteOn.png - new file: _guides/photos/PHPStorm/RemoteDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteHost.png - new file: _guides/photos/PHPStorm/RemoteTestDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteWebDebuggingSuccess.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnection.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnectionMappings.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentDebugger.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteExampleTestDebug.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteWebDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPInterpreters.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPPHPUnit.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPServers.png - new file: _guides/photos/PHPStorm/Settings/WindowsFirewallAllowedApps.png - new file: _guides/photos/PHPStorm/Settings/WindowsHyperVManager.png - new file: _guides/photos/PHPStorm/Settings/hosts.png - new file: _guides/photos/SimpleHostsEditor/AddHost_laravel.png - new file: _guides/phpstorm.md
2016-11-19 04:12:10 +08:00
2019-07-16 00:59:43 +08:00
#### Running Laravel Dusk Tests
LaraDock-PHPStorm Debugging Guide - modified: README.md - new file: _guides/photos/KiTTY/Connection.png - new file: _guides/photos/KiTTY/ConnectionData.png - new file: _guides/photos/KiTTY/ConnectionSSH.png - new file: _guides/photos/KiTTY/ConnectionSSHAuth.png - new file: _guides/photos/KiTTY/Session.png - new file: _guides/photos/KiTTY/Terminal.png - new file: _guides/photos/KiTTY/TerminalKeyboard.png - new file: _guides/photos/KiTTY/TerminalShell.png - new file: _guides/photos/KiTTY/Window.png - new file: _guides/photos/KiTTY/WindowAppearance.png - new file: _guides/photos/PHPStorm/DebugRemoteOn.png - new file: _guides/photos/PHPStorm/RemoteDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteHost.png - new file: _guides/photos/PHPStorm/RemoteTestDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteWebDebuggingSuccess.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnection.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnectionMappings.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentDebugger.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteExampleTestDebug.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteWebDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPInterpreters.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPPHPUnit.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPServers.png - new file: _guides/photos/PHPStorm/Settings/WindowsFirewallAllowedApps.png - new file: _guides/photos/PHPStorm/Settings/WindowsHyperVManager.png - new file: _guides/photos/PHPStorm/Settings/hosts.png - new file: _guides/photos/SimpleHostsEditor/AddHost_laravel.png - new file: _guides/phpstorm.md
2016-11-19 04:12:10 +08:00
2019-07-16 00:59:43 +08:00
Now that you have everything set up, to run your Dusk tests, you have to SSH
into the workspace container as you normally would:
```docker-compose exec --user=laradock workspace bash```
LaraDock-PHPStorm Debugging Guide - modified: README.md - new file: _guides/photos/KiTTY/Connection.png - new file: _guides/photos/KiTTY/ConnectionData.png - new file: _guides/photos/KiTTY/ConnectionSSH.png - new file: _guides/photos/KiTTY/ConnectionSSHAuth.png - new file: _guides/photos/KiTTY/Session.png - new file: _guides/photos/KiTTY/Terminal.png - new file: _guides/photos/KiTTY/TerminalKeyboard.png - new file: _guides/photos/KiTTY/TerminalShell.png - new file: _guides/photos/KiTTY/Window.png - new file: _guides/photos/KiTTY/WindowAppearance.png - new file: _guides/photos/PHPStorm/DebugRemoteOn.png - new file: _guides/photos/PHPStorm/RemoteDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteHost.png - new file: _guides/photos/PHPStorm/RemoteTestDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteWebDebuggingSuccess.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnection.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnectionMappings.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentDebugger.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteExampleTestDebug.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteWebDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPInterpreters.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPPHPUnit.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPServers.png - new file: _guides/photos/PHPStorm/Settings/WindowsFirewallAllowedApps.png - new file: _guides/photos/PHPStorm/Settings/WindowsHyperVManager.png - new file: _guides/photos/PHPStorm/Settings/hosts.png - new file: _guides/photos/SimpleHostsEditor/AddHost_laravel.png - new file: _guides/phpstorm.md
2016-11-19 04:12:10 +08:00
2019-07-16 00:59:43 +08:00
Once inside, you can change directory to your application and run:
2017-04-14 16:43:26 +08:00
2019-07-16 00:59:43 +08:00
```php artisan dusk```
2017-04-14 16:43:26 +08:00
2019-07-16 00:59:43 +08:00
One way to make this easier from your project is to create a helper script. Here's one such example:
```bash
#!/usr/bin/env sh
LaraDock-PHPStorm Debugging Guide - modified: README.md - new file: _guides/photos/KiTTY/Connection.png - new file: _guides/photos/KiTTY/ConnectionData.png - new file: _guides/photos/KiTTY/ConnectionSSH.png - new file: _guides/photos/KiTTY/ConnectionSSHAuth.png - new file: _guides/photos/KiTTY/Session.png - new file: _guides/photos/KiTTY/Terminal.png - new file: _guides/photos/KiTTY/TerminalKeyboard.png - new file: _guides/photos/KiTTY/TerminalShell.png - new file: _guides/photos/KiTTY/Window.png - new file: _guides/photos/KiTTY/WindowAppearance.png - new file: _guides/photos/PHPStorm/DebugRemoteOn.png - new file: _guides/photos/PHPStorm/RemoteDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteHost.png - new file: _guides/photos/PHPStorm/RemoteTestDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteWebDebuggingSuccess.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnection.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnectionMappings.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentDebugger.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteExampleTestDebug.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteWebDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPInterpreters.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPPHPUnit.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPServers.png - new file: _guides/photos/PHPStorm/Settings/WindowsFirewallAllowedApps.png - new file: _guides/photos/PHPStorm/Settings/WindowsHyperVManager.png - new file: _guides/photos/PHPStorm/Settings/hosts.png - new file: _guides/photos/SimpleHostsEditor/AddHost_laravel.png - new file: _guides/phpstorm.md
2016-11-19 04:12:10 +08:00
2019-07-16 00:59:43 +08:00
LARADOCK_HOME="path/to/laradock"
LaraDock-PHPStorm Debugging Guide - modified: README.md - new file: _guides/photos/KiTTY/Connection.png - new file: _guides/photos/KiTTY/ConnectionData.png - new file: _guides/photos/KiTTY/ConnectionSSH.png - new file: _guides/photos/KiTTY/ConnectionSSHAuth.png - new file: _guides/photos/KiTTY/Session.png - new file: _guides/photos/KiTTY/Terminal.png - new file: _guides/photos/KiTTY/TerminalKeyboard.png - new file: _guides/photos/KiTTY/TerminalShell.png - new file: _guides/photos/KiTTY/Window.png - new file: _guides/photos/KiTTY/WindowAppearance.png - new file: _guides/photos/PHPStorm/DebugRemoteOn.png - new file: _guides/photos/PHPStorm/RemoteDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteHost.png - new file: _guides/photos/PHPStorm/RemoteTestDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteWebDebuggingSuccess.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnection.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnectionMappings.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentDebugger.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteExampleTestDebug.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteWebDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPInterpreters.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPPHPUnit.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPServers.png - new file: _guides/photos/PHPStorm/Settings/WindowsFirewallAllowedApps.png - new file: _guides/photos/PHPStorm/Settings/WindowsHyperVManager.png - new file: _guides/photos/PHPStorm/Settings/hosts.png - new file: _guides/photos/SimpleHostsEditor/AddHost_laravel.png - new file: _guides/phpstorm.md
2016-11-19 04:12:10 +08:00
2019-07-16 00:59:43 +08:00
pushd ${LARADOCK_HOME}
docker-compose exec --user=laradock workspace bash -c "cd my-project && php artisan dusk && exit"
```
LaraDock-PHPStorm Debugging Guide - modified: README.md - new file: _guides/photos/KiTTY/Connection.png - new file: _guides/photos/KiTTY/ConnectionData.png - new file: _guides/photos/KiTTY/ConnectionSSH.png - new file: _guides/photos/KiTTY/ConnectionSSHAuth.png - new file: _guides/photos/KiTTY/Session.png - new file: _guides/photos/KiTTY/Terminal.png - new file: _guides/photos/KiTTY/TerminalKeyboard.png - new file: _guides/photos/KiTTY/TerminalShell.png - new file: _guides/photos/KiTTY/Window.png - new file: _guides/photos/KiTTY/WindowAppearance.png - new file: _guides/photos/PHPStorm/DebugRemoteOn.png - new file: _guides/photos/PHPStorm/RemoteDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteHost.png - new file: _guides/photos/PHPStorm/RemoteTestDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteWebDebuggingSuccess.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnection.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnectionMappings.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentDebugger.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteExampleTestDebug.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteWebDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPInterpreters.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPPHPUnit.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPServers.png - new file: _guides/photos/PHPStorm/Settings/WindowsFirewallAllowedApps.png - new file: _guides/photos/PHPStorm/Settings/WindowsHyperVManager.png - new file: _guides/photos/PHPStorm/Settings/hosts.png - new file: _guides/photos/SimpleHostsEditor/AddHost_laravel.png - new file: _guides/phpstorm.md
2016-11-19 04:12:10 +08:00
2019-07-16 00:59:43 +08:00
This invokes the Dusk command from inside the workspace container but when the script completes
execution, it returns your session to your project directory.
LaraDock-PHPStorm Debugging Guide - modified: README.md - new file: _guides/photos/KiTTY/Connection.png - new file: _guides/photos/KiTTY/ConnectionData.png - new file: _guides/photos/KiTTY/ConnectionSSH.png - new file: _guides/photos/KiTTY/ConnectionSSHAuth.png - new file: _guides/photos/KiTTY/Session.png - new file: _guides/photos/KiTTY/Terminal.png - new file: _guides/photos/KiTTY/TerminalKeyboard.png - new file: _guides/photos/KiTTY/TerminalShell.png - new file: _guides/photos/KiTTY/Window.png - new file: _guides/photos/KiTTY/WindowAppearance.png - new file: _guides/photos/PHPStorm/DebugRemoteOn.png - new file: _guides/photos/PHPStorm/RemoteDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteHost.png - new file: _guides/photos/PHPStorm/RemoteTestDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteWebDebuggingSuccess.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnection.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnectionMappings.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentDebugger.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteExampleTestDebug.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteWebDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPInterpreters.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPPHPUnit.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPServers.png - new file: _guides/photos/PHPStorm/Settings/WindowsFirewallAllowedApps.png - new file: _guides/photos/PHPStorm/Settings/WindowsHyperVManager.png - new file: _guides/photos/PHPStorm/Settings/hosts.png - new file: _guides/photos/SimpleHostsEditor/AddHost_laravel.png - new file: _guides/phpstorm.md
2016-11-19 04:12:10 +08:00
2019-07-16 00:59:43 +08:00
[^1]: [Don't Use .dev for Development](https://iyware.com/dont-use-dev-for-development/)
LaraDock-PHPStorm Debugging Guide - modified: README.md - new file: _guides/photos/KiTTY/Connection.png - new file: _guides/photos/KiTTY/ConnectionData.png - new file: _guides/photos/KiTTY/ConnectionSSH.png - new file: _guides/photos/KiTTY/ConnectionSSHAuth.png - new file: _guides/photos/KiTTY/Session.png - new file: _guides/photos/KiTTY/Terminal.png - new file: _guides/photos/KiTTY/TerminalKeyboard.png - new file: _guides/photos/KiTTY/TerminalShell.png - new file: _guides/photos/KiTTY/Window.png - new file: _guides/photos/KiTTY/WindowAppearance.png - new file: _guides/photos/PHPStorm/DebugRemoteOn.png - new file: _guides/photos/PHPStorm/RemoteDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteHost.png - new file: _guides/photos/PHPStorm/RemoteTestDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteWebDebuggingSuccess.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnection.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnectionMappings.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentDebugger.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteExampleTestDebug.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteWebDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPInterpreters.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPPHPUnit.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPServers.png - new file: _guides/photos/PHPStorm/Settings/WindowsFirewallAllowedApps.png - new file: _guides/photos/PHPStorm/Settings/WindowsHyperVManager.png - new file: _guides/photos/PHPStorm/Settings/hosts.png - new file: _guides/photos/SimpleHostsEditor/AddHost_laravel.png - new file: _guides/phpstorm.md
2016-11-19 04:12:10 +08:00
2017-05-02 03:00:32 +08:00
2017-08-11 11:07:59 +08:00
<br>
<br>
<br>
<br>
<br>
2019-07-16 00:59:43 +08:00
<a name="PHPStorm-Debugging"></a>
## PHPStorm XDebug Setup
2019-07-16 00:59:43 +08:00
- [Intro](#Intro)
- [Installation](#Installation)
- [Customize laradock/docker-compose.yml](#CustomizeDockerCompose)
- [Clean House](#InstallCleanHouse)
- [Laradock Dial Tone](#InstallLaradockDialTone)
- [hosts](#AddToHosts)
- [Firewall](#FireWall)
- [Enable xDebug on php-fpm](#enablePhpXdebug)
- [PHPStorm Settings](#InstallPHPStorm)
- [Configs](#InstallPHPStormConfigs)
- [Usage](#Usage)
- [Laravel](#UsageLaravel)
- [Run ExampleTest](#UsagePHPStormRunExampleTest)
- [Debug ExampleTest](#UsagePHPStormDebugExampleTest)
- [Debug Web Site](#UsagePHPStormDebugSite)
- [SSH into workspace](#SSHintoWorkspace)
- [KiTTY](#InstallKiTTY)
### Intro
2019-07-16 00:59:43 +08:00
Wiring up [Laravel](https://laravel.com/), [Laradock](https://github.com/Laradock/laradock) [Laravel+Docker] and [PHPStorm](https://www.jetbrains.com/phpstorm/) to play nice together complete with remote xdebug'ing as icing on top! Although this guide is based on `PHPStorm Windows`,
you should be able to adjust accordingly. This guide was written based on Docker for Windows Native.
2019-07-16 00:59:43 +08:00
### Installation
2019-07-16 00:59:43 +08:00
- This guide assumes the following:
- you have already installed and are familiar with Laravel, Laradock and PHPStorm.
- you have installed Laravel as a parent of `laradock`. This guide assumes `/c/_dk/laravel`.
2019-07-16 00:59:43 +08:00
### hosts
- Add `laravel` to your hosts file located on Windows 10 at `C:\Windows\System32\drivers\etc\hosts`. It should be set to the IP of your running container. Mine is: `10.0.75.2`
On Windows you can find it by opening Windows `Hyper-V Manager`.
- ![Windows Hyper-V Manager](images/photos/PHPStorm/Settings/WindowsHyperVManager.png)
2019-07-16 00:59:43 +08:00
- [Hosts File Editor](https://github.com/scottlerch/HostsFileEditor) makes it easy to change your hosts file.
- Set `laravel` to your docker host IP. See [Example](images/photos/SimpleHostsEditor/AddHost_laravel.png).
2019-07-16 00:59:43 +08:00
### Firewall
Your PHPStorm will need to be able to receive a connection from PHP xdebug either your running workspace or php-fpm containers on port 9000. This means that your Windows Firewall should either enable connections from the Application PHPStorm OR the port.
2019-07-16 00:59:43 +08:00
- It is important to note that if the Application PHPStorm is NOT enabled in the firewall, you will not be able to recreate a rule to override that.
- Also be aware that if you are installing/upgrade different versions of PHPStorm, you MAY have orphaned references to PHPStorm in your Firewall! You may decide to remove orphaned references however in either case, make sure that they are set to receive public TCP traffic.
2019-07-16 00:59:43 +08:00
#### Edit laradock/docker-compose.yml
Set the following variables:
```
2019-07-16 00:59:43 +08:00
### Workspace Utilities Container ###############
2019-07-16 00:59:43 +08:00
workspace:
build:
context: ./workspace
args:
- INSTALL_XDEBUG=true
- INSTALL_WORKSPACE_SSH=true
...
2019-07-16 00:59:43 +08:00
### PHP-FPM Container #####################
2019-07-16 00:59:43 +08:00
php-fpm:
build:
context: ./php-fpm
args:
- INSTALL_XDEBUG=true
...
```
2019-07-16 00:59:43 +08:00
#### Edit xdebug.ini files
- `laradock/workspace/xdebug.ini`
- `laradock/php-fpm/xdebug.ini`
Set the following variables:
```
2019-07-16 00:59:43 +08:00
xdebug.remote_autostart=1
xdebug.remote_enable=1
xdebug.remote_connect_back=1
xdebug.cli_color=1
```
2019-07-16 00:59:43 +08:00
#### Need to clean house first?
Make sure you are starting with a clean state. For example, do you have other Laradock containers and images?
Here are a few things I use to clean things up.
- Delete all containers using `grep laradock_` on the names, see: [Remove all containers based on docker image name](https://linuxconfig.org/remove-all-containners-based-on-docker-image-name).
`docker ps -a | awk '{ print $1,$2 }' | grep laradock_ | awk '{print $1}' | xargs -I {} docker rm {}`
- Delete all images containing `laradock`.
`docker images | awk '{print $1,$2,$3}' | grep laradock_ | awk '{print $3}' | xargs -I {} docker rmi {}`
**Note:** This will only delete images that were built with `Laradock`, **NOT** `laradock/*` which are pulled down by `Laradock` such as `laradock/workspace`, etc.
**Note:** Some may fail with:
`Error response from daemon: conflict: unable to delete 3f38eaed93df (cannot be forced) - image has dependent child images`
- I added this to my `.bashrc` to remove orphaned images.
```
2019-07-16 00:59:43 +08:00
dclean() {
processes=`docker ps -q -f status=exited`
if [ -n "$processes" ]; then
docker rm $processes
fi
2019-07-16 00:59:43 +08:00
images=`docker images -q -f dangling=true`
if [ -n "$images" ]; then
docker rmi $images
fi
}
```
2019-07-16 00:59:43 +08:00
- If you frequently switch configurations for Laradock, you may find that adding the following and added to your `.bashrc` or equivalent useful:
```
# remove laravel* containers
# remove laravel_* images
dcleanlaradockfunction()
{
2019-07-16 00:59:43 +08:00
echo 'Removing ALL containers associated with laradock'
docker ps -a | awk '{ print $1,$2 }' | grep laradock | awk '{print $1}' | xargs -I {} docker rm {}
2019-07-16 00:59:43 +08:00
# remove ALL images associated with laradock_
# does NOT delete laradock/* which are hub images
echo 'Removing ALL images associated with laradock_'
docker images | awk '{print $1,$2,$3}' | grep laradock_ | awk '{print $3}' | xargs -I {} docker rmi {}
2019-07-16 00:59:43 +08:00
echo 'Listing all laradock docker hub images...'
docker images | grep laradock
echo 'dcleanlaradock completed'
}
2019-07-16 00:59:43 +08:00
# associate the above function with an alias
# so can recall/lookup by typing 'alias'
alias dcleanlaradock=dcleanlaradockfunction
```
2019-07-16 00:59:43 +08:00
### Let's get a dial-tone with Laravel
2019-07-16 00:59:43 +08:00
```
# barebones at this point
docker-compose up -d nginx mysql
2019-07-16 00:59:43 +08:00
# run
docker-compose ps
2019-07-16 00:59:43 +08:00
# Should see:
Name Command State Ports
-----------------------------------------------------------------------------------------------------------
laradock_mysql_1 docker-entrypoint.sh mysqld Up 0.0.0.0:3306->3306/tcp
laradock_nginx_1 nginx Up 0.0.0.0:443->443/tcp, 0.0.0.0:80->80/tcp
laradock_php-fpm_1 php-fpm Up 9000/tcp
laradock_volumes_data_1 true Exit 0
laradock_volumes_source_1 true Exit 0
laradock_workspace_1 /sbin/my_init Up 0.0.0.0:2222->22/tcp
```
2019-07-16 00:59:43 +08:00
### Enable xDebug on php-fpm
2019-07-16 00:59:43 +08:00
In a host terminal sitting in the laradock folder, run: `./php-fpm/xdebug status`
You should see something like the following:
2019-07-16 00:59:43 +08:00
```
xDebug status
laradock_php-fpm_1
PHP 7.0.9 (cli) (built: Aug 10 2016 19:45:48) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
with Xdebug v2.4.1, Copyright (c) 2002-2016, by Derick Rethans
```
2019-07-16 00:59:43 +08:00
Other commands include `./php-fpm/xdebug start | stop`.
2019-07-16 00:59:43 +08:00
If you have enabled `xdebug=true` in `docker-compose.yml/php-fpm`, `xdebug` will already be running when
`php-fpm` is started and listening for debug info on port 9000.
2019-07-16 00:59:43 +08:00
### PHPStorm Settings
2019-07-16 00:59:43 +08:00
- Here are some settings that are known to work:
- `Settings/BuildDeploymentConnection`
- ![Settings/BuildDeploymentConnection](/images/photos/PHPStorm/Settings/BuildDeploymentConnection.png)
2019-07-16 00:59:43 +08:00
- `Settings/BuildDeploymentConnectionMappings`
- ![Settings/BuildDeploymentConnectionMappings](/images/photos/PHPStorm/Settings/BuildDeploymentConnectionMappings.png)
2019-07-16 00:59:43 +08:00
- `Settings/BuildDeploymentDebugger`
- ![Settings/BuildDeploymentDebugger](/images/photos/PHPStorm/Settings/BuildDeploymentDebugger.png)
2019-07-16 00:59:43 +08:00
- `Settings/EditRunConfigurationRemoteWebDebug`
- ![Settings/EditRunConfigurationRemoteWebDebug](/images/photos/PHPStorm/Settings/EditRunConfigurationRemoteWebDebug.png)
2019-07-16 00:59:43 +08:00
- `Settings/EditRunConfigurationRemoteExampleTestDebug`
- ![Settings/EditRunConfigurationRemoteExampleTestDebug](/images/photos/PHPStorm/Settings/EditRunConfigurationRemoteExampleTestDebug.png)
2019-07-16 00:59:43 +08:00
- `Settings/LangsPHPDebug`
- ![Settings/LangsPHPDebug](/images/photos/PHPStorm/Settings/LangsPHPDebug.png)
2019-07-16 00:59:43 +08:00
- `Settings/LangsPHPInterpreters`
- ![Settings/LangsPHPInterpreters](/images/photos/PHPStorm/Settings/LangsPHPInterpreters.png)
2019-07-16 00:59:43 +08:00
- `Settings/LangsPHPPHPUnit`
- ![Settings/LangsPHPPHPUnit](/images/photos/PHPStorm/Settings/LangsPHPPHPUnit.png)
2019-07-16 00:59:43 +08:00
- `Settings/LangsPHPServers`
- ![Settings/LangsPHPServers](/images/photos/PHPStorm/Settings/LangsPHPServers.png)
2019-07-16 00:59:43 +08:00
- `RemoteHost`
To switch on this view, go to: `Menu/Tools/Deployment/Browse Remote Host`.
- ![RemoteHost](/images/photos/PHPStorm/RemoteHost.png)
2017-08-11 11:07:59 +08:00
2019-07-16 00:59:43 +08:00
- `RemoteWebDebug`
- ![DebugRemoteOn](/images/photos/PHPStorm/DebugRemoteOn.png)
2017-08-11 11:07:59 +08:00
2019-07-16 00:59:43 +08:00
- `EditRunConfigurationRemoteWebDebug`
Go to: `Menu/Run/Edit Configurations`.
- ![EditRunConfigurationRemoteWebDebug](/images/photos/PHPStorm/Settings/EditRunConfigurationRemoteWebDebug.png)
2017-08-11 11:07:59 +08:00
2019-07-16 00:59:43 +08:00
- `EditRunConfigurationRemoteExampleTestDebug`
Go to: `Menu/Run/Edit Configurations`.
- ![EditRunConfigurationRemoteExampleTestDebug](/images/photos/PHPStorm/Settings/EditRunConfigurationRemoteExampleTestDebug.png)
2017-08-11 11:07:59 +08:00
2019-07-16 00:59:43 +08:00
- `WindowsFirewallAllowedApps`
Go to: `Control Panel\All Control Panel Items\Windows Firewall\Allowed apps`.
- ![WindowsFirewallAllowedApps.png](/images/photos/PHPStorm/Settings/WindowsFirewallAllowedApps.png)
2017-08-11 11:07:59 +08:00
2019-07-16 00:59:43 +08:00
- `hosts`
Edit: `C:\Windows\System32\drivers\etc\hosts`.
- ![WindowsFirewallAllowedApps.png](/images/photos/PHPStorm/Settings/hosts.png)
2017-08-11 11:07:59 +08:00
2019-07-16 00:59:43 +08:00
- [Enable xDebug on php-fpm](#enablePhpXdebug)
2017-08-11 11:07:59 +08:00
2019-07-16 00:59:43 +08:00
### Usage
2017-08-11 11:07:59 +08:00
2019-07-16 00:59:43 +08:00
#### Run ExampleTest
- right-click on `tests/ExampleTest.php`
- Select: `Run 'ExampleTest.php'` or `Ctrl+Shift+F10`.
- Should pass!! You just ran a remote test via SSH!
2017-08-11 11:07:59 +08:00
2019-07-16 00:59:43 +08:00
#### Debug ExampleTest
- Open to edit: `tests/ExampleTest.php`
- Add a BreakPoint on line 16: `$this->visit('/')`
- right-click on `tests/ExampleTest.php`
- Select: `Debug 'ExampleTest.php'`.
- Should have stopped at the BreakPoint!! You are now debugging locally against a remote Laravel project via SSH!
- ![Remote Test Debugging Success](/images/photos/PHPStorm/RemoteTestDebuggingSuccess.png)
2017-08-11 11:07:59 +08:00
2019-07-16 00:59:43 +08:00
#### Debug WebSite
- In case xDebug is disabled, from the `laradock` folder run:
`./php-fpm/xdebug start`.
- To switch xdebug off, run:
`./php-fpm/xdebug stop`
2017-08-11 11:07:59 +08:00
2019-07-16 00:59:43 +08:00
- Start Remote Debugging
- ![DebugRemoteOn](/images/photos/PHPStorm/DebugRemoteOn.png)
2017-08-11 11:07:59 +08:00
2019-07-16 00:59:43 +08:00
- Open to edit: `bootstrap/app.php`
- Add a BreakPoint on line 14: `$app = new Illuminate\Foundation\Application(`
- Reload [Laravel Site](http://laravel/)
- Should have stopped at the BreakPoint!! You are now debugging locally against a remote Laravel project via SSH!
- ![Remote Debugging Success](/images/photos/PHPStorm/RemoteDebuggingSuccess.png)
2017-08-11 11:07:59 +08:00
2019-07-16 00:59:43 +08:00
### Let's shell into workspace
Assuming that you are in laradock folder, type:
`ssh -i workspace/insecure_id_rsa -p2222 root@laravel`
**Cha Ching!!!!**
- `workspace/insecure_id_rsa.ppk` may become corrupted. In which case:
- fire up `puttygen`
- import `workspace/insecure_id_rsa`
- save private key to `workspace/insecure_id_rsa.ppk`
2017-08-11 11:07:59 +08:00
2019-07-16 00:59:43 +08:00
#### KiTTY
[Kitty](http://www.9bis.net/kitty/) KiTTY is a fork from version 0.67 of PuTTY.
2017-08-11 11:07:59 +08:00
2019-07-16 00:59:43 +08:00
- Here are some settings that are working for me:
- ![Session](/images/photos/KiTTY/Session.png)
- ![Terminal](/images/photos/KiTTY/Terminal.png)
- ![Window](/images/photos/KiTTY/Window.png)
- ![WindowAppearance](/images/photos/KiTTY/WindowAppearance.png)
- ![Connection](/images/photos/KiTTY/Connection.png)
- ![ConnectionData](/images/photos/KiTTY/ConnectionData.png)
- ![ConnectionSSH](/images/photos/KiTTY/ConnectionSSH.png)
- ![ConnectionSSHAuth](/images/photos/KiTTY/ConnectionSSHAuth.png)
- ![TerminalShell](/images/photos/KiTTY/TerminalShell.png)
2017-08-11 11:07:59 +08:00
2019-07-16 00:59:43 +08:00
<br>
<br>
<br>
<br>
<br>
2017-08-11 11:07:59 +08:00
2019-07-16 00:59:43 +08:00
<a name="Setup remote debugging (PhpStorm)"></a>
## Setup remote debugging for PhpStorm on Linux
2017-08-11 11:07:59 +08:00
2019-07-16 00:59:43 +08:00
- Make sure you have followed the steps above in the [Install Xdebug section](#install-xdebug).
2017-08-11 11:07:59 +08:00
2019-07-16 00:59:43 +08:00
- Make sure Xdebug accepts connections and listens on port 9000. (Should be default configuration).
2017-08-11 11:07:59 +08:00
2019-07-16 00:59:43 +08:00
![Debug Configuration](/images/photos/PHPStorm/linux/configuration/debugConfiguration.png "Debug Configuration").
2017-08-11 11:07:59 +08:00
2019-07-16 00:59:43 +08:00
- Create a server with name `laradock` (matches **PHP_IDE_CONFIG** key in environment file) and make sure to map project root path with server correctly.
2017-08-11 11:07:59 +08:00
2019-07-16 00:59:43 +08:00
![Server Configuration](/images/photos/PHPStorm/linux/configuration/serverConfiguration.png "Server Configuration").
LaraDock-PHPStorm Debugging Guide - modified: README.md - new file: _guides/photos/KiTTY/Connection.png - new file: _guides/photos/KiTTY/ConnectionData.png - new file: _guides/photos/KiTTY/ConnectionSSH.png - new file: _guides/photos/KiTTY/ConnectionSSHAuth.png - new file: _guides/photos/KiTTY/Session.png - new file: _guides/photos/KiTTY/Terminal.png - new file: _guides/photos/KiTTY/TerminalKeyboard.png - new file: _guides/photos/KiTTY/TerminalShell.png - new file: _guides/photos/KiTTY/Window.png - new file: _guides/photos/KiTTY/WindowAppearance.png - new file: _guides/photos/PHPStorm/DebugRemoteOn.png - new file: _guides/photos/PHPStorm/RemoteDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteHost.png - new file: _guides/photos/PHPStorm/RemoteTestDebuggingSuccess.png - new file: _guides/photos/PHPStorm/RemoteWebDebuggingSuccess.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnection.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnectionMappings.png - new file: _guides/photos/PHPStorm/Settings/BuildDeploymentDebugger.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteExampleTestDebug.png - new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteWebDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPDebug.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPInterpreters.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPPHPUnit.png - new file: _guides/photos/PHPStorm/Settings/LangsPHPServers.png - new file: _guides/photos/PHPStorm/Settings/WindowsFirewallAllowedApps.png - new file: _guides/photos/PHPStorm/Settings/WindowsHyperVManager.png - new file: _guides/photos/PHPStorm/Settings/hosts.png - new file: _guides/photos/SimpleHostsEditor/AddHost_laravel.png - new file: _guides/phpstorm.md
2016-11-19 04:12:10 +08:00
2019-07-16 00:59:43 +08:00
- Start listening for debug connections, place a breakpoint and you are good to go !