Problem/Motivation

The purpose of this task is to add functionnal tests for Commerce Payment module.

Comments

Dom. created an issue. See original summary.

dom.’s picture

Proposed resolution

The following patch defines

  • a commerce_payment_test module that adds both :
    • a "Dummy" PaymentMethod
    • a "Testing Gateway" using this payment method.
  • a test file with two tests covering:
    • CRUD for Gateway done via programming: create a new gateway, edit it, delete it
    • CRUD for Gateway done via UI: create a new gateway, edit it, delete it, as well as validate that gateway provided via third-party config files are discovered and added.

PS: Obvisouly at the moment, this patch applies only to "payment" branch available on GitHub

dom.’s picture

dom.’s picture

Status: Active » Needs review
StatusFileSize
new8.78 KB

Another proposed resolution

The following patch is more narrow focussed on Gateway itself. It contains:

  • a commerce_payment_test module that adds :
    • a "Testing Gateway"
  • a test file with two tests covering:
    • CRUD for Gateway done via programming: create a new gateway, edit it, delete it
    • CRUD for Gateway done via UI: create a new gateway, edit it, delete it, as well as validating that gateway has two modes (live and test) and that those can be configured properly.

PS: Obvisouly at the moment, this patch applies only to "payment" branch available on GitHub

dom.’s picture

CreditCardType coverage

The following patch adds coverage for unit testing the CreditCardType class. It contains:

  • CreditCardType can be instanciated with mandatory data:
    • test getters for mandatory data
    • test optional values are filled with default values
  • CreditCardType can be instanciated with optional value overrides:
    • test all values are overriden by values passed to constructor instead of default value
  • CreditCardType can't be instanciated without mandatory data:
    • test proper exception is raised if CreditCardType is instanciated with missing mandatory data.

PS: Obvisouly at the moment, this patch applies only to "payment" branch available on GitHub

dom.’s picture

Title: Add functionnal tests for Commerce Payment » Add tests for Commerce Payment
StatusFileSize
new3.27 KB

Another CreditCardType coverage

The following patch adds coverage for unit testing the CreditCardType class. It contains:

  • a @covers test for each getter
  • a test checking that CreditCardType can't be instanciated without mandatory data:
    • test proper exception is raised if CreditCardType is instanciated with missing mandatory data.

PS: Obvisouly at the moment, this patch applies only to "payment" branch available on GitHub

borisson_’s picture

Added a pull request for #2: https://github.com/drupalcommerce/commerce/pulls
I didn't notice the other tests added here before I did work on the unit tests yesterday. I can add the coverage for all the getters as well, but I'm not a big fan of testing all getters and setters, the added value of tests is rather small for a simple getter.
See https://github.com/drupalcommerce/commerce/pull/459 and https://github.com/drupalcommerce/commerce/pull/458

bojanz’s picture

Committed the CreditCard and CreditCardType unit tests. I did keep the getter tests, because they have saved me from stupid errors in the past.

Now what remains is for me to commit the functional tests.

  • bojanz committed c806cfd on 8.x-2.x authored by Dom.
    Issue #2769349 by Dom.: Add tests for CreditCardType.
    
  • bojanz committed fbd1d8f on 8.x-2.x authored by borisson_
    Issue #2769349 by borisson_: Add tests for CreditCard.
    
bojanz’s picture

Title: Add tests for Commerce Payment » Add functional tests for payments
Parent issue: » #2790525: [Meta] Complete the payments implementation
bojanz’s picture

Separated, rewrote, committed the dummy payment method in #2794317: Create an example onsite gateway.

Rebasing the functional tests on top of that.

bojanz’s picture

Title: Add functional tests for payments » Add functional tests for the payment gateway UI

Let's be more precise, since there are other areas that will also need functional tests.

  • bojanz committed 29d0778 on 8.x-2.x authored by Dom.
    Issue #2769349 by Dom.: Add functional tests for the payment gateway UI
    
bojanz’s picture

Status: Needs review » Fixed

And we're done here. Thanks, everyone.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.