Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Class Stripe\Exception\ExceptionInterface was not found

Abierto
#180 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
php
Área
testing-qa

Línea de trabajo

Reproduce el caso de bogus-key de tests/unit/library/StripeFunctionsTest.php:680 con AspectMock habilitado y, después, sigue el recorrido por goaop/parser-reflection/src/ReflectionEngine.php y codeception/aspect-mock/src/AspectMock/Intercept/BeforeMockTransformer.php. Compara la ruta que falla a través de stripe/stripe-php/lib/ApiRequestor.php con el trace con AspectMock deshabilitado. Se considera terminado cuando el fallo intencional de Stripe llega a ApiErrorException y conserva el mensaje de AuthenticationException, en lugar de informar de que falta la interfaz de excepción de Stripe.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

In my tests, I am forcing Stripe to fail by giving it a bogus API key, so that I can test the error logging etc.

However, when I have Aspect Mock enabled, it seems that due to some internal reflection, Stripe's actual error message is being tampered with. Instead of seeing:

[Stripe\Exception\AuthenticationException] Invalid API Key provided: boguskey

which is what I see when AspectMock is totally removed from my project, instead, I get:

[InvalidArgumentException] Class Stripe\Exception\ExceptionInterface was not found in the /path/to/stripe/vendor/files

Here is the trace:

/work/vendor/goaop/parser-reflection/src/ReflectionEngine.php:152
/work/vendor/goaop/parser-reflection/src/ReflectionClass.php:44
/work/vendor/goaop/parser-reflection/src/ReflectionClass.php:68
/work/vendor/goaop/parser-reflection/src/Traits/ReflectionClassLikeTrait.php:974
/work/vendor/goaop/parser-reflection/src/Traits/ReflectionClassLikeTrait.php:323
/work/vendor/goaop/parser-reflection/src/Traits/ReflectionClassLikeTrait.php:322
/work/vendor/goaop/parser-reflection/src/Traits/ReflectionClassLikeTrait.php:971
/work/vendor/goaop/parser-reflection/src/Traits/ReflectionClassLikeTrait.php:323
/work/vendor/goaop/parser-reflection/src/Traits/ReflectionClassLikeTrait.php:309
/work/vendor/codeception/aspect-mock/src/AspectMock/Intercept/BeforeMockTransformer.php:31
/work/vendor/goaop/framework/src/Instrument/Transformer/CachingTransformer.php:121
/work/vendor/goaop/framework/src/Instrument/Transformer/CachingTransformer.php:78
/work/vendor/goaop/framework/src/Instrument/ClassLoading/SourceTransformingLoader.php:136
/work/vendor/goaop/framework/src/Instrument/ClassLoading/SourceTransformingLoader.php:103
/work/vendor/goaop/framework/src/Instrument/ClassLoading/AopComposerLoader.php:139
/work/vendor/goaop/framework/src/Instrument/ClassLoading/AopComposerLoader.php:139
/work/vendor/stripe/stripe-php/lib/ApiRequestor.php:182
/work/vendor/stripe/stripe-php/lib/ApiRequestor.php:142
/work/vendor/stripe/stripe-php/lib/ApiRequestor.php:429
/work/vendor/stripe/stripe-php/lib/ApiRequestor.php:113
/work/vendor/stripe/stripe-php/lib/ApiOperations/Request.php:63
/work/vendor/stripe/stripe-php/lib/ApiOperations/Create.php:25
/work/library/stripe_functions.php:266
/work/tests/unit/library/StripeFunctionsTest.php:680
/work/vendor/phpunit/phpunit/src/Framework/TestCase.php:1408
/work/vendor/phpunit/phpunit/src/Framework/TestCase.php:1028
/work/vendor/phpunit/phpunit/src/Framework/TestResult.php:691
/work/vendor/phpunit/phpunit/src/Framework/TestCase.php:756
/work/vendor/phpunit/phpunit/src/Framework/TestSuite.php:597
/work/vendor/codeception/phpunit-wrapper/src/Runner.php:117
/work/vendor/codeception/codeception/src/Codeception/SuiteManager.php:158
/work/vendor/codeception/codeception/src/Codeception/Codecept.php:193
/work/vendor/codeception/codeception/src/Codeception/Codecept.php:160
/work/vendor/codeception/codeception/src/Codeception/Command/Run.php:391
/work/vendor/symfony/console/Command/Command.php:255
/work/vendor/symfony/console/Application.php:1012
/work/vendor/symfony/console/Application.php:272
/work/vendor/symfony/console/Application.php:148
/work/vendor/codeception/codeception/src/Codeception/Application.php:107
/work/vendor/codeception/codeception/codecept:43

It seems that when Stripe hits my (intentional) error, it gets rerouted into the internals of AspectMock and gets lost.

This is the trace when AspectMock is disabled:

/work/vendor/stripe/stripe-php/lib/Exception/ApiErrorException.php:38
/work/vendor/stripe/stripe-php/lib/ApiRequestor.php:189
/work/vendor/stripe/stripe-php/lib/ApiRequestor.php:149
/work/vendor/stripe/stripe-php/lib/ApiRequestor.php:438
/work/vendor/stripe/stripe-php/lib/ApiRequestor.php:118
/work/vendor/stripe/stripe-php/lib/ApiOperations/Request.php:63
/work/vendor/stripe/stripe-php/lib/ApiOperations/Create.php:25
/work/library/stripe_functions.php:266
/work/tests/unit/library/StripeFunctionsTest.php:680
/work/vendor/phpunit/phpunit/src/Framework/TestCase.php:1408
/work/vendor/phpunit/phpunit/src/Framework/TestCase.php:1028
/work/vendor/phpunit/phpunit/src/Framework/TestResult.php:691
/work/vendor/phpunit/phpunit/src/Framework/TestCase.php:756
/work/vendor/phpunit/phpunit/src/Framework/TestSuite.php:597
/work/vendor/codeception/phpunit-wrapper/src/Runner.php:117
/work/vendor/codeception/codeception/src/Codeception/SuiteManager.php:158
/work/vendor/codeception/codeception/src/Codeception/Codecept.php:193
/work/vendor/codeception/codeception/src/Codeception/Codecept.php:160
/work/vendor/codeception/codeception/src/Codeception/Command/Run.php:391
/work/vendor/symfony/console/Command/Command.php:255
/work/vendor/symfony/console/Application.php:1012
/work/vendor/symfony/console/Application.php:272
/work/vendor/symfony/console/Application.php:148
/work/vendor/codeception/codeception/src/Codeception/Application.php:107
/work/vendor/codeception/codeception/codecept:43

You can see it goes straight to /work/vendor/stripe/stripe-php/lib/Exception/ApiErrorException.php:38.

I should say that when using my correct Stripe API key (and no exceptions are thrown), my code connects fine to Stripe and does what it is supposed to on their platform.

I am using PHP-Unit 8.5, Codeception 3.1.2, Aspect Mock 3.1.0. Will upgrading to the latest versions of PHPUnit/CodeCeption make any difference? Suggestions?

Lenguaje dominante
PHP
Estrellas
784
Forks
132
Métricas de merge de PR
Sin PR fusionados en 30 d

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de Codeception/AspectMock

Todos los issues de Codeception/AspectMock

Issues similares

Más issues de PHP

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.