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.
Issue fork commerce_alma-3529861
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
Comment #2
nicolasgraphComment #4
nicolasgraphComment #5
nicolasgraphComment #6
nicolasgraphOk, 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.
Comment #7
nicolasgraphComment #8
nicolasgraphComment #9
maetvatech commentedComment #10
nicolasgraph