File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change 44
55namespace Bavix \Wallet \Test \Units \Service ;
66
7+ use Bavix \Wallet \Internal \Decorator \StorageServiceLockDecorator ;
78use Bavix \Wallet \Internal \Exceptions \ExceptionInterface ;
89use Bavix \Wallet \Internal \Exceptions \RecordNotFoundException ;
910use Bavix \Wallet \Internal \Service \StorageServiceInterface ;
@@ -28,4 +29,19 @@ public function testFlush(): void
2829
2930 $ storage ->get ('hello ' ); // record not found
3031 }
32+
33+ public function testDecorator (): void
34+ {
35+ $ this ->expectException (RecordNotFoundException::class);
36+ $ this ->expectExceptionCode (ExceptionInterface::RECORD_NOT_FOUND );
37+ $ storage = app (StorageServiceLockDecorator::class);
38+
39+ self ::assertTrue ($ storage ->sync ('hello ' , 34 ));
40+ self ::assertTrue ($ storage ->sync ('world ' , 42 ));
41+ self ::assertSame ('42 ' , $ storage ->get ('world ' ));
42+ self ::assertSame ('34 ' , $ storage ->get ('hello ' ));
43+ self ::assertTrue ($ storage ->flush ());
44+
45+ $ storage ->get ('hello ' ); // record not found
46+ }
3147}
You can’t perform that action at this time.
0 commit comments