88use Monolog \Logger ;
99use PHPUnit \Framework \Attributes \CoversClass ;
1010use PHPUnit \Framework \Attributes \DataProvider ;
11- use PHPUnit \Framework \MockObject \MockObject ;
1211use Symfony \Component \HttpFoundation \Request ;
1312use Symfony \Component \HttpFoundation \Response ;
1413use WMDE \Fundraising \DonationContext \DataAccess \DoctrineEntities \Donation ;
1918use WMDE \Fundraising \Frontend \Tests \Fixtures \BucketLoggerSpy ;
2019use WMDE \Fundraising \Frontend \Tests \Fixtures \InMemoryTranslator ;
2120use WMDE \Fundraising \Frontend \Tests \Fixtures \PayPalAPISpy ;
22- use WMDE \Fundraising \PaymentContext \Services \PaymentUrlGenerator \Sofort \Response as SofortResponse ;
23- use WMDE \Fundraising \PaymentContext \Services \PaymentUrlGenerator \Sofort \SofortClient ;
2421
2522#[CoversClass( AddDonationController::class )]
2623class AddDonationRouteTest extends WebRouteTestCase {
@@ -445,35 +442,6 @@ public function testGivenValidCreditCardData_redirectsToPaymentProvider(): void
445442 $ this ->assertStringContainsString ( 'thatother.paymentprovider.com ' , $ response ->headers ->get ( 'Location ' ) ?: '' );
446443 }
447444
448- public function testValidSofortInput_savesDonationAndRedirectsTo3rdPartyPage (): void {
449- $ client = $ this ->createClient ();
450- $ response = new SofortResponse ();
451- $ response ->setPaymentUrl ( 'https://bankingpin.please ' );
452-
453- /** @var SofortClient&MockObject $sofortClient */
454- $ sofortClient = $ this ->createMock ( SofortClient::class );
455- $ sofortClient
456- ->method ( 'get ' )
457- ->willReturn ( $ response );
458- $ this ->getFactory ()->setSofortClient ( $ sofortClient );
459-
460- $ client ->followRedirects ( false );
461- $ client ->request (
462- 'POST ' ,
463- '/donation/add ' ,
464- $ this ->newValidSofortInput ()
465- );
466-
467- $ donation = $ this ->getDonationFromDatabase ();
468-
469- $ this ->assertSame ( 'X ' , $ donation ->getStatus () );
470- $ this ->assertMatchesRegularExpression ( '/^(XR)-[ACDEFKLMNPRTWXYZ349]{3}-[ACDEFKLMNPRTWXYZ349]{3}-[ACDEFKLMNPRTWXYZ349]/ ' , $ donation ->getBankTransferCode () );
471-
472- $ response = $ client ->getResponse ();
473- $ this ->assertTrue ( $ response ->isRedirect () );
474- $ this ->assertSame ( 'https://bankingpin.please ' , $ response ->headers ->get ( 'Location ' ) );
475- }
476-
477445 /**
478446 * @return array<string, int|string>
479447 */
@@ -486,18 +454,6 @@ private function newValidCreditCardInput(): array {
486454 ];
487455 }
488456
489- /**
490- * @return array<string, int|string>
491- */
492- private function newValidSofortInput (): array {
493- return [
494- 'amount ' => '10000 ' ,
495- 'paymentType ' => 'SUB ' ,
496- 'interval ' => 0 ,
497- 'addressType ' => 'anonym ' ,
498- ];
499- }
500-
501457 public function testGivenInvalidRequest_genericErrorMessageIsDisplayed (): void {
502458 $ client = $ this ->createClient ();
503459
0 commit comments