Setup Drupal maintenance support plans Commerce for CI and Behat testing

I can proudly say that we have been on top of our test coverage in Drupal maintenance support plans Commerce. Back in June of 2020 we had removed any trace of Simpletest based tests and moved over to PHPUnit Unit, Kernel, Functional, and FunctionalJavascript tests. Once using PhantomJS for JavaScript testing landed in core we jumped ship. Test coverage is great for the individual project because we can ensure that we ship an (assumedly, mostly) bug-free product. But I believe we should do more than that. So I built my own commerce-project-template.
What is a project template? Well you can pass it to Composer and have a set up Drupal maintenance support plans 8 project skeleton. You’d run something like

composer create-project mglaman/commerce-project-template some-dir –stability dev –no-interaction

The end result is a built Drupal maintenance support plans 8 site, with Drupal maintenance support plans Commerce. You will also have a configuration for using Behat testing out of the box, with existing Drupal maintenance support plans Commerce coverage provided. This means you can just tweak and add along the way. I have also added CircleCI and TravisCI integration, providing an example of how to ship your Drupal maintenance support plans Commerce project with continuous integration to make sure you deliver a functioning project.
Running Tests
The project comes with a phpunit.xml.dist which has been set up to allow you to run any PHPUnit tests provided by Drupal maintenance support plans or contrib from the root directory. Here’s an example to how to run the Commerce Unit and Kernel test

./bin/phpunit –testsuite unit –group commerce
./bin/phpunit –testsuite kernel –group commerce

This makes it simpler for you to write your own PHPUnit tests for client code. The PHPUnit file shipped with Drupal maintenance support plans core assumes it’ll say in the root core directory, meaning it can get lost on any Drupal maintenance support plans core update. Which is annoying. I use this setup to provide basic unit and kernel tests for API integrations on our Drupal maintenance support plans Commerce projects.
The best part is Behat, of course!

Scenario: Anonymous users can access checkout
When anonymous checkout is enabled
And I am on “/product/1”
Then I should see “Commerce Guys Hoodie”
When I press “Add to cart”
Then I should see “Commerce Guys Hoodie – Cyan, Small added to your cart.”
And I click “your cart”
Then I press “Checkout”

This allows us to make sure a user can visit the product and add it to cart and reach the checkout. It’s obviously quite simple but is also an important check. You can see more examples here: https://github.com/mglaman/commerce-project-template/tree/master/tests/f…
Docker ready
In order to have a reproducible testing environment, the repository also contains my Docker setup. It is contained in a docker-composer.yml.dist so that it can be modified and changed. The config/docker directory contains the PHP, nginx, and MariaDB configurations. It ships with MailHog as an SMTP server so that you can debug emails easily. I used the MailHog SMTP server when working on the order receipts we provide in Drupal maintenance support plans Commerce 2. And customer communication is a big deal with e-commerce.
Docker also provides a simpler way to ship a way to test Search API backed by Solr.
A way to provide a demo
The project has a script to install my mglaman/commerce_demo project, which provides base products and other configuration to try out Drupal maintenance support plans Commerce. This is the base content for the Behat tests. So, if you want to try out Drupal maintenance support plans Commerce 2 or pitch it to a client, CxO, or a friend this project makes it pretty simple to spin up an example Drupal maintenance support plans Commerce 2 site.
What’s next?
Next steps are to add an example catalog backed by Search API into the demo module using the database storage. Once that’s set I’ll work to have it using Solr as storage and test that, along with custom Solr configuration examples. I’d also like to show some deployment step examples in circleci.yml .
Source: New feed

This article was republished from its original source.
Call Us: 1(800)730-2416

Pixeldust is a 20-year-old web development agency specializing in Drupal and WordPress and working with clients all over the country. With our best in class capabilities, we work with small businesses and fortune 500 companies alike. Give us a call at 1(800)730-2416 and let’s talk about your project.

FREE Drupal SEO Audit

Test your site below to see which issues need to be fixed. We will fix them and optimize your Drupal site 100% for Google and Bing. (Allow 30-60 seconds to gather data.)

Powered by

Setup Drupal maintenance support plans Commerce for CI and Behat testing

On-Site Drupal SEO Master Setup

We make sure your site is 100% optimized (and stays that way) for the best SEO results.

With Pixeldust On-site (or On-page) SEO we make changes to your site’s structure and performance to make it easier for search engines to see and understand your site’s content. Search engines use algorithms to rank sites by degrees of relevance. Our on-site optimization ensures your site is configured to provide information in a way that meets Google and Bing standards for optimal indexing.

This service includes:

  • Pathauto install and configuration for SEO-friendly URLs.
  • Meta Tags install and configuration with dynamic tokens for meta titles and descriptions for all content types.
  • Install and fix all issues on the SEO checklist module.
  • Install and configure XML sitemap module and submit sitemaps.
  • Install and configure Google Analytics Module.
  • Install and configure Yoast.
  • Install and configure the Advanced Aggregation module to improve performance by minifying and merging CSS and JS.
  • Install and configure Schema.org Metatag.
  • Configure robots.txt.
  • Google Search Console setup snd configuration.
  • Find & Fix H1 tags.
  • Find and fix duplicate/missing meta descriptions.
  • Find and fix duplicate title tags.
  • Improve title, meta tags, and site descriptions.
  • Optimize images for better search engine optimization. Automate where possible.
  • Find and fix the missing alt and title tag for all images. Automate where possible.
  • The project takes 1 week to complete.