diff --git a/src/Handler.php b/src/Handler.php
index 4643d288f87dd8eb9afb2338fd2336a4957b95cc..6d9c5246bd80e1a2c3b60e1ed8cc6e1b809e3941 100644
--- a/src/Handler.php
+++ b/src/Handler.php
@@ -15,7 +15,7 @@ use Symfony\Component\Filesystem\Filesystem;
 use Symfony\Component\Yaml\Yaml;
 
 /**
- * Class Handler.
+ * Handler for Docker4Drupal.
  *
  * @package LakeDrops\Docker4Drupal
  */
@@ -61,25 +61,21 @@ class Handler extends BaseHandler {
       ],
       'ci_home' => '/home/gitlab-runner',
       'docker0' => [
-        'ip' => ($this->isCiContext() || $this->isLocalDevMode()) ?
-          $this->getDockerGateway() :
-          $this->getLocalIpv4('docker0'),
-        'proxy' => ($this->isCiContext() || $this->isLocalDevMode()) ?
-          $this->getDockerProxy() :
-          FALSE,
+        'ip' => ($this->isCiContext() || $this->isLocalDevMode()) ? $this->getDockerGateway() : $this->getLocalIpv4('docker0'),
+        'proxy' => ($this->isCiContext() || $this->isLocalDevMode()) ? $this->getDockerProxy() : FALSE,
       ],
       'traefik' => [
         'domain' => $this->env->receive('traefik_domain', '', 'docker.localhost'),
         'usessl' => $this->env->receive('traefik_usessl', '', '0'),
         'port' => $this->env->receive('traefik_port', '', '8000'),
         'ports' => $this->env->receive('traefik_ports', '', '8443'),
-        'cert' => $this->env->receive('traefik_cert', '', ''),
-        'key' => $this->env->receive('traefik_key', '', ''),
+        'cert' => $this->env->receive('traefik_cert', ''),
+        'key' => $this->env->receive('traefik_key', ''),
         'portainer' => $this->env->receive('traefik_portainer', '', '0'),
-        'hub_token' => $this->env->receive('traefik_hub_token', '', ''),
+        'hub_token' => $this->env->receive('traefik_hub_token', ''),
         'dns_challenge' => $this->env->receive('traefik_dns_challenge', '', '0'),
-        'dns_challenge_provider' => $this->env->receive('traefik_dns_challenge_provider', '', ''),
-        'dns_challenge_resolver' => $this->env->receive('traefik_dns_challenge_resolver', '', ''),
+        'dns_challenge_provider' => $this->env->receive('traefik_dns_challenge_provider', ''),
+        'dns_challenge_resolver' => $this->env->receive('traefik_dns_challenge_resolver', ''),
         'env' => $traefik_env,
       ],
       'live' => [
@@ -266,7 +262,7 @@ class Handler extends BaseHandler {
     }
     $this->config->setValue('php', $php, FALSE);
 
-    // Get ID of Docker group
+    // Get ID of Docker group.
     $docker_group_id = trim(shell_exec('stat -c "%g" /var/run/docker.sock'));
     $this->config->setValue('docker_group_id', $docker_group_id, FALSE);
 
@@ -439,11 +435,11 @@ class Handler extends BaseHandler {
         $extraOptions = $this->config->readValue($filename);
         if (!empty($def['add2yaml']) && $extraOptions !== NULL) {
           $yaml = Yaml::parse($rendered);
-          /** @noinspection SlowArrayOperationsInLoopInspection */
+          /* @noinspection SlowArrayOperationsInLoopInspection */
           $yaml = array_merge_recursive($yaml, $extraOptions);
           $rendered = Yaml::dump($yaml, 9, 2);
 
-          // Render the string again so that custom content can also use variables
+          // Render string again so that custom content can also use variables.
           $rendered = $this->config->render($filename, $rendered);
         }
         elseif ($extraOptions !== NULL) {
@@ -503,19 +499,20 @@ class Handler extends BaseHandler {
     $this->gitIgnore('tests/backstop/backstop_data/html_report');
     $this->gitLFS('tests/backstop/**/*.png');
 
-    // Ignore some Cypress directories
+    // Ignore some Cypress directories.
     $this->gitIgnore('tests/cypress/downloads');
     $this->gitIgnore('tests/cypress/screenshots');
     $this->gitIgnore('tests/cypress/videos');
 
-    // Ignore some Unlighthouse directories
+    // Ignore some Unlighthouse directories.
     $this->gitIgnore('tests/unlighthouse');
 
     if (getenv('LAKEDROPS_BUILD_NG') !== 'yes') {
       $this->updateTraefik();
     }
 
-    // Set permissions, see https://wodby.com/stacks/drupal/docs/local/permissions
+    // Set permissions.
+    // @see https://wodby.com/stacks/drupal/docs/local/permissions
     exec('setfacl -dR -m u:$(whoami):rwX -m u:82:rwX -m u:100:rX -m g::rwX ' . $projectRoot . ' >/dev/null 2>&1');
     exec('setfacl -R -m u:$(whoami):rwX -m u:82:rwX -m u:100:rX -m g::rwX ' . $projectRoot . ' >/dev/null 2>&1');
   }
@@ -536,7 +533,7 @@ class Handler extends BaseHandler {
    */
   private function updateTraefik(): void {
     if (getenv('TRAEFIK_HOST') === 'yes') {
-      // Traefik is already available and controlled by the host. Don't touch it.
+      // Traefik is already available & controlled by the host. Don't touch it.
       return;
     }
     $traefik = new Traefik(
@@ -798,10 +795,10 @@ class Handler extends BaseHandler {
    */
   private function getLocalIpv4(string $interface = NULL) {
     $out = explode(PHP_EOL, shell_exec('LC_ALL=C /sbin/ifconfig'));
-    $local_addrs = array();
+    $local_addrs = [];
     $ifname = 'unknown';
     foreach ($out as $str) {
-      $matches = array();
+      $matches = [];
       if (preg_match('/^([a-z0-9]+)(:\d{1,2})?(\s)+Link/', $str, $matches)) {
         $ifname = $matches[1];
         if ($matches[2] !== '') {
@@ -820,7 +817,10 @@ class Handler extends BaseHandler {
   }
 
   /**
+   * Get Docker gateway IP from docker inspect.
+   *
    * @return string
+   *   The gateay IP.
    */
   private function getDockerGateway(): string {
     $container = $this->readContainerConfig();
@@ -828,11 +828,18 @@ class Handler extends BaseHandler {
   }
 
   /**
+   * Get Docker Proxy IP from docker inspect.
+   *
    * @return string
+   *   The proxy IP.
    */
   private function getDockerProxy(): string {
     foreach ($this->readNetworkConfig()['Containers'] as $container) {
-      if (isset($container['Name']) && in_array($container['Name'], ['traefik', 'traefik_traefik_1', 'traefik-traefik-1'])) {
+      if (isset($container['Name']) && in_array($container['Name'], [
+        'traefik',
+        'traefik_traefik_1',
+        'traefik-traefik-1',
+      ])) {
         return explode('/', $container['IPv4Address'])[0];
       }
     }
@@ -840,11 +847,15 @@ class Handler extends BaseHandler {
   }
 
   /**
-   * @param $projectRoot
+   * Get Docker mount source from docker inspect.
+   *
+   * @param string $projectRoot
+   *   The project root directory.
    *
    * @return string
+   *   The mount source.
    */
-  private function getDockerMountSource($projectRoot): string {
+  private function getDockerMountSource(string $projectRoot): string {
     $currentDir = getcwd();
     $container = $this->readContainerConfig();
     foreach ($container['Mounts'] as $mount) {
@@ -853,7 +864,7 @@ class Handler extends BaseHandler {
           return $mount['Source'];
         }
       }
-      else if (strpos($projectRoot, $mount['Destination']) === 0) {
+      elseif (strpos($projectRoot, $mount['Destination']) === 0) {
         return $mount['Source'] . substr($projectRoot, strlen($mount['Destination']));
       }
     }
@@ -861,12 +872,15 @@ class Handler extends BaseHandler {
   }
 
   /**
+   * Get container details from docker inspect.
+   *
    * @return array
+   *   The container details.
    */
   private function readContainerConfig(): array {
     try {
       $testString = 'This is a test file for LakeDrops GitLab CI';
-      $filename = '/tmp/' . random_int(100,999) . '.test';
+      $filename = '/tmp/' . random_int(100, 999) . '.test';
       file_put_contents($filename, $testString);
       $output = [];
       exec('docker ps -q', $output);
@@ -898,13 +912,16 @@ class Handler extends BaseHandler {
   }
 
   /**
+   * Get network configuration from docker inspect.
+   *
    * @return array
+   *   The network configuration.
    */
   private function readNetworkConfig(): array {
     try {
       $output = [];
       exec('docker network inspect traefik-public', $output);
-      return json_decode(implode('', $output), TRUE)[0];
+      return json_decode(implode('', $output), TRUE, 512, JSON_THROW_ON_ERROR)[0];
     }
     catch (\Exception $ex) {
       // Ignore.
@@ -915,7 +932,10 @@ class Handler extends BaseHandler {
   }
 
   /**
+   * Get default configuration for backstop.
+   *
    * @return array
+   *   The default configuration for backstop.
    */
   private function backstopDefaults(): array {
     return [
diff --git a/templates/docker-compose.yml.twig b/templates/docker-compose.yml.twig
index 2da676a2a3fdbc0d72cbf4cb2afc22ed83daaa3b..291ef3888e29f1e640948374b2a168bf5eafcb4f 100644
--- a/templates/docker-compose.yml.twig
+++ b/templates/docker-compose.yml.twig
@@ -582,6 +582,9 @@ services:
     image: 'registry.lakedrops.com/docker/cypress:{{ cypress.version }}'
     environment:
       - CYPRESS_baseUrl={{ projectprotocol }}://{{ projectdomain }}{{ projectport }}
+{% if mailpit.enable %}
+      - CYPRESS_mailpitUrl={{ projectprotocol }}://mailpit-{{ projectdomain }}{{ projectport }}
+{% endif %}
 {% if mailhog.enable %}
       - CYPRESS_mailhogUrl={{ projectprotocol }}://mailhog-{{ projectdomain }}{{ projectport }}
 {% endif %}
diff --git a/templates/tests/cypress-run.twig b/templates/tests/cypress-run.twig
index f0734cb45446176611a8c23545cf5a4db53a25b1..66deb088131ecc9802826f0476ad88a48a1c96be 100755
--- a/templates/tests/cypress-run.twig
+++ b/templates/tests/cypress-run.twig
@@ -11,6 +11,7 @@ else
   docker run -u 1000:$(stat -c "%g" /var/run/docker.sock) --rm --name=${NAME} \
     --network {{ projectname }}_default \
     --env CYPRESS_baseUrl=http://apache \
+    --env CYPRESS_mailpitUrl=http://mailpit:8025 \
     --env CYPRESS_mailhogUrl=http://mailhog:8025 \
     --env PHP_CONTAINER={{ projectname }}-php-1 \
     -v /var/run/docker.sock:/var/run/docker.sock \