braintree / braintree_php

Braintree PHP library
https://developer.paypal.com/braintree/docs/start/overview
MIT License
545 stars 225 forks source link

Local/Docker test suite failing #297

Closed cmgmyr closed 2 years ago

cmgmyr commented 3 years ago

General information

Issue description

We're trying to get the test suite to run locally on Docker via the make and rake test commands, but 4 unit tests are failing and most of the integration tests are failing as well. We're trying to develop some changes to the SDK but want to make sure the original tests are running successfully. Are there any steps that we can take to get them to run?

Commands Run:

$ make
root@docker-desktop:/braintree-php# rake test
php ./vendor/bin/phpcs --standard=phpcs.xml --report=summary lib tests
............................................................  60 / 276 (22%)
............................................................ 120 / 276 (43%)
............................................................ 180 / 276 (65%)
............................................................ 240 / 276 (87%)
....................................                         276 / 276 (100%)

Time: 7.74 secs; Memory: 66.01MB

php ./vendor/bin/phpunit --testsuite unit --do-not-cache-result
PHPUnit 9.5.4 by Sebastian Bergmann and contributors.

...............................................................  63 / 357 ( 17%)
.........FF.......F............................................ 126 / 357 ( 35%)
............................................................... 189 / 357 ( 52%)
......F........................................................ 252 / 357 ( 70%)
............................................................... 315 / 357 ( 88%)
..........................................                      357 / 357 (100%)

Time: 00:00.997, Memory: 12.00 MB

There were 4 failures:

1) Test\Unit\CreditCardTest::testCreateSignature
Failed asserting that two arrays are equal.
--- Expected
+++ Actual
@@ @@
     11 => Array (
         'options' => Array (
             0 => 'makeDefault'
-            1 => 'verificationMerchantAccountId'
-            2 => 'verifyCard'
-            3 => 'verificationAmount'
-            4 => 'verificationAccountType'
-            5 => 'venmoSdkSession'
-            6 => 'failOnDuplicatePaymentMethod'
+            1 => 'skipAdvancedFraudChecking'
+            2 => 'venmoSdkSession'
+            3 => 'verificationAccountType'
+            4 => 'verificationAmount'
+            5 => 'verificationMerchantAccountId'
+            6 => 'verifyCard'
+            7 => 'failOnDuplicatePaymentMethod'
         )
     )
     12 => Array (...)

/braintree-php/tests/unit/CreditCardTest.php:78

2) Test\Unit\CreditCardTest::testUpdateSignature
Failed asserting that two arrays are equal.
--- Expected
+++ Actual
@@ @@
     11 => Array (
         'options' => Array (
             0 => 'makeDefault'
-            1 => 'verificationMerchantAccountId'
-            2 => 'verifyCard'
-            3 => 'verificationAmount'
-            4 => 'verificationAccountType'
-            5 => 'venmoSdkSession'
-            6 => 'failOnDuplicatePaymentMethod'
+            1 => 'skipAdvancedFraudChecking'
+            2 => 'venmoSdkSession'
+            3 => 'verificationAccountType'
+            4 => 'verificationAmount'
+            5 => 'verificationMerchantAccountId'
+            6 => 'verifyCard'
+            7 => 'failOnDuplicatePaymentMethod'
         )
     )
     12 => Array (...)
     13 => Array (...)
 )

/braintree-php/tests/unit/CreditCardTest.php:132

3) Test\Unit\CustomerTest::testUpdateSignature_doesNotAlterOptionsInCreditCardUpdateSignature
Failed asserting that two arrays are equal.
--- Expected
+++ Actual
@@ @@
 Array (
     0 => 'makeDefault'
-    1 => 'verificationMerchantAccountId'
-    2 => 'verifyCard'
-    3 => 'verificationAmount'
-    4 => 'verificationAccountType'
-    5 => 'venmoSdkSession'
-    6 => 'failOnDuplicatePaymentMethod'
+    1 => 'skipAdvancedFraudChecking'
+    2 => 'venmoSdkSession'
+    3 => 'verificationAccountType'
+    4 => 'verificationAmount'
+    5 => 'verificationMerchantAccountId'
+    6 => 'verifyCard'
+    7 => 'failOnDuplicatePaymentMethod'
 )

/braintree-php/tests/unit/CustomerTest.php:32

4) Test\Unit\PaymentMethodTest::testCreateSignature
Failed asserting that two arrays are equal.
--- Expected
+++ Actual
@@ @@
         'options' => Array (
             0 => 'failOnDuplicatePaymentMethod'
             1 => 'makeDefault'
-            2 => 'verificationMerchantAccountId'
-            3 => 'verifyCard'
+            2 => 'skipAdvancedFraudChecking'
+            3 => 'usBankAccountVerificationMethod'
             4 => 'verificationAccountType'
             5 => 'verificationAmount'
-            6 => 'usBankAccountVerificationMethod'
-            7 => Array (...)
+            6 => 'verificationMerchantAccountId'
+            7 => 'verifyCard'
+            8 => Array (...)
         )
     )
     11 => Array (...)

/braintree-php/tests/unit/PaymentMethodTest.php:71

FAILURES!
Tests: 357, Assertions: 1045, Failures: 4.
rake aborted!
Command failed with status (1): [php ./vendor/bin/phpunit --testsuite unit ...]
/braintree-php/rakefile:42:in `block (2 levels) in <top (required)>'
Tasks: TOP => test:unit
(See full trace by running task with --trace)
sestevens commented 3 years ago

Hi @cmgmyr, the integration tests require a local Braintree Gateway and test data in order to run successfully, so it's not currently possible for outside contributors to run those tests. Once you put up a PR, one of us at Braintree will run the integration tests with your changes to make sure they pass.

The unit tests are another story -- you should be able to run them and they should (theoretically) all pass. But it looks like some changes were committed that are breaking those four tests. We'll do some digging and figure out how those changes got past our CI.