GithubHelp home page GithubHelp logo

simesy / drupal-contrib Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mstrelan/drupal-contrib

0.0 0.0 0.0 98 KB

Starter project for contribution to Drupal

Shell 29.72% PHP 42.80% Makefile 23.95% Dockerfile 3.54%

drupal-contrib's Introduction

Drupal contrib starter project

tests

Prerequisites

  • Composer
  • Docker / Docker compose
  • PhpStorm (optional)

Getting started

To get started run the following command:

composer create-project mstrelan/drupal-contrib

Directory structure

  • app/ - this is the web root. The Drupal repo will be checked out here.
  • assets/scaffold/files/ - files that will be copied to their destination with composer.
  • bin/ - vendor binaries go here.
  • src/ - scripts used by composer.
  • vendor/ - composer vendor dir.

Docker compose

Start the stack by running docker-compose up or make start.

You can override port numbers and other env vars by copying .env.dist to .env

The following services are available:

  • nginx - the webserver
  • php-fpm - serves the Drupal site
  • php-cli - a CLI container for interacting with the Drupal site
  • mysql - an empty database container
  • chrome - for running webdriver tests

Makefile targets

Make commands should be executed on the host machine.

  • clean - runs composer install, installs minimal profile and provides a one-time login link
  • start - starts the stack
  • stop - stops the stack
  • stop-php - stops the php containers
  • minimal - installs Drupal with the minimal profile
  • standard - installs Drupal with the standard profile
  • umami - installs Drupal with the demo_umami profile
  • login - gets a one-time login link
  • switch - switches branch, e.g. make BRANCH=9.3 switch
  • 9.3|9.4|9.5|10.0|10.1|11.x - provides a clean environment with the specified Drupal version
  • php7.4|php8.0|php8.1|php8.2 - starts with stack with the specified php version

PhpStorm configuration

Upon first installation you'll be asked if you want to configure PhpStorm. This will configure a remote PHP interpreter, PHPUnit and path mappings for debugging.

The remote interpreter assumes that you have Docker integration configured and working already. See the Enable Docker support section of the PhpStorm documentation to set this up.

Running tests

If you elected to automatically configure PhpStorm you should be able to click the green triangle next to each test in PhpStorm.

Alternatively you can run phpunit on the command line like so:

docker-compose exec php-cli bash
phpunit app/core/tests/Drupal/Tests/Core/DrupalKernel/

Debugging

Xdebug can be enabled for HTTP requests via the Xdebug helper browser extension:

For CLI scripts including drush and phpunit, use XDEBUG_SESSION=1. For example:

You can also toggle Xdebug for debugging tests directly in PhpStorm by clicking the Run Test button next to a test and choosing Debug.

docker-compose exec php-cli bash
XDEBUG_SESSION=1 phpunit app/core/tests/Drupal/Tests/Core/DrupalTest.php --filter=testSetContainer

Debugging WebDriver tests with Selenium and VNC

The .env.dist file contains examples for how to configure the selenium service to use either Chrome or Firefox in debug mode. This exposes a VNC port (default 5900) that you can connect to in order to see tests running in the browser. Using a VNC client such as Remmina or VNC Viewer, simply connect to port 127.0.0.1:5900 with the password secret. If you've changed the VNC_PORT environment variable be sure to connect to that port instead.

Contributing

Once you're up and running you'll have Drupal core checked out in the app directory. From here you can create a new branch for each issue that you're working on.

drupal-contrib's People

Contributors

mstrelan avatar nlisgo avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.