@@ -30,9 +30,9 @@ private function getHttpClientMock(): MockObject
3030 ->getMockBuilder (HttpClient::class)
3131 ->disableOriginalConstructor ()
3232 ->onlyMethods (['call ' ])
33- ->getMock ();
33+ ->getMock ();
3434 }
35-
35+
3636 public function testGetSubjects (): void
3737 {
3838 $ httpClientMock = $ this ->getHttpClientMock ();
@@ -59,7 +59,7 @@ public function testGetAllSubjectVersions(): void
5959 public function testGetSchemaByVersion (): void
6060 {
6161 $ httpClientMock = $ this ->getHttpClientMock ();
62-
62+
6363 $ httpClientMock
6464 ->expects ($ this ->once ())
6565 ->method ('call ' )
@@ -72,7 +72,7 @@ public function testGetSchemaByVersion(): void
7272 $ this ->assertSame (['schema ' => '{} ' ], $ result );
7373 }
7474
75- public function testGetSchemaDefinitionByVersion (): void
75+ public function testGetSchemaDefinitionByVersionForComplexSchema (): void
7676 {
7777 $ httpClientMock = $ this ->getHttpClientMock ();
7878
@@ -88,6 +88,22 @@ public function testGetSchemaDefinitionByVersion(): void
8888 $ this ->assertSame (['a ' => 'b ' ], $ result );
8989 }
9090
91+ public function testGetSchemaDefinitionByVersionForOptimizedPrimitiveSchema (): void
92+ {
93+ $ httpClientMock = $ this ->getHttpClientMock ();
94+
95+ $ httpClientMock
96+ ->expects ($ this ->once ())
97+ ->method ('call ' )
98+ ->with ('GET ' , sprintf ('subjects/%s/versions/%s/schema ' , self ::TEST_SUBJECT_NAME , self ::TEST_VERSION ))
99+ ->willReturn ("string " );
100+
101+ $ api = new KafkaSchemaRegistryApiClient ($ httpClientMock );
102+ $ result = $ api ->getSchemaDefinitionByVersion (self ::TEST_SUBJECT_NAME , self ::TEST_VERSION );
103+
104+ $ this ->assertSame ("string " , $ result );
105+ }
106+
91107 public function testDeleteSchemaVersion (): void
92108 {
93109 $ httpClientMock = $ this ->getHttpClientMock ();
@@ -248,7 +264,7 @@ public function testSetSubjectCompatibilityLevel(): void
248264 self ::TEST_SUBJECT_NAME ,
249265 KafkaSchemaRegistryApiClientInterface::LEVEL_FULL
250266 );
251-
267+
252268 $ this ->assertTrue ($ result );
253269 }
254270
0 commit comments