1111use Patchlevel \Hydrator \Metadata \ClassMetadata ;
1212use PHPUnit \Framework \Attributes \CoversClass ;
1313use PHPUnit \Framework \TestCase ;
14- use Prophecy \PhpUnit \ProphecyTrait ;
1514use ReflectionClass ;
1615use stdClass ;
1716
1817#[CoversClass(CryptographySubscriber::class)]
1918final class CryptographySubscriberTest extends TestCase
2019{
21- use ProphecyTrait;
22-
2320 public function testSubscriptions (): void
2421 {
2522 self ::assertEquals ([
@@ -39,13 +36,10 @@ public function testPreHydrate(): void
3936 $ metadata ,
4037 );
4138
42- $ cryptographer = $ this ->prophesize (PayloadCryptographer::class);
43- $ cryptographer ->decrypt (
44- $ metadata ,
45- ['foo ' => 'bar ' ],
46- )->willReturn (['foo ' => 'baz ' ])->shouldBeCalledOnce ();
39+ $ cryptographer = $ this ->createMock (PayloadCryptographer::class);
40+ $ cryptographer ->expects ($ this ->once ())->method ('decrypt ' )->with ($ metadata , ['foo ' => 'bar ' ])->willReturn (['foo ' => 'baz ' ]);
4741
48- $ subscriber = new CryptographySubscriber ($ cryptographer-> reveal () );
42+ $ subscriber = new CryptographySubscriber ($ cryptographer );
4943 $ subscriber ->preHydrate ($ event );
5044
5145 self ::assertEquals (['foo ' => 'baz ' ], $ event ->data );
@@ -62,13 +56,10 @@ public function testPostExtract(): void
6256 $ metadata ,
6357 );
6458
65- $ cryptographer = $ this ->prophesize (PayloadCryptographer::class);
66- $ cryptographer ->encrypt (
67- $ metadata ,
68- ['foo ' => 'bar ' ],
69- )->willReturn (['foo ' => 'baz ' ])->shouldBeCalledOnce ();
59+ $ cryptographer = $ this ->createMock (PayloadCryptographer::class);
60+ $ cryptographer ->expects ($ this ->once ())->method ('encrypt ' )->with ($ metadata , ['foo ' => 'bar ' ])->willReturn (['foo ' => 'baz ' ]);
7061
71- $ subscriber = new CryptographySubscriber ($ cryptographer-> reveal () );
62+ $ subscriber = new CryptographySubscriber ($ cryptographer );
7263 $ subscriber ->postExtract ($ event );
7364
7465 self ::assertEquals (['foo ' => 'baz ' ], $ event ->data );
0 commit comments