| 1 | <?php |
||
| 2 | declare( strict_types=1 ); |
||
| 3 | |||
| 4 | namespace WMDE\Fundraising\AddressChangeContext\Tests\Unit\UseCases; |
||
| 5 | |||
| 6 | use PHPUnit\Framework\Attributes\CoversClass; |
||
|
0 ignored issues
–
show
|
|||
| 7 | use PHPUnit\Framework\TestCase; |
||
| 8 | use WMDE\Fundraising\AddressChangeContext\UseCases\ChangeAddress\ChangeAddressRequest; |
||
| 9 | |||
| 10 | #[CoversClass( ChangeAddressRequest::class )] |
||
| 11 | class ChangeAddressRequestTest extends TestCase { |
||
| 12 | public function testCreatesPersonalRequest(): void { |
||
| 13 | $request = ChangeAddressRequest::newPersonalChangeAddressRequest( |
||
| 14 | salutation: 'Herr', |
||
| 15 | title: 'Dr.', |
||
| 16 | firstName: 'Bruce', |
||
| 17 | lastName: 'Wayne', |
||
| 18 | address: 'Fledergasse 9', |
||
| 19 | postcode: '66484', |
||
| 20 | city: 'Battweiler', |
||
| 21 | country: 'ZZ', |
||
| 22 | identifier: '0caffee', |
||
| 23 | donationReceipt: true, |
||
| 24 | isOptOutOnly: true, |
||
| 25 | ); |
||
| 26 | |||
| 27 | $this->assertSame( '', $request->company ); |
||
| 28 | $this->assertSame( 'Herr', $request->salutation ); |
||
| 29 | $this->assertSame( 'Dr.', $request->title ); |
||
| 30 | $this->assertSame( 'Bruce', $request->firstName ); |
||
| 31 | $this->assertSame( 'Wayne', $request->lastName ); |
||
| 32 | $this->assertSame( 'Fledergasse 9', $request->address ); |
||
| 33 | $this->assertSame( '66484', $request->postcode ); |
||
| 34 | $this->assertSame( 'Battweiler', $request->city ); |
||
| 35 | $this->assertSame( 'ZZ', $request->country ); |
||
| 36 | $this->assertSame( '0caffee', $request->identifier ); |
||
| 37 | $this->assertTrue( $request->donationReceipt ); |
||
| 38 | $this->assertTrue( $request->isOptOutOnly ); |
||
| 39 | } |
||
| 40 | |||
| 41 | public function testCreatesCompanyRequest(): void { |
||
| 42 | $request = ChangeAddressRequest::newCompanyChangeAddressRequest( |
||
| 43 | company: 'Wayne Enterprises', |
||
| 44 | address: 'Fledergasse 9', |
||
| 45 | postcode: '66484', |
||
| 46 | city: 'Battweiler', |
||
| 47 | country: 'ZZ', |
||
| 48 | identifier: '0caffee', |
||
| 49 | donationReceipt: true, |
||
| 50 | isOptOutOnly: true, |
||
| 51 | ); |
||
| 52 | |||
| 53 | $this->assertSame( 'Wayne Enterprises', $request->company ); |
||
| 54 | $this->assertSame( '', $request->salutation ); |
||
| 55 | $this->assertSame( '', $request->title ); |
||
| 56 | $this->assertSame( '', $request->firstName ); |
||
| 57 | $this->assertSame( '', $request->lastName ); |
||
| 58 | $this->assertSame( 'Fledergasse 9', $request->address ); |
||
| 59 | $this->assertSame( '66484', $request->postcode ); |
||
| 60 | $this->assertSame( 'Battweiler', $request->city ); |
||
| 61 | $this->assertSame( 'ZZ', $request->country ); |
||
| 62 | $this->assertSame( '0caffee', $request->identifier ); |
||
| 63 | $this->assertTrue( $request->donationReceipt ); |
||
| 64 | $this->assertTrue( $request->isOptOutOnly ); |
||
| 65 | } |
||
| 66 | |||
| 67 | public function testPersonFieldsAreTrimmed(): void { |
||
| 68 | $request = ChangeAddressRequest::newPersonalChangeAddressRequest( |
||
| 69 | salutation: ' Herr ', |
||
| 70 | title: 'Dr. ', |
||
| 71 | firstName: ' Bruce ', |
||
| 72 | lastName: ' Wayne ', |
||
| 73 | address: ' Fledergasse 9 ', |
||
| 74 | postcode: ' 66484 ', |
||
| 75 | city: ' Battweiler ', |
||
| 76 | country: ' ZZ ', |
||
| 77 | identifier: '0caffee ', |
||
| 78 | donationReceipt: true, |
||
| 79 | isOptOutOnly: true, |
||
| 80 | ); |
||
| 81 | |||
| 82 | $this->assertSame( 'Herr', $request->salutation ); |
||
| 83 | $this->assertSame( 'Dr.', $request->title ); |
||
| 84 | $this->assertSame( 'Bruce', $request->firstName ); |
||
| 85 | $this->assertSame( 'Wayne', $request->lastName ); |
||
| 86 | $this->assertSame( 'Fledergasse 9', $request->address ); |
||
| 87 | $this->assertSame( '66484', $request->postcode ); |
||
| 88 | $this->assertSame( 'Battweiler', $request->city ); |
||
| 89 | $this->assertSame( 'ZZ', $request->country ); |
||
| 90 | $this->assertSame( '0caffee', $request->identifier ); |
||
| 91 | } |
||
| 92 | |||
| 93 | public function testCompanyFieldsAreTrimmed(): void { |
||
| 94 | $request = ChangeAddressRequest::newCompanyChangeAddressRequest( |
||
| 95 | company: ' Wayne Enterprises ', |
||
| 96 | address: ' Fledergasse 9 ', |
||
| 97 | postcode: ' 66484 ', |
||
| 98 | city: ' Battweiler ', |
||
| 99 | country: ' ZZ', |
||
| 100 | identifier: '0caffee ', |
||
| 101 | donationReceipt: true, |
||
| 102 | isOptOutOnly: true, |
||
| 103 | ); |
||
| 104 | |||
| 105 | $this->assertSame( 'Wayne Enterprises', $request->company ); |
||
| 106 | $this->assertSame( 'Fledergasse 9', $request->address ); |
||
| 107 | $this->assertSame( '66484', $request->postcode ); |
||
| 108 | $this->assertSame( 'Battweiler', $request->city ); |
||
| 109 | $this->assertSame( 'ZZ', $request->country ); |
||
| 110 | $this->assertSame( '0caffee', $request->identifier ); |
||
| 111 | } |
||
| 112 | } |
||
| 113 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths