Tests are failing on Drupal 11 / Commerce 3.
$this->entityTypeManager is NULL in OffsitePaymentGateway::validatePayment().
Needs some more investigations.

PHPUnit 10.5.46 by Sebastian Bergmann and contributors.

Runtime:       PHP 8.3.15
Configuration: /app/phpunit.xml

....E...EFFFF.                                                    14 / 14 (100%)

Time: 00:48.286, Memory: 12.00 MB

There were 2 errors:

1) Drupal\Tests\commerce_alma\Kernel\OffsitePaymentGatewayTest::testOnNotify
Error: Call to a member function getStorage() on null

/app/web/modules/contrib/commerce_alma/src/Plugin/Commerce/PaymentGateway/OffsitePaymentGateway.php:343
/app/web/modules/contrib/commerce_alma/src/Plugin/Commerce/PaymentGateway/OffsitePaymentGateway.php:305
/app/web/modules/contrib/commerce_alma/tests/src/Kernel/OffsitePaymentGatewayTest.php:148

2) Drupal\Tests\commerce_alma\Kernel\OffsitePaymentGatewayTest::testValidatePayment
Error: Call to a member function getStorage() on null

/app/web/modules/contrib/commerce_alma/src/Plugin/Commerce/PaymentGateway/OffsitePaymentGateway.php:343
/app/web/modules/contrib/commerce_alma/tests/src/Kernel/OffsitePaymentGatewayTest.php:193

--

There were 4 failures:

1) Drupal\Tests\commerce_alma\Kernel\OffsitePaymentGatewayTest::testValidatePaymentException with data set "0" (Alma\API\Entities\Payment Object (...), [], [])
Failed asserting that exception of type "Error" matches expected exception "Drupal\commerce_payment\Exception\PaymentGatewayException". Message was: "Call to a member function getStorage() on null" at
/app/web/modules/contrib/commerce_alma/src/Plugin/Commerce/PaymentGateway/OffsitePaymentGateway.php:343
/app/web/modules/contrib/commerce_alma/tests/src/Kernel/OffsitePaymentGatewayTest.php:210
.

2) Drupal\Tests\commerce_alma\Kernel\OffsitePaymentGatewayTest::testValidatePaymentException with data set "1" (Alma\API\Entities\Payment Object (...), ['payment_default', 'offsite', '1234567890', 1, Drupal\commerce_price\Price Object (...), 'completed'], ['default', 1, [['default', 1, Drupal\commerce_price\Price Object (...)]]])
Failed asserting that exception of type "Error" matches expected exception "Drupal\commerce_payment\Exception\PaymentGatewayException". Message was: "Call to a member function getStorage() on null" at
/app/web/modules/contrib/commerce_alma/src/Plugin/Commerce/PaymentGateway/OffsitePaymentGateway.php:343
/app/web/modules/contrib/commerce_alma/tests/src/Kernel/OffsitePaymentGatewayTest.php:210
.

3) Drupal\Tests\commerce_alma\Kernel\OffsitePaymentGatewayTest::testValidatePaymentException with data set "2" (Alma\API\Entities\Payment Object (...), ['payment_default', 'offsite', '1234567890', Drupal\commerce_price\Price Object (...), 1], ['default', 1, [['default', 1, Drupal\commerce_price\Price Object (...)]]])
Failed asserting that exception of type "Error" matches expected exception "Drupal\commerce_payment\Exception\PaymentGatewayException". Message was: "Call to a member function getStorage() on null" at
/app/web/modules/contrib/commerce_alma/src/Plugin/Commerce/PaymentGateway/OffsitePaymentGateway.php:343
/app/web/modules/contrib/commerce_alma/tests/src/Kernel/OffsitePaymentGatewayTest.php:210
.

4) Drupal\Tests\commerce_alma\Kernel\OffsitePaymentGatewayTest::testValidatePaymentException with data set "3" (Alma\API\Entities\Payment Object (...), ['payment_default', 'offsite', '1234567890', Drupal\commerce_price\Price Object (...), 1], ['default', 1, [['default', 1, Drupal\commerce_price\Price Object (...)]]])
Failed asserting that exception of type "Error" matches expected exception "Drupal\commerce_payment\Exception\PaymentGatewayException". Message was: "Call to a member function getStorage() on null" at
/app/web/modules/contrib/commerce_alma/src/Plugin/Commerce/PaymentGateway/OffsitePaymentGateway.php:343
/app/web/modules/contrib/commerce_alma/tests/src/Kernel/OffsitePaymentGatewayTest.php:210
.

ERRORS!
Tests: 14, Assertions: 330, Errors: 2, Failures: 4, PHPUnit Deprecations: 1.
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

nicolasgraph created an issue. See original summary.

nicolasgraph’s picture

Issue summary: View changes

nicolasgraph’s picture

Assigned: nicolasgraph » Unassigned
nicolasgraph’s picture

Issue summary: View changes
nicolasgraph’s picture

Ok, I guess it is related to the way PaymentGatewayBase is now instanciated in Commerce 3, using create() with no constructor.
Not sure we should support Commerce 2 AND 3.

nicolasgraph’s picture

Title: Tests failing with Drupal 11 /Commerce 3 » Fix Commerce 3 compatibility
Assigned: Unassigned » nicolasgraph
Status: Active » Needs work
nicolasgraph’s picture

Assigned: nicolasgraph » Unassigned
Status: Needs work » Needs review
maetvatech’s picture

Status: Needs review » Reviewed & tested by the community
nicolasgraph’s picture

Status: Reviewed & tested by the community » Fixed

  • nicolasgraph committed 1997b3ec on 1.x
    Issue #3529861 by nicolasgraph, maetvatech: Fix Commerce 3 compatibility
    

Status: Fixed » Closed (fixed)

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