Giter VIP home page Giter VIP logo

drupal-spec-tool's Introduction

Drupal Spec Tool

Packagist Tests

This project provides a tool for specifying Drupal architecture details and generating automated tests for them. It consists of 1) a Google Sheet for capturing specification and generating tests from it and 2) the Behat contexts that automate the generated tests (examples).

Getting started

Google sheet

Copy the current Google sheet to your Google Drive:

Google Sheet Screenshot

Behat tests

Assuming you already have Behat installed via Composer...

  1. Install the Behat contexts:

    composer require --dev acquia/drupal-spec-tool
  2. Add the new contexts to your Behat configuration, e.g.:

    # behat.yml
    default:
      suites:
        default:
          contexts:
            - Acquia\DrupalSpecTool\Context\AccessControlContext
            - Acquia\DrupalSpecTool\Context\ContentModelContext
            - Acquia\DrupalSpecTool\Context\MediaContext
            - Acquia\DrupalSpecTool\Context\MenuContext
            - Acquia\DrupalSpecTool\Context\ViewsContext
            - Acquia\DrupalSpecTool\Context\WorkflowContext
  3. Copy the default feature files (representing the out-of-the-box configuration of Lightning) to your features directory. For example, given a BLT-based project:

    mkdir -p tests/behat/features/drupal-spec-tool
    cp vendor/acquia/drupal-spec-tool/features/*.feature tests/behat/features/drupal-spec-tool/
  4. As you change the specification, update the features to match using the generated Gherkin on the "Behat" tab of the Google sheet. (See Advanced below to automate this process.)

  5. Run Behat! If the tests pass, your application matches the specification. If not, change one or the other according to your needs.

Usage

Learn more about the features of the tool and best practices for using it in the announcement blog post on the Acquia Developer Center.

Customization

You can supplement or override out-of-the-box behavior by extending and replacing the default context classes with your own, e.g.:

namespace AcmeCorp;

class CustomContentModelContext extends Acquia\DrupalSpecTool\Context\ContentModelContext {

  /**
   * Override existing functionality.
   *
   * @Then exactly the following content entity type bundles should exist
   */
  public function assertBundles(TableNode $expected) {
    // ...
  }

  /**
   * Add new functionality.
   *
   * @Then something new should be true
   */
  public function assertSomethingNew(TableNode $expected) {
    // ...
  }

}
 # behat.yml
 default:
   suites:
     default:
       contexts:
-        - Acquia\DrupalSpecTool\Context\ContentModelContext
+        - AcmeCorp\CustomContentModelContext

Supporting tools

The community has provided tools to build on the Drupal Spec Tool:

  • Drupal Spec Tool Commands - Provides commands to automatically update the Google Sheet to match an existing Drupal site. This is helpful for adding the Drupal Spec Tool on a pre-existing project.
  • Drupal Entity Generator (DEG) - Automatically generates Drupal configuration based on the Google Sheet, i.e., goes "the other way" and updates your Drupal site to match your specification.

Known issues

See open bug reports in the issue queue.

Contribution

Contributions are welcome! See CONTRIBUTING.md.

License

Copyright (C) 2018 Acquia, Inc.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

drupal-spec-tool's People

Contributors

christopher-hopper avatar danielarendwtt avatar dependabot[bot] avatar jfarrell avatar jhedstrom avatar mikemadison13 avatar mxr576 avatar raksha-bharuka avatar secretsayan avatar traviscarden avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

drupal-spec-tool's Issues

Multiple bundles with the same label break ERD generation

If you give two bundles the same label it will confuse the queries and break the auto-generated entity relationship diagram (ERD), even if they're of different content entity types (e.g., a content type and a vocabulary). It's probably best from a UX perspective not to name multiple things identically. Nevertheless, this can probably be fixed by using machine names as aliases in the PlantUML.

Type error trying to test media.feature

Hi,

I'm on a 9.3.x site, with php 8.1.

If I try to test media.feature, I got the following error

Type error: Drupal\Core\Routing\UrlGenerator::setContext(): Argument #1 ($context) must be of type Symfony\Component\Routing\RequestContext, null given (Behat\Testwork\Call\Exception\FatalThrowableError)

While the Image effects scenario is run.

Small Google Sheet Edits

While using this for a recent project, I found two small changes needed to the Google sheet template.

  1. On the Settings tab, cell B28 should be "Number (float)" vs "Number (decimal)" which is repeated a second time, to ensure consistency with the Drupal Add Field dropdown.
  2. On the Overview tab, hidden cell B3 should read "Custom Block type" to calculate the bundles correctly.

Automate generation of Drupal Entities from Drupal Spec Tool

Description

Drupal spec tool currently generates only test cases, We aim to extend this tool to build Drupal entities using the architecture defined in the DST sheet.

High-level technical architecture

  1. Create a new composer plugin which will provide a command(s).
  2. This command will read and collect data from the DST sheet using Google Sheet APIs
  3. This will depend on Drupal and will create Drupal entities.

Note: This is still in the ideation stage and the low-level details are yet to be finalized.

Add Workflow Behat integration

Behat integration has been added for Workflow specifications. A "Workflows" tab was added to support specification of multiple, discrete workflows, and the "Workflow states" and "Workflow transitions" tabs were updated. See the "Behat" tab for the new feature, and add the new context to your Behat configuration to make use of it, e.g.:

# behat.yml
default:
  suites:
    default:
      contexts:
        - Acquia\DrupalSpecTool\Context\WorkflowContext

Note: Workflow diagram generation does not yet support multiple workflows #12

Request to update the module dependency for Drupal 10 latest versions

Hi while upgrading to the Drupal 10 version I am facing the dependency issue related to this module

Problem 1
- Root composer.json requires acquia/drupal-spec-tool ^4.1 -> satisfiable by acquia/drupal-spec-tool[4.1.0, 4.1.1].
- acquia/drupal-spec-tool[4.1.0, ..., 4.1.1] require drupal/core ^9.0 -> found drupal/core[9.0.0-alpha1, ..., 9.5.x-dev] but it conflicts with your root composer.json require (^10.0).

Add Menus Behat integration

Behat integration has been added for Menu specification. See the "Behat" tab for the new feature, and add the new context to your Behat configuration to make use of it, e.g.:

# behat.yml
default:
  suites:
    default:
      contexts:
        - Acquia\DrupalSpecTool\Context\MenuContext

Request for feedback

Now that this project has been in the wild for a bit I'd love to hear people's thoughts on it. What works well? What needs improvement? All thought welcome. Thanks!

Add Views Behat integration

Behat integration has been added for Views specification. See the "Behat" tab for the new feature, and add the new context to your Behat configuration to make use of it, e.g.:

# behat.yml
default:
  suites:
    default:
      contexts:
        - Acquia\DrupalSpecTool\Context\ViewsContext

Add Layout Builder Field Type

Currently we have panelizer as a field type and that is the default for basic pages / landing pages. However, with newer versions of Drupal core and Lightning, we need Layout Builder as a field type instead of just panelizer.

It looks like adding this to the settings tab (good call @TravisCarden ) works fine.

Add Migrations Behat integration

Add Gherkin generation and corresponding Behat step definitions for migrations. (Migration mappings are too complex to include.)

Dragging and reordering rows can break queries

Note that this is a bug report for v1.1. This problem appears to be solved in v2, but I wanted to post an issue in case any other users of v1.1 ran across it.

If you try to reorder rows on the Bundles sheet by dragging them around, this can break the rest of the spreadsheet in unexpected ways.

You can recreate this by simply dragging a row from midway down the bundles sheet up into the first row of the sheet (actually row 2 since there's a header).

This will cause the bundles query to "helpfully" automatically adjust itself to only use row 3 and onward.

Create a framework for CLI commands

Create a framework for CLI commands to do such things as automatically updating the Drupal site to match the specification, updating the specification to match the Drupal site (#27), or updating Behat feature files to match the specification (#24).

It should be a Symfony Console application. acquia/orca provides a good example of a implementing a console-only app with dependency injection autowiring (harder than you'd expect to get started). consolidation/site-alias may provide something useful for connecting to the Drupal site.

Allow either Drupal Behat Extension 3 or 4

Trying to install BLT to an existing project that utilizes the Drupal Behat Extension 4.0 and running into this requirements error:

  Problem 1
    - acquia/blt 10.0.0 requires acquia/drupal-spec-tool ^2.0.0 -> satisfiable by acquia/drupal-spec-tool[v2.x-dev, v2.0.0].
    - acquia/blt 10.0.0-alpha1 requires acquia/drupal-spec-tool ^2.0.0 -> satisfiable by acquia/drupal-spec-tool[v2.x-dev, v2.0.0].
    - acquia/blt 10.0.0-beta1 requires acquia/drupal-spec-tool ^2.0.0 -> satisfiable by acquia/drupal-spec-tool[v2.x-dev, v2.0.0].
    - acquia/blt 10.0.0-beta2 requires acquia/drupal-spec-tool ^2.0.0 -> satisfiable by acquia/drupal-spec-tool[v2.x-dev, v2.0.0].
    - acquia/blt 10.0.0-beta3 requires acquia/drupal-spec-tool ^2.0.0 -> satisfiable by acquia/drupal-spec-tool[v2.x-dev, v2.0.0].
    - acquia/blt 10.0.0-rc1 requires acquia/drupal-spec-tool ^2.0.0 -> satisfiable by acquia/drupal-spec-tool[v2.x-dev, v2.0.0].
    - acquia/blt 10.0.0-rc2 requires acquia/drupal-spec-tool ^2.0.0 -> satisfiable by acquia/drupal-spec-tool[v2.x-dev, v2.0.0].
    - acquia/blt 10.0.0-rc3 requires acquia/drupal-spec-tool ^2.0.0 -> satisfiable by acquia/drupal-spec-tool[v2.x-dev, v2.0.0].
    - acquia/blt 10.0.0-rc4 requires acquia/drupal-spec-tool ^2.0.0 -> satisfiable by acquia/drupal-spec-tool[v2.x-dev, v2.0.0].
    - acquia/blt 10.0.1 requires acquia/drupal-spec-tool ^2.0.0 -> satisfiable by acquia/drupal-spec-tool[v2.x-dev, v2.0.0].
    - acquia/blt 10.x-dev requires acquia/drupal-spec-tool ^2.0.0 -> satisfiable by acquia/drupal-spec-tool[v2.x-dev, v2.0.0].
    - acquia/blt 10.0.x-dev requires acquia/drupal-spec-tool ^2.0.0 -> satisfiable by acquia/drupal-spec-tool[v2.x-dev, v2.0.0].
    - acquia/drupal-spec-tool 2.x-dev requires drupal/drupal-extension ^3.4 -> satisfiable by drupal/drupal-extension[3.4.x-dev].
    - acquia/drupal-spec-tool v2.0.0 requires drupal/drupal-extension ^3.4 -> satisfiable by drupal/drupal-extension[3.4.x-dev].
    - acquia/drupal-spec-tool v2.x-dev requires drupal/drupal-extension ^3.4 -> satisfiable by drupal/drupal-extension[3.4.x-dev].
    - Conclusion: don't install drupal/drupal-extension 3.4.x-dev
    - Installation request for acquia/blt ^10.0 -> satisfiable by acquia/blt[10.0.0, 10.0.0-alpha1, 10.0.0-beta1, 10.0.0-beta2, 10.0.0-beta3, 10.0.0-rc1, 10.0.0-rc2, 10.0.0-rc3, 10.0.0-rc4, 10.0.1, 10.x-dev, 10.0.x-dev].

It would be nice to either just require ^4.0 (which is in beta) or to allow both that and ^3.4. PR to follow.

Overview Formulas Missing in Google Sheet

Thanks again for all your work @TravisCarden! I've discovered that the formula for the Views and Views Displays rows on the protected Overview sheet are missing. I've corrected my local values, but thought it might be helpful to update the source for others. The values should be as below, if my understanding of the sheet is correct.

Thanks!

D11: =COUNTIF(Views!D2:D, "=x")
E11: =COUNTIFS(Views!D2:D, "<>", Views!D2:D, "<>d")
D12: =COUNTIF('Views displays'!E3:E, "=x")
E12: =COUNTIFS('Views displays'!E2:E, "<>", 'Views displays'!E2:E, "<>d")

A dependency no longer exists

Hello,

I got an error message when doing a composer install.
Version dev-master for "drupal/drupal-extension" no longer exists.

image

Thank you for your help.

Skip unexpected elements

Hi,

We'd like to use the Acquia Spec tool to help us validate that a set of common configuration across multiple of our sites (in our multisites setup) follows our best practice guideline, OR are aligned with what should be expected from those sites so our custom themes works properly.

But, we also want to keep some flexibility on each site so they can have some elements specific to them, usually in the form of content types or medias.

From what I understand from the current status of the spec tool and the behat test, we would get an error if one site have an extra elements that is not part of the test.

We'd like to be able to skip that. Adding the spec tool to every site and for every features does not always have a huge value for us.

Is it currently possible ? Or, how could this could be achieved ?

Add Acquia Site Studio Support to Spec Tool

Sites that utilize Site Studio have slightly different definitions required for custom Helpers, Components, etc. It would be great if the spec tool supported these options (perhaps under other tabs than the current bundle / field definitions) so that projects using Site Studio / Cohesion can also use the Spec Tool to define these features.

Large specifications can break Behat test generation

A large enough data set can break the Behat test generation due to character length limits in Google Sheets. ("Text result of JOIN is longer than the limit of 50000 characters.") This could be fixed by refactoring the test generation--perhaps by writing a custom function. It could also be sidestepped by using CSV files instead of Gherkin data tables.

beginner help

Hi, i am pretty lost and feeling stupid trying to figure out how to use this spec tool. Currently I'm trying to figure out:

  1. how to "run" the spreadsheet so the Overview, Diagrams and Behat sheets are update (Updated: those sheets should run automatically when info they depend on are changed; if it does not looks right, then there is a problem with the formula for that cell)
  2. how to generate the tests and then run them
  3. where i should copy the default features file into my own Drupal project (sorry i don't quite understand the BLT example used in step 3 of the readme)
  4. what's the relationship of the generated test files to the features files
  5. how to use Behat in this setup (i've never used that tool before)

I'd appreciate all help anyone can offer. Just trying to see if I can understand this enough to determine whether this tool will be helpful for our project or not...

Here's what i've done:

  1. read the readme along with other documentation pointed to by the readme, including the Behat beginner's guide
  2. made a copy of the google sheet
  3. added our "publication" content type to the Overview sheet
    Screen Shot 2022-12-22 at 3 09 06 PM
  4. added 24 fields for the publication to the Fields sheet
    Screen Shot 2022-12-22 at 3 09 59 PM
  5. installed the spec tool and behat via composer into my docker container running my development instance of Drupal on my laptop
    Screen Shot 2022-12-22 at 3 10 57 PM
  6. i have the following in vendor/acq2uia/drupal-spec-tool/behat.yml:
---
default:
  suites:
    default:
      autoload:
        '': "%paths.base%/features/bootstrap"
      paths:
        - "%paths.base%/features"
      contexts:
        - Acquia\DrupalSpecTool\Context\AccessControlContext
        - Acquia\DrupalSpecTool\Context\ContentModelContext
        - Acquia\DrupalSpecTool\Context\MediaContext
        - Acquia\DrupalSpecTool\Context\MenuContext
        - Acquia\DrupalSpecTool\Context\ViewsContext
        - Acquia\DrupalSpecTool\Context\WorkflowContext
  extensions:
    Behat\MinkExtension:
      goutte: ~
    Drupal\DrupalExtension:
      blackbox: ~
      api_driver: drupal
      drupal:
        drupal_root: docroot
      subcontexts:
        paths: [ ]

Whitespace causing field comparison issue

Hi!
I'm liking this tool so far, just had a little problem that I managed to fix.

Problem

In a new project I was working on I couldn't get the tests for "Then exactly the following fields should exist" to pass. The problem manifested itself in Behat telling me that a field was both present and missing from the specification. Here is the output I was receiving.

  TravisCarden\BehatTableComparison\UnequalTablesException: --- Missing fields (present in specification, absent from Drupal)
  | Paragraph type | Section Component | Title Icon | field_para_icon       | List (text)  |  | 1 | Select list |  | Select the icon you wish to appear alongside the component title                                                               
                                                                                    |
  +++ Unexpected fields (present in Drupal, absent from specification)
  | Paragraph type | Section Component | Title Icon | field_para_icon       | List (text)  |  | 1 | Select list |  | Select the icon you wish to appear alongside the component title                                                                                                                                                  |

I found this a little odd. I eventually tracked this down to the way in which the fields are extracted from the feature file. For some reason an extra space was being added to the description of the field. This was happening even if I removed all of the spaces from the feature file.

  | Paragraph type | Section Component | Title Icon | field_para_icon       | List (text)  |  | 1 | Select list |  | Select the icon you wish to appear alongside the component title|

Solution

The solution I found was to trim the description string as it is added to the list of fields. Line 150 of the ContentModelContext class.

        trim($field_config->getDescription()),

This allowed the specification of the field and the actual fields to match and so complete the test.

Add the ability to update the specification to match an existing Drupal site

Hey @TravisCarden , I'd like to be able to export an existing spec. My use case: I've inherited an existing codebase and would like to use the drupal spec tool to document future content model changes and generate behat tests, but I don't want to spend the time to manually enter the necessary information into the sheet.

I recently took a stab at such a feature. I'm happy to clean it up and submit a pull request if its something you'd consider. It adds two step definitions to the ContentModelContext, invoked in the behat test scenario as "When I export content entity type bundles" and "When I export content entity type fields". These each export a csv that can be imported into google sheets.

Rename BaseContext to ContextBase

\Acquia\DrupalSpecTool\Context\BaseContext has been renamed to \Acquia\DrupalSpecTool\Context\ContextBase in v2.0.0 in keeping with Drupal Core's naming convention for base classes. If you were sub-classing it, you will need to update your use or extends statement.

Create wiki

The blog post announcing the spec tool is very well written but remains the primary/only form of documentation for the tool, and doesn't lend itself to collaboration. Long-term, I think we should have documentation that lives alongside the tool.

I have taken a first crack at creating a wiki in my personal fork of drupal-spec-tool: https://github.com/danepowell/drupal-spec-tool/wiki

Basically, I started by copying most of the text from the blog post verbatim and splitting it up into three general pages (overview/features/usage). I then made just a few small tweaks, and added a large section to the "usage" page with some lessons we've learned on projects in the field.

Let me know if you have any feedback. If it looks good, you can either pull it in here or give me push access and I'll take care of it. We might also want to tweak it and the README just a little to acknowledge the existence of one another.

Composer conflict with Lightning

Using version ^1.1 for acquia/drupal-spec-tool
./composer.json has been updated
Gathering patches for root package.
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

Problem 1
- acquia/drupal-spec-tool v1.1 requires traviscarden/behat-table-comparison ^0.2.1 -> satisfiable by traviscarden/behat-table-comparison[v0.2.1].
- Installation request for acquia/drupal-spec-tool ^1.1 -> satisfiable by acquia/drupal-spec-tool[v1.1].
- Conclusion: remove sebastian/diff 2.0.1
- Conclusion: don't install sebastian/diff 2.0.1
- traviscarden/behat-table-comparison v0.2.1 requires sebastian/diff ^1.4 -> satisfiable by sebastian/diff[1.4.0, 1.4.1, 1.4.2, 1.4.3, 1.4.x-dev].
- Can only install one of: sebastian/diff[1.4.0, 2.0.1].
- Can only install one of: sebastian/diff[1.4.1, 2.0.1].
- Can only install one of: sebastian/diff[1.4.2, 2.0.1].
- Can only install one of: sebastian/diff[1.4.3, 2.0.1].
- Can only install one of: sebastian/diff[1.4.x-dev, 2.0.1].
- Installation request for sebastian/diff (locked at 2.0.1) -> satisfiable by sebastian/diff[2.0.1].

Installation failed, reverting ./composer.json to its original content.

Then tried:
composer remove sebastian/diff
sebastian/diff is not required in your composer.json and has not been removed

Is this fixable in the projects composer file?

How do you use the "Diagrams" feature?

In the currently v5.0.0 version of the sheet, the Diagrams sheet's cells B5 & B6 references the Queries sheet which doesn't exist!

Screenshot

Screen Shot 2023-01-03 at 4 41 13 PM

Or have I misunderstood the "Queries" reference?

More instructions on how to use the Diagrams sheet's data in PlantUML is appreciated (:

Add a Drupal 9 Google Sheet based on Acquia CMS

The current Drupal 9 Google Sheet has data based on the Acquia Lightning profile, which is end of life.

Since Lightning has been more/less replaced by Acquia CMS, it would be very useful to Acquia CMS users to have the Google Sheet default to entities, fields, workflows, etc defined by Acquia CMS. That would make it easier to integrate Drupal Spec Tool into projects using Acquia CMS as their starting point.

Custom entity for Bundle?

In the Google Sheet for the Bundles page, in the Type column, I entered "Custom entity" and got a validation error. Is it not possible to add additional types?
Screen Shot 2023-01-18 at 4 45 22 PM

I went into the "Data validation rules" dialog but don't see a way to add a new entry; I did some searching but didn't find an answer...your help is appreciated...
Screen Shot 2023-01-18 at 4 53 16 PM

Handle other entity types

Hi there.

I'm currently using this drupal-spec-tool on a Drupal Commerce site (D9 and DC2), and I had to edit ContentModelContext file to get Behat to acknowledge Drupal Commerce entities.
Here is the patch.

diff --git a/src/Context/ContentModelContext.php b/src/Context/ContentModelContext.php
index 739525f..7d50f4b 100644
--- a/src/Context/ContentModelContext.php
+++ b/src/Context/ContentModelContext.php
@@ -173,6 +173,17 @@ class ContentModelContext extends ContextBase {
   protected function getContentEntityTypes() {
     $ids = [
       'block_content',
+      'commerce_log',
+      'commerce_order',
+      'commerce_order_item',
+      'commerce_payment',
+      'commerce_payment_method',
+      'commerce_product',
+      'commerce_product_attribute_value',
+      'commerce_product_variation',
+      'commerce_promotion',
+      'commerce_promotion_coupon',
+      'commerce_store',
       'media',
       'node',
       'paragraph',

Any elegant way to do that ?
How about custom entities ?

Fix Behat test indentation

v2.0 of the spreadsheet outputs Behat tests that are formatted like this:

  Scenario: Bundles
       Then exactly the following content entity type bundles should exist
       | Name | Machine name | Type | Description |
| Basic block | basic | Custom block type | A basic block contains a title and a body. |
| Basic page | page | Content type | Use <em>basic pages</em> for your static content, such as an 

This is a little awkward because the bundle definitions aren't indented to the same level as the column headers. This causes problems because some editors will automatically indent them to the same level, while others don't touch the indent, causing noisy git diffs. For greatest compatibility, I think they should all be indented to the same level. These new formulas will fix that:

=SUBSTITUTE(
  "  Scenario: Bundles
    Then exactly the following content entity type bundles should exist
" &
  JOIN(
    CHAR(13),
    ARRAYFORMULA(
      FILTER(
        "      | " & 'Bundles CSV'!A:A & " | " & 'Bundles CSV'!B:B & " | " & 'Bundles CSV'!C:C & " | " & 'Bundles CSV'!D:D & " |",
        NOT(ISBLANK('Bundles CSV'!A:A))
      )
    )
  ),
  CHAR(10),
  CHAR(13)
)
=SUBSTITUTE(
  "  Scenario: Fields
    Then exactly the following fields should exist
" &
  JOIN(
    CHAR(13),
    ARRAYFORMULA(
      FILTER(
        "      | " & 'Fields CSV'!A:A & " | " & 'Fields CSV'!B:B & " | " & 'Fields CSV'!C:C & " | " & 'Fields CSV'!D:D & " | " & 'Fields CSV'!E:E & " | " & 'Fields CSV'!F:F & " | " & 'Fields CSV'!G:G & " | " & 'Fields CSV'!H:H & " | " & 'Fields CSV'!I:I & " | " & 'Fields CSV'!J:J & " |",
        NOT(ISBLANK('Fields CSV'!A:A))
      )
    )
  ),
  CHAR(10),
  CHAR(13)
)

mink-zombie-driver Dependency?

The mink-zombie-driver dependency in Drupal Spec Tool is causing an issue when I try to install the tool via composer inside a Lando environment (which is supported by ADS). The Lando PHP doesn't have the sockets extension included and I haven't figured out how to install/enable it (no answer on the Lando issue queue yet either).

Is there a reason for the mink-zombie-driver dependency that isn't satisfied by the mink-goutte-driver, mink-selenium2-driver or chrome-mink-driver that come when Behat is installed via composer?

Autogenerate machine names in spreadsheet

I don't like manually typing the machine name in most circumstances. Especially when creating a lot of content types it is boring.
So I've been using this formula: =LEFT(LOWER(REGEXREPLACE(B#,"W", "_")),32)
As far as I've been able to determine, there isn't a great method to place that automatically in new rows and still be able to enter a custom value if needed/desired. So I've been using an installed trigger on the google sheet document (onChange):

function onChange(e) {
  var sheet = e.source.getActiveSheet();
  if (e.changeType === "INSERT_ROW") {
    if (sheet == "Bundles" || sheet == "Menus" || sheet == "Views") {
      var range = sheet.getRange('C1:C');
      var values = range.getValues();
      range.setValues(values.map(function (row, index) {
        if (!row[0]) {
          i = index + 1;
          return ['=LEFT(LOWER(REGEXREPLACE(B' + i + ',"\W", "_")),32)'];
        }
        return row;
      }));
    }
  }
}

It does have some negatives and positives vs an onEdit trigger. onEdit is probably worse for performance, but can be smarter - set the value once even if you change the display name. The important thing though, is onEdit, doesn't need to be manually enabled for each user like onChange does as far as I can determine.

Given that, if I get around to polishing the onEdit version of that for myself, would you be interested in it?
(Envisioned Features:

  • autogenerate the machine name
  • don't change an existing machine name even if prior name was autogenerated)

Add Redirect options as columns to the Bundles tab

Description
There are content types that never should be displayed with its own page, like an image media entity that's displayed in a carousel. Rabbit Hole can prevent this node from being accessible on its own page with the following options

  • Deliver an access denied page.
  • Deliver a page not found page.
  • Issue a page redirect to any path or external url.
  • Or simply display the entity (regular behavior).

I think this should be a standard and specified in the Drupal Spec tool. I made a copy of the Drupal spec tool excel book with the updates I think should be added.
https://docs.google.com/spreadsheets/d/1muqPOBLFwr_PySl5OIbcWhrObGzs0yCamrJEGm_pBV8/edit?usp=sharing

Implementation

Columns that would need to be added to the Bundles tab.

Column Redirect Behavior Redirect Override Redirect Path
note Redirect Module is Enabled Redirect Module is Enabled. If page redirect is selected, then allow these settings to be overridden for individual entities. If this is checked, users with the Administer Rabbit Hole settings for Content type permission will be able to override these settings for individual entities. Rabbit Hole is enabled. This is the path where nodes should be redirected. A good default would be /front.
data validation Page Redirect, Page not found, Display the page, Access denied y, n n/a

Compatibility question.

Hi team,

I have a Drupal 8.9 site with BLT 11.x and acquia/drupal-spec-tool 2.x and I have plan to update the site to BLT 12 and Drupal 9.
To update the acquia/drupal-spec-tool what version I should update ? latest ?

Thank you,

Field relationships don't support referencing multiple bundles

You can't currently pick more than one value for the "Ref. bundle" field (target bundle for reference fields) on the "Fields" tab because Google Sheets validation doesn't support multiple dropdown selections. In the meantime, additional values can be hand typed, separated with commas. It will capture the necessary details for implementers, but the cell will get flagged as having an error, and it will break the entity relationship diagram (ERD). Obviously, though, a cleaner solution is desired longterm.

Add support for Image styles

Tabs and Behat integration have been added for Image styles specification. See the "Image styles", "Image effects", and "Behat" tabs for the new feature. Add the new context to your Behat configuration to make use of it, e.g.:

# behat.yml
default:
  suites:
    default:
      contexts:
        - Acquia\DrupalSpecTool\Context\MediaContext

Enable Drupal 10 support

The current composer versioning does not allow Drupal 10. We need to correct this so that acquia/drupal-recommended-project is fully d10 compatible.

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.