sveneld commented on code in PR #2951: URL: https://github.com/apache/thrift/pull/2951#discussion_r1536763510
########## lib/php/test/Integration/Lib/Protocol/TJSONProtocolTest.php: ########## @@ -0,0 +1,638 @@ +<?php + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +namespace Test\Thrift\Integration\Lib\Protocol; + +use PHPUnit\Framework\TestCase; +use Thrift\Protocol\TJSONProtocol; +use Thrift\Transport\TMemoryBuffer; +use Basic\ThriftTest\Insanity; +use Basic\ThriftTest\Numberz; +use Basic\ThriftTest\Xtruct; +use Basic\ThriftTest\Xtruct2; + +/*** + * This test suite depends on running the compiler against the ./Resources/ThriftTest.thrift file: + * lib/php/test$ ../../../compiler/cpp/thrift --gen php:nsglobal="Basic" -r --out ./Resources/packages/php ./Resources/ThriftTest.thrift + */ +class TJSONProtocolTest extends TestCase +{ + private const BUFFER_SIZE = 8192; //big enough to read biggest serialized Fixture arg. + + private $transport; + private $protocol; + + public static function setUpBeforeClass(): void + { + if (!is_dir(__DIR__ . '/../../../Resources/packages/php')) { + self::fail( + 'Before running Integration test suite, you must run the Thrift compiler against the ThriftTest.thrift file in the ./Resources directory.' + ); + } + } + + public function setUp(): void + { + $this->transport = new TMemoryBuffer(); + $this->protocol = new TJSONProtocol($this->transport); + $this->transport->open(); + } + + /** + * @dataProvider writeDataProvider + */ + public function testWrite( Review Comment: change original class from using separate class of Fixtures to using data provider. It's more readable -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
