Skip to content

Instantly share code, notes, and snippets.

@andriyun
Last active February 6, 2020 15:34
Show Gist options
  • Save andriyun/01588166431c1d87dc7689e167822ff5 to your computer and use it in GitHub Desktop.
Save andriyun/01588166431c1d87dc7689e167822ff5 to your computer and use it in GitHub Desktop.
OS2Web development guide

General rules

Composer based code delivery

All features and functionality should implemented as composer package and should be available to download via composer. By default it's recommended to use packagist.org as package registry.

Configuration

Features functionality should be installed and configured from code during installation or updating process. It means that all default values for setting forms should be provided from configuration files where it possible.

In case of changes/additions/deletions in existing functionality your code diff should contain necessary:

  • changes to initial configuration
  • upgrade path for existing installation

Testing

Every change should be tested by "code driven" approach. Testing should happen before update module code on customer project.

Test case:

  1. Install fresh Drupal core
  2. Add and activate module before changes
  3. Create test nodes(entities) that represent state of functionality before changes.
  4. Apply changes for module, with proper dependencies update if required
  5. Reset cache, run updb
  6. Check test nodes(entities) from step 3

All changes should be applied without manual action thouhg user interface

Example of commands:

1. composer create-project drupal-composer/drupal-project:8.x-dev some-dir --no-interaction
   cd some-dir
   drush si
2. cd web/modules
   git clone [git-repo-url]
   git checkout master (previous commit hash)
3. #Prepare test case content
4. git checkout develop (your changes branch)
5. composer install
   drush updb
   drush cr
6. #Check test content from step 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment