diff options
author | jenkins-bot <jenkins-bot@gerrit.wikimedia.org> | 2025-01-16 14:23:14 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@wikimedia.org> | 2025-01-16 14:23:14 +0000 |
commit | f47431c2a9bff72390f08f2d550de318731e81da (patch) | |
tree | 2d4bf9db84ad9aee6ab64f28f36930dd08d32fd7 /tests/phpunit/integration/includes | |
parent | a9d4d54f74d224cb068510c7715dbfa1ad46123d (diff) | |
parent | 19c405ee94ef4f5afc5c11384e488659d0cfc273 (diff) | |
download | mediawikicore-f47431c2a9bff72390f08f2d550de318731e81da.tar.gz mediawikicore-f47431c2a9bff72390f08f2d550de318731e81da.zip |
Merge "REST Add response schemas for 'transform' endpoints"
Diffstat (limited to 'tests/phpunit/integration/includes')
-rw-r--r-- | tests/phpunit/integration/includes/Rest/Handler/TransformHandlerTest.php | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/tests/phpunit/integration/includes/Rest/Handler/TransformHandlerTest.php b/tests/phpunit/integration/includes/Rest/Handler/TransformHandlerTest.php index 439468f5ae07..3a5488c85c20 100644 --- a/tests/phpunit/integration/includes/Rest/Handler/TransformHandlerTest.php +++ b/tests/phpunit/integration/includes/Rest/Handler/TransformHandlerTest.php @@ -36,7 +36,6 @@ class TransformHandlerTest extends MediaWikiIntegrationTestCase { $request = new RequestData( [ 'pathParams' => [ 'from' => ParsoidFormatHelper::FORMAT_WIKITEXT, - 'format' => ParsoidFormatHelper::FORMAT_HTML, ], 'bodyContents' => json_encode( [ 'wikitext' => '== h2 ==', @@ -48,13 +47,13 @@ class TransformHandlerTest extends MediaWikiIntegrationTestCase { '>h2</h2>', 200, [ 'content-type' => $htmlContentType ], + [ 'format' => ParsoidFormatHelper::FORMAT_HTML ] ]; // Convert HTML to wikitext //////////////////////////////////////////////////////////////// $request = new RequestData( [ 'pathParams' => [ 'from' => ParsoidFormatHelper::FORMAT_HTML, - 'format' => ParsoidFormatHelper::FORMAT_WIKITEXT, ], 'bodyContents' => json_encode( [ 'html' => '<pre>hi ho</pre>', @@ -66,13 +65,13 @@ class TransformHandlerTest extends MediaWikiIntegrationTestCase { 'hi ho', 200, [ 'content-type' => "text/plain; charset=utf-8; profile=\"$wikitextProfileUri\"" ], + [ 'format' => ParsoidFormatHelper::FORMAT_WIKITEXT ] ]; // Perform language variant conversion ////////////////////////////////////////////////////// $request = new RequestData( [ 'pathParams' => [ 'from' => ParsoidFormatHelper::FORMAT_PAGEBUNDLE, - 'format' => ParsoidFormatHelper::FORMAT_PAGEBUNDLE, ], 'bodyContents' => json_encode( [ // NOTE: input for pb2pb is expected in the 'original' structure for some reason @@ -110,6 +109,7 @@ class TransformHandlerTest extends MediaWikiIntegrationTestCase { // NOTE: Parsoid returns a content-language header in the page bundle, // but that header is not applied to the HTTP response, which is JSON. [ 'content-type' => $pbContentType ], + [ 'format' => ParsoidFormatHelper::FORMAT_PAGEBUNDLE ] ]; } @@ -121,7 +121,8 @@ class TransformHandlerTest extends MediaWikiIntegrationTestCase { RequestInterface $request, $expectedText, $expectedStatus = 200, - $expectedHeaders = [] + $expectedHeaders = [], + $config = [] ) { $this->overrideConfigValue( MainConfigNames::UsePigLatinVariant, true ); @@ -136,7 +137,7 @@ class TransformHandlerTest extends MediaWikiIntegrationTestCase { $pageConfigFactory, $dataAccess ); - $response = $this->executeHandler( $handler, $request ); + $response = $this->executeHandler( $handler, $request, $config ); $response->getBody()->rewind(); $data = $response->getBody()->getContents(); |