Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in
  • C civicrm-core
  • Project information
    • Project information
    • Activity
    • Labels
    • Planning hierarchy
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 113
    • Merge requests 113
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • CiviCRM
  • civicrm-core
  • Merge requests
  • !17501

Open
Created Jun 05, 2020 by Michael O'Toole@MikeyMJCOOwner
  • Report abuse
Report abuse

Convert Authorize.net doDirectPayment to use guzzle & add test

  • Overview 0
  • Commits 1
  • Changes 2

Created by: eileenmcnaughton

Overview

This brings the main Authorize.net payment function under testing, putting us in a better position to bring it into line with more recommended coding practices.

My hope is that we can add doPayment testing to all core-enabled processors & select them more randomly during other tests to flush out more variations. Also to move them to core-extensions with a longer term view to moving at least some entirely out of core (I think the following are broken in core - FirstData, PaymentExpress, maybe Eway)

Before

No test on doPayment

After

Unit test covers doPayment

Technical Details

Note the trick to writing tests for Guzzle is to first add the lines

    $this->setUpClientWithHistoryContainer();
    $this->processor->setGuzzleClient($this->getGuzzleClient());
... do the stuff

   $responses = $this->getResponseBodies();
   $requests = $this->getRequestBodies();

That allows you to capture the outgoing & incoming responses that form the expectations. Obviously some credential wrangling is needed to get an OK response but it's also possible with some processors (e.g ones that are basically done for) to just worry about ensuring the outgoing is captured

Comments

@karing - this uses a new guzzle test trait in core that can also be used from extensions

Assignee
Assign to
Reviewer
Request review from
Time tracking
Source branch: github/fork/eileenmcnaughton/guzzle3