44
55namespace Sysix \LexOffice \Tests \Clients ;
66
7- use GuzzleHttp \Psr7 \Response ;
87use Psr \Http \Message \ResponseInterface ;
98use Sysix \LexOffice \Clients \Dunning ;
109use Sysix \LexOffice \Tests \TestClient ;
@@ -45,6 +44,8 @@ public function testPursue(): void
4544
4645 public function testDocument (): void
4746 {
47+ $ this ->expectDeprecationV1Warning ('document ' );
48+
4849 [$ api , $ stub ] = $ this ->createClientMockObject (Dunning::class);
4950
5051 $ response = $ stub ->document ('resource-id ' );
@@ -60,38 +61,33 @@ public function testDocument(): void
6061
6162 public function testDocumentContent (): void
6263 {
63- [$ api , $ stub ] = $ this ->createClientMultiMockObject (
64- Dunning::class,
65- [
66- new Response (200 , ['Content-Type ' => 'application/json ' ], '{"documentFileId": "fake-id"} ' ),
67- new Response ()
68- ]
69- );
64+ $ this ->expectDeprecationV1Warning ('document ' );
65+
66+ [$ api , $ stub ] = $ this ->createClientMockObject (Dunning::class);
7067
7168 $ response = $ stub ->document ('resource-id ' , true );
7269
7370 $ this ->assertInstanceOf (ResponseInterface::class, $ response );
7471
7572 $ this ->assertEquals ('GET ' , $ api ->getRequest ()->getMethod ());
7673 $ this ->assertEquals (
77- $ api ->apiUrl . '/v1/files/fake -id ' ,
74+ $ api ->apiUrl . '/v1/dunnings/resource -id/file ' ,
7875 $ api ->getRequest ()->getUri ()->__toString ()
7976 );
8077 }
8178
82- public function testFailedDocumentContent (): void
79+ public function testFileContent (): void
8380 {
84- [, $ stub ] = $ this ->createClientMultiMockObject (
85- Dunning::class,
86- [
87- new Response (500 ),
88- new Response ()
89- ]
90- );
81+ [$ api , $ stub ] = $ this ->createClientMockObject (Dunning::class);
9182
92- $ response = $ stub ->document ('resource-id ' , true );
83+ $ response = $ stub ->file ('resource-id ' );
9384
9485 $ this ->assertInstanceOf (ResponseInterface::class, $ response );
95- $ this ->assertEquals (500 , $ response ->getStatusCode ());
86+
87+ $ this ->assertEquals ('GET ' , $ api ->getRequest ()->getMethod ());
88+ $ this ->assertEquals (
89+ $ api ->apiUrl . '/v1/dunnings/resource-id/file ' ,
90+ $ api ->getRequest ()->getUri ()->__toString ()
91+ );
9692 }
9793}
0 commit comments