summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/php/test/Fixtures.php224
-rw-r--r--lib/php/test/JsonSerialize/JsonSerializeTest.php155
-rwxr-xr-xlib/php/test/Makefile.am9
-rw-r--r--lib/php/test/Protocol/BinarySerializerTest.php (renamed from lib/php/test/Protocol/TestBinarySerializer.php)47
-rw-r--r--lib/php/test/Protocol/TJSONProtocolFixtures.php74
-rw-r--r--lib/php/test/Protocol/TJSONProtocolTest.php519
-rw-r--r--lib/php/test/Protocol/TSimpleJSONProtocolFixtures.php67
-rw-r--r--lib/php/test/Protocol/TSimpleJSONProtocolTest.php254
-rw-r--r--lib/php/test/Protocol/TestTJSONProtocol.php581
-rw-r--r--lib/php/test/Protocol/TestTSimpleJSONProtocol.php298
-rw-r--r--lib/php/test/TestValidators.php155
-rw-r--r--lib/php/test/Validator/BaseValidatorTest.php154
-rw-r--r--lib/php/test/Validator/ValidatorTest.php42
-rw-r--r--lib/php/test/Validator/ValidatorTestOop.php42
-rw-r--r--phpcs.xml.dist15
15 files changed, 1380 insertions, 1256 deletions
diff --git a/lib/php/test/Fixtures.php b/lib/php/test/Fixtures.php
index 2c60a08f9..fd57d831c 100644
--- a/lib/php/test/Fixtures.php
+++ b/lib/php/test/Fixtures.php
@@ -30,165 +30,165 @@ use ThriftTest\Insanity;
class Fixtures
{
- public static $testArgs = array();
+ public static $bufsize = 8192; //big enough to read biggest serialized Fixture arg.
+ public static $testArgs = array();
- public static function populateTestArgs()
- {
- self::$testArgs['testString1'] = "Afrikaans, Alemannisch, Aragonés, العربية, مصرى, Asturianu, Aymar aru, Azərbaycan, Башҡорт, Boarisch, Žemaitėška, Беларуская, Беларуская (тарашкевіца), Български, Bamanankan, বাংলা, Brezhoneg, Bosanski, Català, Mìng-dĕ̤ng-ngṳ̄, Нохчийн, Cebuano, ᏣᎳᎩ, Česky, Словѣ́ньскъ / ⰔⰎⰑⰂⰡⰐⰠⰔⰍⰟ, Чӑвашла, Cymraeg, Dansk, Zazaki, ދިވެހިބަސް, Ελληνικά, Emiliàn e rumagnòl, English, Esperanto, Español, Eesti, Euskara, فارسی, Suomi, Võro, Føroyskt, Français, Arpetan, Furlan, Frysk, Gaeilge, 贛語, Gàidhlig, Galego, Avañe'ẽ, ગુજરાતી, Gaelg, עברית, हिन्दी, Fiji Hindi, Hrvatski, Kreyòl ayisyen, Magyar, Հայերեն, Interlingua, Bahasa Indonesia, Ilokano, Ido, Íslenska, Italiano, 日本語, Lojban, Basa Jawa, ქართული, Kongo, Kalaallisut, ಕನ್ನಡ, 한국어, Къарачай-Малкъар, Ripoarisch, Kurdî, Коми, Kernewek, Кыргызча, Latina, Ladino, Lëtzebuergesch, Limburgs, Lingála, ລາວ, Lietuvių, Latviešu, Basa Banyumasan, Malagasy, Македонски, മലയാളം, मराठी, Bahasa Melayu, مازِرونی, Nnapulitano, Nedersaksisch, नेपाल भाषा, Nederlands, ‪Norsk (nynorsk)‬, ‪Norsk (bokmål)‬, Nouormand, Diné bizaad, Occitan, Иронау, Papiamentu, Deitsch, Norfuk / Pitkern, Polski, پنجابی, پښتو, Português, Runa Simi, Rumantsch, Romani, Română, Русский, Саха тыла, Sardu, Sicilianu, Scots, Sámegiella, Simple English, Slovenčina, Slovenščina, Српски / Srpski, Seeltersk, Svenska, Kiswahili, தமிழ், తెలుగు, Тоҷикӣ, ไทย, Türkmençe, Tagalog, Türkçe, Татарча/Tatarça, Українська, اردو, Tiếng Việt, Volapük, Walon, Winaray, 吴语, isiXhosa, ייִדיש, Yorùbá, Zeêuws, 中文, Bân-lâm-gú, 粵語";
+ public static function populateTestArgs()
+ {
+ self::$testArgs['testString1'] = "Afrikaans, Alemannisch, Aragonés, العربية, مصرى, Asturianu, Aymar aru, Azərbaycan, Башҡорт, Boarisch, Žemaitėška, Беларуская, Беларуская (тарашкевіца), Български, Bamanankan, বাংলা, Brezhoneg, Bosanski, Català, Mìng-dĕ̤ng-ngṳ̄, Нохчийн, Cebuano, ᏣᎳᎩ, Česky, Словѣ́ньскъ / ⰔⰎⰑⰂⰡⰐⰠⰔⰍⰟ, Чӑвашла, Cymraeg, Dansk, Zazaki, ދިވެހިބަސް, Ελληνικά, Emiliàn e rumagnòl, English, Esperanto, Español, Eesti, Euskara, فارسی, Suomi, Võro, Føroyskt, Français, Arpetan, Furlan, Frysk, Gaeilge, 贛語, Gàidhlig, Galego, Avañe'ẽ, ગુજરાતી, Gaelg, עברית, हिन्दी, Fiji Hindi, Hrvatski, Kreyòl ayisyen, Magyar, Հայերեն, Interlingua, Bahasa Indonesia, Ilokano, Ido, Íslenska, Italiano, 日本語, Lojban, Basa Jawa, ქართული, Kongo, Kalaallisut, ಕನ್ನಡ, 한국어, Къарачай-Малкъар, Ripoarisch, Kurdî, Коми, Kernewek, Кыргызча, Latina, Ladino, Lëtzebuergesch, Limburgs, Lingála, ລາວ, Lietuvių, Latviešu, Basa Banyumasan, Malagasy, Македонски, മലയാളം, मराठी, Bahasa Melayu, مازِرونی, Nnapulitano, Nedersaksisch, नेपाल भाषा, Nederlands, ‪Norsk (nynorsk)‬, ‪Norsk (bokmål)‬, Nouormand, Diné bizaad, Occitan, Иронау, Papiamentu, Deitsch, Norfuk / Pitkern, Polski, پنجابی, پښتو, Português, Runa Simi, Rumantsch, Romani, Română, Русский, Саха тыла, Sardu, Sicilianu, Scots, Sámegiella, Simple English, Slovenčina, Slovenščina, Српски / Srpski, Seeltersk, Svenska, Kiswahili, தமிழ், తెలుగు, Тоҷикӣ, ไทย, Türkmençe, Tagalog, Türkçe, Татарча/Tatarça, Українська, اردو, Tiếng Việt, Volapük, Walon, Winaray, 吴语, isiXhosa, ייִדיש, Yorùbá, Zeêuws, 中文, Bân-lâm-gú, 粵語";
- self::$testArgs['testString2'] =
- "quote: \\\" backslash:" .
- " forwardslash-escaped: \\/ " .
- " backspace: \b formfeed: \f newline: \n return: \r tab: " .
- " now-all-of-them-together: \"\\\/\b\n\r\t" .
- " now-a-bunch-of-junk: !@#\$%&()(&%$#{}{}<><><";
+ self::$testArgs['testString2'] =
+ "quote: \\\" backslash:" .
+ " forwardslash-escaped: \\/ " .
+ " backspace: \b formfeed: \f newline: \n return: \r tab: " .
+ " now-all-of-them-together: \"\\\/\b\n\r\t" .
+ " now-a-bunch-of-junk: !@#\$%&()(&%$#{}{}<><><";
- self::$testArgs['testString3'] =
- "string that ends in double-backslash \\\\";
+ self::$testArgs['testString3'] =
+ "string that ends in double-backslash \\\\";
- self::$testArgs['testUnicodeStringWithNonBMP'] =
- "สวัสดี/𝒯";
+ self::$testArgs['testUnicodeStringWithNonBMP'] =
+ "สวัสดี/𝒯";
- self::$testArgs['testDouble'] = 3.1415926535898;
+ self::$testArgs['testDouble'] = 3.1415926535898;
- // TODO: add testBinary() call
-
- self::$testArgs['testByte'] = 0x01;
+ // TODO: add testBinary() call
- self::$testArgs['testI32'] = pow( 2, 30 );
+ self::$testArgs['testByte'] = 0x01;
- if (PHP_INT_SIZE == 8) {
- self::$testArgs['testI64'] = pow( 2, 60 );
- } else {
- self::$testArgs['testI64'] = "1152921504606847000";
- }
+ self::$testArgs['testI32'] = pow(2, 30);
- self::$testArgs['testStruct'] =
- new Xtruct(
- array(
+ if (PHP_INT_SIZE == 8) {
+ self::$testArgs['testI64'] = pow(2, 60);
+ } else {
+ self::$testArgs['testI64'] = "1152921504606847000";
+ }
+
+ self::$testArgs['testStruct'] =
+ new Xtruct(
+ array(
'string_thing' => 'worked',
'byte_thing' => 0x01,
- 'i32_thing' => pow( 2, 30 ),
+ 'i32_thing' => pow(2, 30),
'i64_thing' => self::$testArgs['testI64']
- )
+ )
);
- self::$testArgs['testNestNested'] =
- new Xtruct(
- array(
+ self::$testArgs['testNestNested'] =
+ new Xtruct(
+ array(
'string_thing' => 'worked',
'byte_thing' => 0x01,
- 'i32_thing' => pow( 2, 30 ),
+ 'i32_thing' => pow(2, 30),
'i64_thing' => self::$testArgs['testI64']
- )
+ )
);
- self::$testArgs['testNest'] =
- new Xtruct2(
- array(
- 'byte_thing' => 0x01,
- 'struct_thing' => self::$testArgs['testNestNested'],
- 'i32_thing' => pow( 2, 15 )
+ self::$testArgs['testNest'] =
+ new Xtruct2(
+ array(
+ 'byte_thing' => 0x01,
+ 'struct_thing' => self::$testArgs['testNestNested'],
+ 'i32_thing' => pow(2, 15)
)
);
- self::$testArgs['testMap'] =
- array(
- 7 => 77,
- 8 => 88,
- 9 => 99
+ self::$testArgs['testMap'] =
+ array(
+ 7 => 77,
+ 8 => 88,
+ 9 => 99
);
- self::$testArgs['testStringMap'] =
- array(
- "a" => "123",
- "a b" => "with spaces ",
- "same" => "same",
- "0" => "numeric key",
- "longValue" => self::$testArgs['testString1'],
- self::$testArgs['testString1'] => "long key"
+ self::$testArgs['testStringMap'] =
+ array(
+ "a" => "123",
+ "a b" => "with spaces ",
+ "same" => "same",
+ "0" => "numeric key",
+ "longValue" => self::$testArgs['testString1'],
+ self::$testArgs['testString1'] => "long key"
);
- self::$testArgs['testSet'] = array( 1 => true, 5 => true, 6 => true );
+ self::$testArgs['testSet'] = array(1 => true, 5 => true, 6 => true);
- self::$testArgs['testList'] = array( 1, 2, 3 );
+ self::$testArgs['testList'] = array(1, 2, 3);
- self::$testArgs['testEnum'] = Numberz::ONE;
+ self::$testArgs['testEnum'] = Numberz::ONE;
- self::$testArgs['testTypedef'] = 69;
+ self::$testArgs['testTypedef'] = 69;
- self::$testArgs['testMapMapExpectedResult'] =
- array(
- 4 => array(
- 1 => 1,
- 2 => 2,
- 3 => 3,
- 4 => 4,
- ),
- -4 => array(
- -4 => -4,
- -3 => -3,
- -2 => -2,
- -1 => -1
- )
+ self::$testArgs['testMapMapExpectedResult'] =
+ array(
+ 4 => array(
+ 1 => 1,
+ 2 => 2,
+ 3 => 3,
+ 4 => 4,
+ ),
+ -4 => array(
+ -4 => -4,
+ -3 => -3,
+ -2 => -2,
+ -1 => -1
+ )
);
- // testInsanity ... takes a few steps to set up!
+ // testInsanity ... takes a few steps to set up!
- $xtruct1 =
- new Xtruct(
- array(
- 'string_thing' => 'Goodbye4',
- 'byte_thing' => 4,
- 'i32_thing' => 4,
- 'i64_thing' => 4
+ $xtruct1 =
+ new Xtruct(
+ array(
+ 'string_thing' => 'Goodbye4',
+ 'byte_thing' => 4,
+ 'i32_thing' => 4,
+ 'i64_thing' => 4
)
);
- $xtruct2 =
- new Xtruct(
- array(
- 'string_thing' => 'Hello2',
- 'byte_thing' =>2,
- 'i32_thing' => 2,
- 'i64_thing' => 2
+ $xtruct2 =
+ new Xtruct(
+ array(
+ 'string_thing' => 'Hello2',
+ 'byte_thing' => 2,
+ 'i32_thing' => 2,
+ 'i64_thing' => 2
)
);
- $userMap =
- array(
- Numberz::FIVE => 5,
- Numberz::EIGHT => 8
+ $userMap =
+ array(
+ Numberz::FIVE => 5,
+ Numberz::EIGHT => 8
);
- $insanity2 =
- new Insanity(
- array(
- 'userMap' => $userMap,
- 'xtructs' => array($xtruct1,$xtruct2)
+ $insanity2 =
+ new Insanity(
+ array(
+ 'userMap' => $userMap,
+ 'xtructs' => array($xtruct1, $xtruct2)
)
);
- $insanity3 = $insanity2;
+ $insanity3 = $insanity2;
- $insanity6 =
- new Insanity(
- array(
- 'userMap' => null,
- 'xtructs' => null
+ $insanity6 =
+ new Insanity(
+ array(
+ 'userMap' => null,
+ 'xtructs' => null
)
);
- self::$testArgs['testInsanityExpectedResult'] =
- array(
- "1" => array(
- Numberz::TWO => $insanity2,
- Numberz::THREE => $insanity3
- ),
- "2" => array(
- Numberz::SIX => $insanity6
- )
+ self::$testArgs['testInsanityExpectedResult'] =
+ array(
+ "1" => array(
+ Numberz::TWO => $insanity2,
+ Numberz::THREE => $insanity3
+ ),
+ "2" => array(
+ Numberz::SIX => $insanity6
+ )
);
-
- }
+ }
}
diff --git a/lib/php/test/JsonSerialize/JsonSerializeTest.php b/lib/php/test/JsonSerialize/JsonSerializeTest.php
index dfb34c3b7..8c6459560 100644
--- a/lib/php/test/JsonSerialize/JsonSerializeTest.php
+++ b/lib/php/test/JsonSerialize/JsonSerializeTest.php
@@ -20,95 +20,98 @@
namespace Test\Thrift\JsonSerialize;
+use PHPUnit\Framework\TestCase;
use stdClass;
use Thrift\ClassLoader\ThriftClassLoader;
-require_once __DIR__.'/../../../../vendor/autoload.php';
+require_once __DIR__ . '/../../../../vendor/autoload.php';
-$loader = new ThriftClassLoader();
-$loader->registerDefinition('ThriftTest', __DIR__ . '/../packages/phpjs');
-$loader->register();
-
-class JsonSerializeTest extends \PHPUnit_Framework_TestCase
+/**
+ * @runTestsInSeparateProcesses
+ */
+class JsonSerializeTest extends TestCase
{
- protected function setUp() {
- if (version_compare(phpversion(), '5.4', '<')) {
- $this->markTestSkipped('Requires PHP 5.4 or newer!');
+ protected function setUp()
+ {
+ if (version_compare(phpversion(), '5.4', '<')) {
+ $this->markTestSkipped('Requires PHP 5.4 or newer!');
+ }
+ $loader = new ThriftClassLoader();
+ $loader->registerDefinition('ThriftTest', __DIR__ . '/../packages/phpjs');
+ $loader->register();
}
- }
-
- public function testEmptyStruct()
- {
- $empty = new \ThriftTest\EmptyStruct(array('non_existing_key' => 'bar'));
- $this->assertEquals(new stdClass(), json_decode(json_encode($empty)));
- }
- public function testStringsAndInts()
- {
- $input = array(
- 'string_thing' => 'foo',
- 'i64_thing' => 1234567890,
- );
- $xtruct = new \ThriftTest\Xtruct($input);
+ public function testEmptyStruct()
+ {
+ $empty = new \ThriftTest\EmptyStruct(array('non_existing_key' => 'bar'));
+ $this->assertEquals(new stdClass(), json_decode(json_encode($empty)));
+ }
- // Xtruct's 'i32_thing' and 'byte_thing' fields should not be present here!
- $expected = new stdClass();
- $expected->string_thing = $input['string_thing'];
- $expected->i64_thing = $input['i64_thing'];
- $this->assertEquals($expected, json_decode(json_encode($xtruct)));
- }
+ public function testStringsAndInts()
+ {
+ $input = array(
+ 'string_thing' => 'foo',
+ 'i64_thing' => 1234567890,
+ );
+ $xtruct = new \ThriftTest\Xtruct($input);
- public function testNestedStructs()
- {
- $xtruct2 = new \ThriftTest\Xtruct2(array(
- 'byte_thing' => 42,
- 'struct_thing' => new \ThriftTest\Xtruct(array(
- 'i32_thing' => 123456,
- )),
- ));
+ // Xtruct's 'i32_thing' and 'byte_thing' fields should not be present here!
+ $expected = new stdClass();
+ $expected->string_thing = $input['string_thing'];
+ $expected->i64_thing = $input['i64_thing'];
+ $this->assertEquals($expected, json_decode(json_encode($xtruct)));
+ }
- $expected = new stdClass();
- $expected->byte_thing = $xtruct2->byte_thing;
- $expected->struct_thing = new stdClass();
- $expected->struct_thing->i32_thing = $xtruct2->struct_thing->i32_thing;
- $this->assertEquals($expected, json_decode(json_encode($xtruct2)));
- }
+ public function testNestedStructs()
+ {
+ $xtruct2 = new \ThriftTest\Xtruct2(array(
+ 'byte_thing' => 42,
+ 'struct_thing' => new \ThriftTest\Xtruct(array(
+ 'i32_thing' => 123456,
+ )),
+ ));
- public function testInsanity()
- {
- $xinput = array('string_thing' => 'foo');
- $xtruct = new \ThriftTest\Xtruct($xinput);
- $insanity = new \ThriftTest\Insanity(array(
- 'xtructs' => array($xtruct, $xtruct, $xtruct)
- ));
- $expected = new stdClass();
- $expected->xtructs = array((object) $xinput, (object) $xinput, (object) $xinput);
- $this->assertEquals($expected, json_decode(json_encode($insanity)));
- }
+ $expected = new stdClass();
+ $expected->byte_thing = $xtruct2->byte_thing;
+ $expected->struct_thing = new stdClass();
+ $expected->struct_thing->i32_thing = $xtruct2->struct_thing->i32_thing;
+ $this->assertEquals($expected, json_decode(json_encode($xtruct2)));
+ }
- public function testNestedLists()
- {
- $bonk = new \ThriftTest\Bonk(array('message' => 'foo'));
- $nested = new \ThriftTest\NestedListsBonk(array('bonk' => array(array(array($bonk)))));
- $expected = new stdClass();
- $expected->bonk = array(array(array((object) array('message' => 'foo'))));
- $this->assertEquals($expected, json_decode(json_encode($nested)));
- }
+ public function testInsanity()
+ {
+ $xinput = array('string_thing' => 'foo');
+ $xtruct = new \ThriftTest\Xtruct($xinput);
+ $insanity = new \ThriftTest\Insanity(array(
+ 'xtructs' => array($xtruct, $xtruct, $xtruct)
+ ));
+ $expected = new stdClass();
+ $expected->xtructs = array((object)$xinput, (object)$xinput, (object)$xinput);
+ $this->assertEquals($expected, json_decode(json_encode($insanity)));
+ }
- public function testMaps()
- {
- $intmap = new \ThriftTest\ThriftTest_testMap_args(['thing' => [0 => 'zero']]);
- $emptymap = new \ThriftTest\ThriftTest_testMap_args([]);
- $this->assertEquals('{"thing":{"0":"zero"}}', json_encode($intmap));
- $this->assertEquals('{}', json_encode($emptymap));
- }
+ public function testNestedLists()
+ {
+ $bonk = new \ThriftTest\Bonk(array('message' => 'foo'));
+ $nested = new \ThriftTest\NestedListsBonk(array('bonk' => array(array(array($bonk)))));
+ $expected = new stdClass();
+ $expected->bonk = array(array(array((object)array('message' => 'foo'))));
+ $this->assertEquals($expected, json_decode(json_encode($nested)));
+ }
- public function testScalarTypes()
- {
- $b = new \ThriftTest\Bools(['im_true' => '1', 'im_false' => '0']);
- $this->assertEquals('{"im_true":true,"im_false":false}', json_encode($b));
- $s = new \ThriftTest\StructA(['s' => 42]);
- $this->assertEquals('{"s":"42"}', json_encode($s));
- }
+ public function testMaps()
+ {
+ $intmap = new \ThriftTest\ThriftTest_testMap_args(['thing' => [0 => 'zero']]);
+ $emptymap = new \ThriftTest\ThriftTest_testMap_args([]);
+ $this->assertEquals('{"thing":{"0":"zero"}}', json_encode($intmap));
+ $this->assertEquals('{}', json_encode($emptymap));
+ }
+ public function testScalarTypes()
+ {
+ $b = new \ThriftTest\Bools(['im_true' => '1', 'im_false' => '0']);
+ $this->assertEquals('{"im_true":true,"im_false":false}', json_encode($b));
+ $s = new \ThriftTest\StructA(['s' => 42]);
+ $this->assertEquals('{"s":"42"}', json_encode($s));
+ }
}
diff --git a/lib/php/test/Makefile.am b/lib/php/test/Makefile.am
index 5658afa26..5c86e3564 100755
--- a/lib/php/test/Makefile.am
+++ b/lib/php/test/Makefile.am
@@ -35,16 +35,13 @@ deps: $(top_srcdir)/composer.json
all-local: deps
check-json-serializer: deps stubs
- $(PHPUNIT) --log-junit=TEST-json-serializer.xml JsonSerialize/
+ $(PHPUNIT) --log-junit=TEST-log-json-serializer.xml JsonSerialize/
check-validator: deps stubs
- php TestValidators.php
- php TestValidators.php -oop
+ $(PHPUNIT) --log-junit=TEST-log-validator.xml Validator/
check-protocol: deps stubs
- $(PHPUNIT) --log-junit=TEST-log-json-protocol.xml Protocol/TestTJSONProtocol.php
- $(PHPUNIT) --log-junit=TEST-binary-serializer.xml Protocol/TestBinarySerializer.php
- $(PHPUNIT) --log-junit=TEST-log-simple-json-protocol.xml Protocol/TestTSimpleJSONProtocol.php
+ $(PHPUNIT) --log-junit=TEST-log-protocol.xml Protocol/
check: deps stubs \
check-protocol \
diff --git a/lib/php/test/Protocol/TestBinarySerializer.php b/lib/php/test/Protocol/BinarySerializerTest.php
index e08057b4f..7e8728012 100644
--- a/lib/php/test/Protocol/TestBinarySerializer.php
+++ b/lib/php/test/Protocol/BinarySerializerTest.php
@@ -23,14 +23,11 @@
namespace Test\Thrift\Protocol;
+use PHPUnit\Framework\TestCase;
use Thrift\ClassLoader\ThriftClassLoader;
use Thrift\Serializer\TBinarySerializer;
-require_once __DIR__.'/../../../../vendor/autoload.php';
-
-$loader = new ThriftClassLoader();
-$loader->registerDefinition('ThriftTest', __DIR__ . '/../packages');
-$loader->register();
+require_once __DIR__ . '/../../../../vendor/autoload.php';
/***
* This test suite depends on running the compiler against the
@@ -38,25 +35,27 @@ $loader->register();
*
* lib/php/test$ ../../../compiler/cpp/thrift --gen php -r \
* --out ./packages ../../../test/ThriftTest.thrift
+ *
+ * @runTestsInSeparateProcesses
*/
-
-class TestBinarySerializer extends \PHPUnit_Framework_TestCase
+class BinarySerializerTest extends TestCase
{
-
- public function setUp()
- {
- }
-
- /**
- * We try to serialize and deserialize a random object to make sure no exceptions are thrown.
- * @see THRIFT-1579
- */
- public function testBinarySerializer()
- {
- $struct = new \ThriftTest\Xtruct(array('string_thing' => 'abc'));
- $serialized = TBinarySerializer::serialize($struct, 'ThriftTest\\Xtruct');
- $deserialized = TBinarySerializer::deserialize($serialized, 'ThriftTest\\Xtruct');
- $this->assertEquals($struct, $deserialized);
- }
-
+ public function setUp()
+ {
+ $loader = new ThriftClassLoader();
+ $loader->registerDefinition('ThriftTest', __DIR__ . '/../packages');
+ $loader->register();
+ }
+
+ /**
+ * We try to serialize and deserialize a random object to make sure no exceptions are thrown.
+ * @see THRIFT-1579
+ */
+ public function testBinarySerializer()
+ {
+ $struct = new \ThriftTest\Xtruct(array('string_thing' => 'abc'));
+ $serialized = TBinarySerializer::serialize($struct, 'ThriftTest\\Xtruct');
+ $deserialized = TBinarySerializer::deserialize($serialized, 'ThriftTest\\Xtruct');
+ $this->assertEquals($struct, $deserialized);
+ }
}
diff --git a/lib/php/test/Protocol/TJSONProtocolFixtures.php b/lib/php/test/Protocol/TJSONProtocolFixtures.php
new file mode 100644
index 000000000..dd9039fca
--- /dev/null
+++ b/lib/php/test/Protocol/TJSONProtocolFixtures.php
@@ -0,0 +1,74 @@
+<?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.
+ *
+ * @package thrift.test
+ */
+
+namespace Test\Thrift\Protocol;
+
+class TJSONProtocolFixtures
+{
+ public static $testArgsJSON = array();
+
+ public static function populateTestArgsJSON()
+ {
+ self::$testArgsJSON['testVoid'] = '{}';
+
+ self::$testArgsJSON['testString1'] = '{"1":{"str":"Afrikaans, Alemannisch, Aragonés, العربية, مصرى, Asturianu, Aymar aru, Azərbaycan, Башҡорт, Boarisch, Žemaitėška, Беларуская, Беларуская (тарашкевіца), Български, Bamanankan, বাংলা, Brezhoneg, Bosanski, Català, Mìng-dĕ̤ng-ngṳ̄, Нохчийн, Cebuano, ᏣᎳᎩ, Česky, Словѣ́ньскъ \/ ⰔⰎⰑⰂⰡⰐⰠⰔⰍⰟ, Чӑвашла, Cymraeg, Dansk, Zazaki, ދިވެހިބަސް, Ελληνικά, Emiliàn e rumagnòl, English, Esperanto, Español, Eesti, Euskara, فارسی, Suomi, Võro, Føroyskt, Français, Arpetan, Furlan, Frysk, Gaeilge, 贛語, Gàidhlig, Galego, Avañe\'ẽ, ગુજરાતી, Gaelg, עברית, हिन्दी, Fiji Hindi, Hrvatski, Kreyòl ayisyen, Magyar, Հայերեն, Interlingua, Bahasa Indonesia, Ilokano, Ido, Íslenska, Italiano, 日本語, Lojban, Basa Jawa, ქართული, Kongo, Kalaallisut, ಕನ್ನಡ, 한국어, Къарачай-Малкъар, Ripoarisch, Kurdî, Коми, Kernewek, Кыргызча, Latina, Ladino, Lëtzebuergesch, Limburgs, Lingála, ລາວ, Lietuvių, Latviešu, Basa Banyumasan, Malagasy, Македонски, മലയാളം, मराठी, Bahasa Melayu, مازِرونی, Nnapulitano, Nedersaksisch, नेपाल भाषा, Nederlands, ‪Norsk (nynorsk)‬, ‪Norsk (bokmål)‬, Nouormand, Diné bizaad, Occitan, Иронау, Papiamentu, Deitsch, Norfuk \/ Pitkern, Polski, پنجابی, پښتو, Português, Runa Simi, Rumantsch, Romani, Română, Русский, Саха тыла, Sardu, Sicilianu, Scots, Sámegiella, Simple English, Slovenčina, Slovenščina, Српски \/ Srpski, Seeltersk, Svenska, Kiswahili, தமிழ், తెలుగు, Тоҷикӣ, ไทย, Türkmençe, Tagalog, Türkçe, Татарча\/Tatarça, Українська, اردو, Tiếng Việt, Volapük, Walon, Winaray, 吴语, isiXhosa, ייִדיש, Yorùbá, Zeêuws, 中文, Bân-lâm-gú, 粵語"}}';
+
+ self::$testArgsJSON['testString2'] = '{"1":{"str":"quote: \\\\\" backslash: forwardslash-escaped: \\\\\/ backspace: \\\\b formfeed: \f newline: \n return: \r tab: now-all-of-them-together: \"\\\\\\\\\/\\\\b\n\r\t now-a-bunch-of-junk: !@#$%&()(&%$#{}{}<><><"}}';
+
+ self::$testArgsJSON['testString3'] = '{"1":{"str":"string that ends in double-backslash \\\\\\\\"}}';
+
+ self::$testArgsJSON['testUnicodeStringWithNonBMP'] = '{"1":{"str":"สวัสดี\/𝒯"}}';
+
+ self::$testArgsJSON['testDouble'] = '{"1":{"dbl":3.1415926535898}}';
+
+ self::$testArgsJSON['testByte'] = '{"1":{"i8":1}}';
+
+ self::$testArgsJSON['testI32'] = '{"1":{"i32":1073741824}}';
+
+ if (PHP_INT_SIZE == 8) {
+ self::$testArgsJSON['testI64'] = '{"1":{"i64":' . pow(2, 60) . '}}';
+ self::$testArgsJSON['testStruct'] = '{"1":{"rec":{"1":{"str":"worked"},"4":{"i8":1},"9":{"i32":1073741824},"11":{"i64":' . pow(2, 60) . '}}}}';
+ self::$testArgsJSON['testNest'] = '{"1":{"rec":{"1":{"i8":1},"2":{"rec":{"1":{"str":"worked"},"4":{"i8":1},"9":{"i32":1073741824},"11":{"i64":' . pow(2, 60) . '}}},"3":{"i32":32768}}}}';
+ } else {
+ self::$testArgsJSON['testI64'] = '{"1":{"i64":1152921504606847000}}';
+ self::$testArgsJSON['testStruct'] = '{"1":{"rec":{"1":{"str":"worked"},"4":{"i8":1},"9":{"i32":1073741824},"11":{"i64":1152921504606847000}}}}';
+ self::$testArgsJSON['testNest'] = '{"1":{"rec":{"1":{"i8":1},"2":{"rec":{"1":{"str":"worked"},"4":{"i8":1},"9":{"i32":1073741824},"11":{"i64":1152921504606847000}}},"3":{"i32":32768}}}}';
+ }
+
+ self::$testArgsJSON['testMap'] = '{"1":{"map":["i32","i32",3,{"7":77,"8":88,"9":99}]}}';
+
+ self::$testArgsJSON['testStringMap'] = '{"1":{"map":["str","str",6,{"a":"123","a b":"with spaces ","same":"same","0":"numeric key","longValue":"Afrikaans, Alemannisch, Aragon\u00e9s, \u0627\u0644\u0639\u0631\u0628\u064a\u0629, \u0645\u0635\u0631\u0649, Asturianu, Aymar aru, Az\u0259rbaycan, \u0411\u0430\u0448\u04a1\u043e\u0440\u0442, Boarisch, \u017demait\u0117\u0161ka, \u0411\u0435\u043b\u0430\u0440\u0443\u0441\u043a\u0430\u044f, \u0411\u0435\u043b\u0430\u0440\u0443\u0441\u043a\u0430\u044f (\u0442\u0430\u0440\u0430\u0448\u043a\u0435\u0432\u0456\u0446\u0430), \u0411\u044a\u043b\u0433\u0430\u0440\u0441\u043a\u0438, Bamanankan, \u09ac\u09be\u0982\u09b2\u09be, Brezhoneg, Bosanski, Catal\u00e0, M\u00ecng-d\u0115\u0324ng-ng\u1e73\u0304, \u041d\u043e\u0445\u0447\u0438\u0439\u043d, Cebuano, \u13e3\u13b3\u13a9, \u010cesky, \u0421\u043b\u043e\u0432\u0463\u0301\u043d\u044c\u0441\u043a\u044a \/ \u2c14\u2c0e\u2c11\u2c02\u2c21\u2c10\u2c20\u2c14\u2c0d\u2c1f, \u0427\u04d1\u0432\u0430\u0448\u043b\u0430, Cymraeg, Dansk, Zazaki, \u078b\u07a8\u0788\u07ac\u0780\u07a8\u0784\u07a6\u0790\u07b0, \u0395\u03bb\u03bb\u03b7\u03bd\u03b9\u03ba\u03ac, Emili\u00e0n e rumagn\u00f2l, English, Esperanto, Espa\u00f1ol, Eesti, Euskara, \u0641\u0627\u0631\u0633\u06cc, Suomi, V\u00f5ro, F\u00f8royskt, Fran\u00e7ais, Arpetan, Furlan, Frysk, Gaeilge, \u8d1b\u8a9e, G\u00e0idhlig, Galego, Ava\u00f1e\'\u1ebd, \u0a97\u0ac1\u0a9c\u0ab0\u0abe\u0aa4\u0ac0, Gaelg, \u05e2\u05d1\u05e8\u05d9\u05ea, \u0939\u093f\u0928\u094d\u0926\u0940, Fiji Hindi, Hrvatski, Krey\u00f2l ayisyen, Magyar, \u0540\u0561\u0575\u0565\u0580\u0565\u0576, Interlingua, Bahasa Indonesia, Ilokano, Ido, \u00cdslenska, Italiano, \u65e5\u672c\u8a9e, Lojban, Basa Jawa, \u10e5\u10d0\u10e0\u10d7\u10e3\u10da\u10d8, Kongo, Kalaallisut, \u0c95\u0ca8\u0ccd\u0ca8\u0ca1, \ud55c\uad6d\uc5b4, \u041a\u044a\u0430\u0440\u0430\u0447\u0430\u0439-\u041c\u0430\u043b\u043a\u044a\u0430\u0440, Ripoarisch, Kurd\u00ee, \u041a\u043e\u043c\u0438, Kernewek, \u041a\u044b\u0440\u0433\u044b\u0437\u0447\u0430, Latina, Ladino, L\u00ebtzebuergesch, Limburgs, Ling\u00e1la, \u0ea5\u0eb2\u0ea7, Lietuvi\u0173, Latvie\u0161u, Basa Banyumasan, Malagasy, \u041c\u0430\u043a\u0435\u0434\u043e\u043d\u0441\u043a\u0438, \u0d2e\u0d32\u0d2f\u0d3e\u0d33\u0d02, \u092e\u0930\u093e\u0920\u0940, Bahasa Melayu, \u0645\u0627\u0632\u0650\u0631\u0648\u0646\u06cc, Nnapulitano, Nedersaksisch, \u0928\u0947\u092a\u093e\u0932 \u092d\u093e\u0937\u093e, Nederlands, \u202aNorsk (nynorsk)\u202c, \u202aNorsk (bokm\u00e5l)\u202c, Nouormand, Din\u00e9 bizaad, Occitan, \u0418\u0440\u043e\u043d\u0430\u0443, Papiamentu, Deitsch, Norfuk \/ Pitkern, Polski, \u067e\u0646\u062c\u0627\u0628\u06cc, \u067e\u069a\u062a\u0648, Portugu\u00eas, Runa Simi, Rumantsch, Romani, Rom\u00e2n\u0103, \u0420\u0443\u0441\u0441\u043a\u0438\u0439, \u0421\u0430\u0445\u0430 \u0442\u044b\u043b\u0430, Sardu, Sicilianu, Scots, S\u00e1megiella, Simple English, Sloven\u010dina, Sloven\u0161\u010dina, \u0421\u0440\u043f\u0441\u043a\u0438 \/ Srpski, Seeltersk, Svenska, Kiswahili, \u0ba4\u0bae\u0bbf\u0bb4\u0bcd, \u0c24\u0c46\u0c32\u0c41\u0c17\u0c41, \u0422\u043e\u04b7\u0438\u043a\u04e3, \u0e44\u0e17\u0e22, T\u00fcrkmen\u00e7e, Tagalog, T\u00fcrk\u00e7e, \u0422\u0430\u0442\u0430\u0440\u0447\u0430\/Tatar\u00e7a, \u0423\u043a\u0440\u0430\u0457\u043d\u0441\u044c\u043a\u0430, \u0627\u0631\u062f\u0648, Ti\u1ebfng Vi\u1ec7t, Volap\u00fck, Walon, Winaray, \u5434\u8bed, isiXhosa, \u05d9\u05d9\u05b4\u05d3\u05d9\u05e9, Yor\u00f9b\u00e1, Ze\u00eauws, \u4e2d\u6587, B\u00e2n-l\u00e2m-g\u00fa, \u7cb5\u8a9e","Afrikaans, Alemannisch, Aragon\u00e9s, \u0627\u0644\u0639\u0631\u0628\u064a\u0629, \u0645\u0635\u0631\u0649, Asturianu, Aymar aru, Az\u0259rbaycan, \u0411\u0430\u0448\u04a1\u043e\u0440\u0442, Boarisch, \u017demait\u0117\u0161ka, \u0411\u0435\u043b\u0430\u0440\u0443\u0441\u043a\u0430\u044f, \u0411\u0435\u043b\u0430\u0440\u0443\u0441\u043a\u0430\u044f (\u0442\u0430\u0440\u0430\u0448\u043a\u0435\u0432\u0456\u0446\u0430), \u0411\u044a\u043b\u0433\u0430\u0440\u0441\u043a\u0438, Bamanankan, \u09ac\u09be\u0982\u09b2\u09be, Brezhoneg, Bosanski, Catal\u00e0, M\u00ecng-d\u0115\u0324ng-ng\u1e73\u0304, \u041d\u043e\u0445\u0447\u0438\u0439\u043d, Cebuano, \u13e3\u13b3\u13a9, \u010cesky, \u0421\u043b\u043e\u0432\u0463\u0301\u043d\u044c\u0441\u043a\u044a \/ \u2c14\u2c0e\u2c11\u2c02\u2c21\u2c10\u2c20\u2c14\u2c0d\u2c1f, \u0427\u04d1\u0432\u0430\u0448\u043b\u0430, Cymraeg, Dansk, Zazaki, \u078b\u07a8\u0788\u07ac\u0780\u07a8\u0784\u07a6\u0790\u07b0, \u0395\u03bb\u03bb\u03b7\u03bd\u03b9\u03ba\u03ac, Emili\u00e0n e rumagn\u00f2l, English, Esperanto, Espa\u00f1ol, Eesti, Euskara, \u0641\u0627\u0631\u0633\u06cc, Suomi, V\u00f5ro, F\u00f8royskt, Fran\u00e7ais, Arpetan, Furlan, Frysk, Gaeilge, \u8d1b\u8a9e, G\u00e0idhlig, Galego, Ava\u00f1e\'\u1ebd, \u0a97\u0ac1\u0a9c\u0ab0\u0abe\u0aa4\u0ac0, Gaelg, \u05e2\u05d1\u05e8\u05d9\u05ea, \u0939\u093f\u0928\u094d\u0926\u0940, Fiji Hindi, Hrvatski, Krey\u00f2l ayisyen, Magyar, \u0540\u0561\u0575\u0565\u0580\u0565\u0576, Interlingua, Bahasa Indonesia, Ilokano, Ido, \u00cdslenska, Italiano, \u65e5\u672c\u8a9e, Lojban, Basa Jawa, \u10e5\u10d0\u10e0\u10d7\u10e3\u10da\u10d8, Kongo, Kalaallisut, \u0c95\u0ca8\u0ccd\u0ca8\u0ca1, \ud55c\uad6d\uc5b4, \u041a\u044a\u0430\u0440\u0430\u0447\u0430\u0439-\u041c\u0430\u043b\u043a\u044a\u0430\u0440, Ripoarisch, Kurd\u00ee, \u041a\u043e\u043c\u0438, Kernewek, \u041a\u044b\u0440\u0433\u044b\u0437\u0447\u0430, Latina, Ladino, L\u00ebtzebuergesch, Limburgs, Ling\u00e1la, \u0ea5\u0eb2\u0ea7, Lietuvi\u0173, Latvie\u0161u, Basa Banyumasan, Malagasy, \u041c\u0430\u043a\u0435\u0434\u043e\u043d\u0441\u043a\u0438, \u0d2e\u0d32\u0d2f\u0d3e\u0d33\u0d02, \u092e\u0930\u093e\u0920\u0940, Bahasa Melayu, \u0645\u0627\u0632\u0650\u0631\u0648\u0646\u06cc, Nnapulitano, Nedersaksisch, \u0928\u0947\u092a\u093e\u0932 \u092d\u093e\u0937\u093e, Nederlands, \u202aNorsk (nynorsk)\u202c, \u202aNorsk (bokm\u00e5l)\u202c, Nouormand, Din\u00e9 bizaad, Occitan, \u0418\u0440\u043e\u043d\u0430\u0443, Papiamentu, Deitsch, Norfuk \/ Pitkern, Polski, \u067e\u0646\u062c\u0627\u0628\u06cc, \u067e\u069a\u062a\u0648, Portugu\u00eas, Runa Simi, Rumantsch, Romani, Rom\u00e2n\u0103, \u0420\u0443\u0441\u0441\u043a\u0438\u0439, \u0421\u0430\u0445\u0430 \u0442\u044b\u043b\u0430, Sardu, Sicilianu, Scots, S\u00e1megiella, Simple English, Sloven\u010dina, Sloven\u0161\u010dina, \u0421\u0440\u043f\u0441\u043a\u0438 \/ Srpski, Seeltersk, Svenska, Kiswahili, \u0ba4\u0bae\u0bbf\u0bb4\u0bcd, \u0c24\u0c46\u0c32\u0c41\u0c17\u0c41, \u0422\u043e\u04b7\u0438\u043a\u04e3, \u0e44\u0e17\u0e22, T\u00fcrkmen\u00e7e, Tagalog, T\u00fcrk\u00e7e, \u0422\u0430\u0442\u0430\u0440\u0447\u0430\/Tatar\u00e7a, \u0423\u043a\u0440\u0430\u0457\u043d\u0441\u044c\u043a\u0430, \u0627\u0631\u062f\u0648, Ti\u1ebfng Vi\u1ec7t, Volap\u00fck, Walon, Winaray, \u5434\u8bed, isiXhosa, \u05d9\u05d9\u05b4\u05d3\u05d9\u05e9, Yor\u00f9b\u00e1, Ze\u00eauws, \u4e2d\u6587, B\u00e2n-l\u00e2m-g\u00fa, \u7cb5\u8a9e":"long key"}]}}';
+
+ self::$testArgsJSON['testSet'] = '{"1":{"set":["i32",3,1,5,6]}}';
+
+ self::$testArgsJSON['testList'] = '{"1":{"lst":["i32",3,1,2,3]}}';
+
+ self::$testArgsJSON['testEnum'] = '{"1":{"i32":1}}';
+
+ self::$testArgsJSON['testTypedef'] = '{"1":{"i64":69}}';
+
+ self::$testArgsJSON['testMapMap'] = '{"0":{"map":["i32","map",2,{"4":["i32","i32",4,{"1":1,"2":2,"3":3,"4":4}],"-4":["i32","i32",4,{"-4":-4,"-3":-3,"-2":-2,"-1":-1}]}]}}';
+
+ self::$testArgsJSON['testInsanity'] = '{"0":{"map":["i64","map",2,{"1":["i32","rec",2,{"2":{"1":{"map":["i32","i64",2,{"5":5,"8":8}]},"2":{"lst":["rec",2,{"1":{"str":"Goodbye4"},"4":{"i8":4},"9":{"i32":4},"11":{"i64":4}},{"1":{"str":"Hello2"},"4":{"i8":2},"9":{"i32":2},"11":{"i64":2}}]}},"3":{"1":{"map":["i32","i64",2,{"5":5,"8":8}]},"2":{"lst":["rec",2,{"1":{"str":"Goodbye4"},"4":{"i8":4},"9":{"i32":4},"11":{"i64":4}},{"1":{"str":"Hello2"},"4":{"i8":2},"9":{"i32":2},"11":{"i64":2}}]}}}],"2":["i32","rec",1,{"6":{}}]}]}}';
+ }
+}
diff --git a/lib/php/test/Protocol/TJSONProtocolTest.php b/lib/php/test/Protocol/TJSONProtocolTest.php
new file mode 100644
index 000000000..bab4389a0
--- /dev/null
+++ b/lib/php/test/Protocol/TJSONProtocolTest.php
@@ -0,0 +1,519 @@
+<?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.
+ *
+ * @package thrift.test
+ */
+
+namespace Test\Thrift\Protocol;
+
+use PHPUnit\Framework\TestCase;
+use Test\Thrift\Fixtures;
+use Thrift\ClassLoader\ThriftClassLoader;
+use Thrift\Protocol\TJSONProtocol;
+use Thrift\Transport\TMemoryBuffer;
+
+require_once __DIR__ . '/../../../../vendor/autoload.php';
+
+/***
+ * This test suite depends on running the compiler against the
+ * standard ThriftTest.thrift file:
+ *
+ * lib/php/test$ ../../../compiler/cpp/thrift --gen php -r \
+ * --out ./packages ../../../test/ThriftTest.thrift
+ *
+ * @runTestsInSeparateProcesses
+ */
+class TJSONProtocolTest extends TestCase
+{
+ private $transport;
+ private $protocol;
+
+ public static function setUpBeforeClass()
+ {
+ $loader = new ThriftClassLoader();
+ $loader->registerDefinition('ThriftTest', __DIR__ . '/../packages');
+ $loader->register();
+
+ Fixtures::populateTestArgs();
+ TJSONProtocolFixtures::populateTestArgsJSON();
+ }
+
+ public function setUp()
+ {
+ $this->transport = new TMemoryBuffer();
+ $this->protocol = new TJSONProtocol($this->transport);
+ $this->transport->open();
+ }
+
+ /**
+ * WRITE TESTS
+ */
+ public function testVoidWrite()
+ {
+ $args = new \ThriftTest\ThriftTest_testVoid_args();
+ $args->write($this->protocol);
+
+ $actual = $this->transport->read(Fixtures::$bufsize);
+ $expected = TJSONProtocolFixtures::$testArgsJSON['testVoid'];
+
+ $this->assertEquals($expected, $actual);
+ }
+
+ public function testString1Write()
+ {
+ $args = new \ThriftTest\ThriftTest_testString_args();
+ $args->thing = Fixtures::$testArgs['testString1'];
+ $args->write($this->protocol);
+
+ $actual = $this->transport->read(Fixtures::$bufsize);
+ $expected = TJSONProtocolFixtures::$testArgsJSON['testString1'];
+
+ $this->assertEquals($expected, $actual);
+ }
+
+ public function testString2Write()
+ {
+ $args = new \ThriftTest\ThriftTest_testString_args();
+ $args->thing = Fixtures::$testArgs['testString2'];
+ $args->write($this->protocol);
+
+ $actual = $this->transport->read(Fixtures::$bufsize);
+ $expected = TJSONProtocolFixtures::$testArgsJSON['testString2'];
+
+ $this->assertEquals($expected, $actual);
+ }
+
+ public function testDoubleWrite()
+ {
+ $args = new \ThriftTest\ThriftTest_testDouble_args();
+ $args->thing = Fixtures::$testArgs['testDouble'];
+ $args->write($this->protocol);
+
+ $actual = $this->transport->read(Fixtures::$bufsize);
+ $expected = TJSONProtocolFixtures::$testArgsJSON['testDouble'];
+
+ $this->assertEquals($expected, $actual);
+ }
+
+ public function testByteWrite()
+ {
+ $args = new \ThriftTest\ThriftTest_testByte_args();
+ $args->thing = Fixtures::$testArgs['testByte'];
+ $args->write($this->protocol);
+
+ $actual = $this->transport->read(Fixtures::$bufsize);
+ $expected = TJSONProtocolFixtures::$testArgsJSON['testByte'];
+
+ $this->assertEquals($expected, $actual);
+ }
+
+ public function testI32Write()
+ {
+ $args = new \ThriftTest\ThriftTest_testI32_args();
+ $args->thing = Fixtures::$testArgs['testI32'];
+ $args->write($this->protocol);
+
+ $actual = $this->transport->read(Fixtures::$bufsize);
+ $expected = TJSONProtocolFixtures::$testArgsJSON['testI32'];
+
+ $this->assertEquals($expected, $actual);
+ }
+
+ public function testI64Write()
+ {
+ $args = new \ThriftTest\ThriftTest_testI64_args();
+ $args->thing = Fixtures::$testArgs['testI64'];
+ $args->write($this->protocol);
+
+ $actual = $this->transport->read(Fixtures::$bufsize);
+ $expected = TJSONProtocolFixtures::$testArgsJSON['testI64'];
+
+ $this->assertEquals($expected, $actual);
+ }
+
+ public function testStructWrite()
+ {
+ $args = new \ThriftTest\ThriftTest_testStruct_args();
+ $args->thing = Fixtures::$testArgs['testStruct'];
+
+ $args->write($this->protocol);
+
+ $actual = $this->transport->read(Fixtures::$bufsize);
+ $expected = TJSONProtocolFixtures::$testArgsJSON['testStruct'];
+
+ $this->assertEquals($expected, $actual);
+ }
+
+ public function testNestWrite()
+ {
+ $args = new \ThriftTest\ThriftTest_testNest_args();
+ $args->thing = Fixtures::$testArgs['testNest'];
+
+ $args->write($this->protocol);
+
+ $actual = $this->transport->read(Fixtures::$bufsize);
+ $expected = TJSONProtocolFixtures::$testArgsJSON['testNest'];
+
+ $this->assertEquals($expected, $actual);
+ }
+
+ public function testMapWrite()
+ {
+ $args = new \ThriftTest\ThriftTest_testMap_args();
+ $args->thing = Fixtures::$testArgs['testMap'];
+
+ $args->write($this->protocol);
+
+ $actual = $this->transport->read(Fixtures::$bufsize);
+ $expected = TJSONProtocolFixtures::$testArgsJSON['testMap'];
+
+ $this->assertEquals($expected, $actual);
+ }
+
+ public function testStringMapWrite()
+ {
+ $args = new \ThriftTest\ThriftTest_testStringMap_args();
+ $args->thing = Fixtures::$testArgs['testStringMap'];
+
+ $args->write($this->protocol);
+
+ $actual = $this->transport->read(Fixtures::$bufsize);
+ $expected = TJSONProtocolFixtures::$testArgsJSON['testStringMap'];
+
+ /*
+ * The $actual returns unescaped string.
+ * It is required to to decode then encode it again
+ * to get the expected escaped unicode.
+ */
+ $this->assertEquals($expected, json_encode(json_decode($actual)));
+ }
+
+ public function testSetWrite()
+ {
+ $args = new \ThriftTest\ThriftTest_testSet_args();
+ $args->thing = Fixtures::$testArgs['testSet'];
+
+ $args->write($this->protocol);
+
+ $actual = $this->transport->read(Fixtures::$bufsize);
+ $expected = TJSONProtocolFixtures::$testArgsJSON['testSet'];
+
+ $this->assertEquals($expected, $actual);
+ }
+
+ public function testListWrite()
+ {
+ $args = new \ThriftTest\ThriftTest_testList_args();
+ $args->thing = Fixtures::$testArgs['testList'];
+
+ $args->write($this->protocol);
+
+ $actual = $this->transport->read(Fixtures::$bufsize);
+ $expected = TJSONProtocolFixtures::$testArgsJSON['testList'];
+
+ $this->assertEquals($expected, $actual);
+ }
+
+ public function testEnumWrite()
+ {
+ $args = new \ThriftTest\ThriftTest_testEnum_args();
+ $args->thing = Fixtures::$testArgs['testEnum'];
+
+ $args->write($this->protocol);
+
+ $actual = $this->transport->read(Fixtures::$bufsize);
+ $expected = TJSONProtocolFixtures::$testArgsJSON['testEnum'];
+
+ $this->assertEquals($expected, $actual);
+ }
+
+ public function testTypedefWrite()
+ {
+ $args = new \ThriftTest\ThriftTest_testTypedef_args();
+ $args->thing = Fixtures::$testArgs['testTypedef'];
+
+ $args->write($this->protocol);
+
+ $actual = $this->transport->read(Fixtures::$bufsize);
+ $expected = TJSONProtocolFixtures::$testArgsJSON['testTypedef'];
+
+ $this->assertEquals($expected, $actual);
+ }
+
+ /**
+ * READ TESTS
+ */
+ public function testVoidRead()
+ {
+ $this->transport->write(
+ TJSONProtocolFixtures::$testArgsJSON['testVoid']
+ );
+ $args = new \ThriftTest\ThriftTest_testVoid_args();
+ $args->read($this->protocol);
+ }
+
+ public function testString1Read()
+ {
+ $this->transport->write(
+ TJSONProtocolFixtures::$testArgsJSON['testString1']
+ );
+ $args = new \ThriftTest\ThriftTest_testString_args();
+ $args->read($this->protocol);
+
+ $actual = $args->thing;
+ $expected = Fixtures::$testArgs['testString1'];
+
+ $this->assertEquals($expected, $actual);
+ }
+
+ public function testString2Read()
+ {
+ $this->transport->write(
+ TJSONProtocolFixtures::$testArgsJSON['testString2']
+ );
+ $args = new \ThriftTest\ThriftTest_testString_args();
+ $args->read($this->protocol);
+
+ $actual = $args->thing;
+ $expected = Fixtures::$testArgs['testString2'];
+
+ $this->assertEquals($expected, $actual);
+ }
+
+ public function testString3Write()
+ {
+ $args = new \ThriftTest\ThriftTest_testString_args();
+ $args->thing = Fixtures::$testArgs['testString3'];
+ $args->write($this->protocol);
+
+ $actual = $this->transport->read(Fixtures::$bufsize);
+ $expected = TJSONProtocolFixtures::$testArgsJSON['testString3'];
+
+ $this->assertEquals($expected, $actual);
+ }
+
+ public function testString4Write()
+ {
+ $args = new \ThriftTest\ThriftTest_testString_args();
+ $args->thing = Fixtures::$testArgs['testUnicodeStringWithNonBMP'];
+ $args->write($this->protocol);
+
+ $actual = $this->transport->read(Fixtures::$bufsize);
+ $expected = TJSONProtocolFixtures::$testArgsJSON['testUnicodeStringWithNonBMP'];
+
+ $this->assertEquals($expected, $actual);
+ }
+
+ public function testDoubleRead()
+ {
+ $this->transport->write(
+ TJSONProtocolFixtures::$testArgsJSON['testDouble']
+ );
+ $args = new \ThriftTest\ThriftTest_testDouble_args();
+ $args->read($this->protocol);
+
+ $actual = $args->thing;
+ $expected = Fixtures::$testArgs['testDouble'];
+
+ $this->assertEquals($expected, $actual);
+ }
+
+ public function testByteRead()
+ {
+ $this->transport->write(
+ TJSONProtocolFixtures::$testArgsJSON['testByte']
+ );
+ $args = new \ThriftTest\ThriftTest_testByte_args();
+ $args->read($this->protocol);
+
+ $actual = $args->thing;
+ $expected = Fixtures::$testArgs['testByte'];
+
+ $this->assertEquals($expected, $actual);
+ }
+
+ public function testI32Read()
+ {
+ $this->transport->write(
+ TJSONProtocolFixtures::$testArgsJSON['testI32']
+ );
+ $args = new \ThriftTest\ThriftTest_testI32_args();
+ $args->read($this->protocol);
+
+ $actual = $args->thing;
+ $expected = Fixtures::$testArgs['testI32'];
+
+ $this->assertEquals($expected, $actual);
+ }
+
+ public function testI64Read()
+ {
+ $this->transport->write(
+ TJSONProtocolFixtures::$testArgsJSON['testI64']
+ );
+ $args = new \ThriftTest\ThriftTest_testI64_args();
+ $args->read($this->protocol);
+
+ $actual = $args->thing;
+ $expected = Fixtures::$testArgs['testI64'];
+
+ $this->assertEquals($expected, $actual);
+ }
+
+ public function testStructRead()
+ {
+ $this->transport->write(
+ TJSONProtocolFixtures::$testArgsJSON['testStruct']
+ );
+ $args = new \ThriftTest\ThriftTest_testStruct_args();
+ $args->read($this->protocol);
+
+ $actual = $args->thing;
+ $expected = Fixtures::$testArgs['testStruct'];
+
+ $this->assertEquals($expected, $actual);
+ }
+
+ public function testNestRead()
+ {
+ $this->transport->write(
+ TJSONProtocolFixtures::$testArgsJSON['testNest']
+ );
+ $args = new \ThriftTest\ThriftTest_testNest_args();
+ $args->read($this->protocol);
+
+ $actual = $args->thing;
+ $expected = Fixtures::$testArgs['testNest'];
+
+ $this->assertEquals($expected, $actual);
+ }
+
+ public function testMapRead()
+ {
+ $this->transport->write(
+ TJSONProtocolFixtures::$testArgsJSON['testMap']
+ );
+ $args = new \ThriftTest\ThriftTest_testMap_args();
+ $args->read($this->protocol);
+
+ $actual = $args->thing;
+ $expected = Fixtures::$testArgs['testMap'];
+
+ $this->assertEquals($expected, $actual);
+ }
+
+ public function testStringMapRead()
+ {
+ $this->transport->write(
+ TJSONProtocolFixtures::$testArgsJSON['testStringMap']
+ );
+ $args = new \ThriftTest\ThriftTest_testStringMap_args();
+ $args->read($this->protocol);
+
+ $actual = $args->thing;
+ $expected = Fixtures::$testArgs['testStringMap'];
+
+ $this->assertEquals($expected, $actual);
+ }
+
+ public function testSetRead()
+ {
+ $this->transport->write(
+ TJSONProtocolFixtures::$testArgsJSON['testSet']
+ );
+ $args = new \ThriftTest\ThriftTest_testSet_args();
+ $args->read($this->protocol);
+
+ $actual = $args->thing;
+ $expected = Fixtures::$testArgs['testSet'];
+
+ $this->assertEquals($expected, $actual);
+ }
+
+ public function testListRead()
+ {
+ $this->transport->write(
+ TJSONProtocolFixtures::$testArgsJSON['testList']
+ );
+ $args = new \ThriftTest\ThriftTest_testList_args();
+ $args->read($this->protocol);
+
+ $actual = $args->thing;
+ $expected = Fixtures::$testArgs['testList'];
+
+ $this->assertEquals($expected, $actual);
+ }
+
+ public function testEnumRead()
+ {
+ $this->transport->write(
+ TJSONProtocolFixtures::$testArgsJSON['testEnum']
+ );
+ $args = new \ThriftTest\ThriftTest_testEnum_args();
+ $args->read($this->protocol);
+
+ $actual = $args->thing;
+ $expected = Fixtures::$testArgs['testEnum'];
+
+ $this->assertEquals($expected, $actual);
+ }
+
+ public function testTypedefRead()
+ {
+ $this->transport->write(
+ TJSONProtocolFixtures::$testArgsJSON['testTypedef']
+ );
+ $args = new \ThriftTest\ThriftTest_testTypedef_args();
+ $args->read($this->protocol);
+
+ $actual = $args->thing;
+ $expected = Fixtures::$testArgs['testTypedef'];
+
+ $this->assertEquals($expected, $actual);
+ }
+
+ public function testMapMapRead()
+ {
+ $this->transport->write(
+ TJSONProtocolFixtures::$testArgsJSON['testMapMap']
+ );
+ $result = new \ThriftTest\ThriftTest_testMapMap_result();
+ $result->read($this->protocol);
+
+ $actual = $result->success;
+ $expected = Fixtures::$testArgs['testMapMapExpectedResult'];
+
+ $this->assertEquals($expected, $actual);
+ }
+
+ public function testInsanityRead()
+ {
+ $this->transport->write(
+ TJSONProtocolFixtures::$testArgsJSON['testInsanity']
+ );
+ $result = new \ThriftTest\ThriftTest_testInsanity_result();
+ $result->read($this->protocol);
+
+ $actual = $result->success;
+ $expected = Fixtures::$testArgs['testInsanityExpectedResult'];
+
+ $this->assertEquals($expected, $actual);
+ }
+}
diff --git a/lib/php/test/Protocol/TSimpleJSONProtocolFixtures.php b/lib/php/test/Protocol/TSimpleJSONProtocolFixtures.php
new file mode 100644
index 000000000..547fd8662
--- /dev/null
+++ b/lib/php/test/Protocol/TSimpleJSONProtocolFixtures.php
@@ -0,0 +1,67 @@
+<?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.
+ *
+ * @package thrift.test
+ */
+
+namespace test\Thrift\Protocol;
+
+class TSimpleJSONProtocolFixtures
+{
+ public static $testArgsJSON = array();
+
+ public static function populateTestArgsSimpleJSON()
+ {
+ self::$testArgsJSON['testVoid'] = '{}';
+
+ self::$testArgsJSON['testString1'] = '{"thing":"Afrikaans, Alemannisch, Aragon\u00e9s, \u0627\u0644\u0639\u0631\u0628\u064a\u0629, \u0645\u0635\u0631\u0649, Asturianu, Aymar aru, Az\u0259rbaycan, \u0411\u0430\u0448\u04a1\u043e\u0440\u0442, Boarisch, \u017demait\u0117\u0161ka, \u0411\u0435\u043b\u0430\u0440\u0443\u0441\u043a\u0430\u044f, \u0411\u0435\u043b\u0430\u0440\u0443\u0441\u043a\u0430\u044f (\u0442\u0430\u0440\u0430\u0448\u043a\u0435\u0432\u0456\u0446\u0430), \u0411\u044a\u043b\u0433\u0430\u0440\u0441\u043a\u0438, Bamanankan, \u09ac\u09be\u0982\u09b2\u09be, Brezhoneg, Bosanski, Catal\u00e0, M\u00ecng-d\u0115\u0324ng-ng\u1e73\u0304, \u041d\u043e\u0445\u0447\u0438\u0439\u043d, Cebuano, \u13e3\u13b3\u13a9, \u010cesky, \u0421\u043b\u043e\u0432\u0463\u0301\u043d\u044c\u0441\u043a\u044a \/ \u2c14\u2c0e\u2c11\u2c02\u2c21\u2c10\u2c20\u2c14\u2c0d\u2c1f, \u0427\u04d1\u0432\u0430\u0448\u043b\u0430, Cymraeg, Dansk, Zazaki, \u078b\u07a8\u0788\u07ac\u0780\u07a8\u0784\u07a6\u0790\u07b0, \u0395\u03bb\u03bb\u03b7\u03bd\u03b9\u03ba\u03ac, Emili\u00e0n e rumagn\u00f2l, English, Esperanto, Espa\u00f1ol, Eesti, Euskara, \u0641\u0627\u0631\u0633\u06cc, Suomi, V\u00f5ro, F\u00f8royskt, Fran\u00e7ais, Arpetan, Furlan, Frysk, Gaeilge, \u8d1b\u8a9e, G\u00e0idhlig, Galego, Ava\u00f1e\'\u1ebd, \u0a97\u0ac1\u0a9c\u0ab0\u0abe\u0aa4\u0ac0, Gaelg, \u05e2\u05d1\u05e8\u05d9\u05ea, \u0939\u093f\u0928\u094d\u0926\u0940, Fiji Hindi, Hrvatski, Krey\u00f2l ayisyen, Magyar, \u0540\u0561\u0575\u0565\u0580\u0565\u0576, Interlingua, Bahasa Indonesia, Ilokano, Ido, \u00cdslenska, Italiano, \u65e5\u672c\u8a9e, Lojban, Basa Jawa, \u10e5\u10d0\u10e0\u10d7\u10e3\u10da\u10d8, Kongo, Kalaallisut, \u0c95\u0ca8\u0ccd\u0ca8\u0ca1, \ud55c\uad6d\uc5b4, \u041a\u044a\u0430\u0440\u0430\u0447\u0430\u0439-\u041c\u0430\u043b\u043a\u044a\u0430\u0440, Ripoarisch, Kurd\u00ee, \u041a\u043e\u043c\u0438, Kernewek, \u041a\u044b\u0440\u0433\u044b\u0437\u0447\u0430, Latina, Ladino, L\u00ebtzebuergesch, Limburgs, Ling\u00e1la, \u0ea5\u0eb2\u0ea7, Lietuvi\u0173, Latvie\u0161u, Basa Banyumasan, Malagasy, \u041c\u0430\u043a\u0435\u0434\u043e\u043d\u0441\u043a\u0438, \u0d2e\u0d32\u0d2f\u0d3e\u0d33\u0d02, \u092e\u0930\u093e\u0920\u0940, Bahasa Melayu, \u0645\u0627\u0632\u0650\u0631\u0648\u0646\u06cc, Nnapulitano, Nedersaksisch, \u0928\u0947\u092a\u093e\u0932 \u092d\u093e\u0937\u093e, Nederlands, \u202aNorsk (nynorsk)\u202c, \u202aNorsk (bokm\u00e5l)\u202c, Nouormand, Din\u00e9 bizaad, Occitan, \u0418\u0440\u043e\u043d\u0430\u0443, Papiamentu, Deitsch, Norfuk \/ Pitkern, Polski, \u067e\u0646\u062c\u0627\u0628\u06cc, \u067e\u069a\u062a\u0648, Portugu\u00eas, Runa Simi, Rumantsch, Romani, Rom\u00e2n\u0103, \u0420\u0443\u0441\u0441\u043a\u0438\u0439, \u0421\u0430\u0445\u0430 \u0442\u044b\u043b\u0430, Sardu, Sicilianu, Scots, S\u00e1megiella, Simple English, Sloven\u010dina, Sloven\u0161\u010dina, \u0421\u0440\u043f\u0441\u043a\u0438 \/ Srpski, Seeltersk, Svenska, Kiswahili, \u0ba4\u0bae\u0bbf\u0bb4\u0bcd, \u0c24\u0c46\u0c32\u0c41\u0c17\u0c41, \u0422\u043e\u04b7\u0438\u043a\u04e3, \u0e44\u0e17\u0e22, T\u00fcrkmen\u00e7e, Tagalog, T\u00fcrk\u00e7e, \u0422\u0430\u0442\u0430\u0440\u0447\u0430\/Tatar\u00e7a, \u0423\u043a\u0440\u0430\u0457\u043d\u0441\u044c\u043a\u0430, \u0627\u0631\u062f\u0648, Ti\u1ebfng Vi\u1ec7t, Volap\u00fck, Walon, Winaray, \u5434\u8bed, isiXhosa, \u05d9\u05d9\u05b4\u05d3\u05d9\u05e9, Yor\u00f9b\u00e1, Ze\u00eauws, \u4e2d\u6587, B\u00e2n-l\u00e2m-g\u00fa, \u7cb5\u8a9e"}';
+
+ self::$testArgsJSON['testString2'] = '{"thing":"quote: \\\\\" backslash: forwardslash-escaped: \\\\\/ backspace: \\\\b formfeed: \f newline: \n return: \r tab: now-all-of-them-together: \"\\\\\\\\\/\\\\b\n\r\t now-a-bunch-of-junk: !@#$%&()(&%$#{}{}<><><"}';
+
+ self::$testArgsJSON['testDouble'] = '{"thing":3.1415926535898}';
+
+ self::$testArgsJSON['testByte'] = '{"thing":1}';
+
+ self::$testArgsJSON['testI32'] = '{"thing":1073741824}';
+
+ if (PHP_INT_SIZE == 8) {
+ self::$testArgsJSON['testI64'] = '{"thing":' . pow(2, 60) . '}';
+ self::$testArgsJSON['testStruct'] = '{"thing":{"string_thing":"worked","byte_thing":1,"i32_thing":1073741824,"i64_thing":' . pow(2, 60) . '}}';
+ self::$testArgsJSON['testNest'] = '{"thing":{"byte_thing":1,"struct_thing":{"string_thing":"worked","byte_thing":1,"i32_thing":1073741824,"i64_thing":' . pow(2, 60) . '},"i32_thing":32768}}';
+ } else {
+ self::$testArgsJSON['testI64'] = '{"thing":1152921504606847000}';
+
+ self::$testArgsJSON['testStruct'] = '{"thing":{"string_thing":"worked","byte_thing":1,"i32_thing":1073741824,"i64_thing":1152921504606847000}}';
+ self::$testArgsJSON['testNest'] = '{"thing":{"byte_thing":1,"struct_thing":{"string_thing":"worked","byte_thing":1,"i32_thing":1073741824,"i64_thing":1152921504606847000},"i32_thing":32768}}';
+ }
+
+ self::$testArgsJSON['testMap'] = '{"thing":{"7":77,"8":88,"9":99}}';
+
+ self::$testArgsJSON['testStringMap'] = '{"thing":{"a":"123","a b":"with spaces ","same":"same","0":"numeric key","longValue":"Afrikaans, Alemannisch, Aragon\u00e9s, \u0627\u0644\u0639\u0631\u0628\u064a\u0629, \u0645\u0635\u0631\u0649, Asturianu, Aymar aru, Az\u0259rbaycan, \u0411\u0430\u0448\u04a1\u043e\u0440\u0442, Boarisch, \u017demait\u0117\u0161ka, \u0411\u0435\u043b\u0430\u0440\u0443\u0441\u043a\u0430\u044f, \u0411\u0435\u043b\u0430\u0440\u0443\u0441\u043a\u0430\u044f (\u0442\u0430\u0440\u0430\u0448\u043a\u0435\u0432\u0456\u0446\u0430), \u0411\u044a\u043b\u0433\u0430\u0440\u0441\u043a\u0438, Bamanankan, \u09ac\u09be\u0982\u09b2\u09be, Brezhoneg, Bosanski, Catal\u00e0, M\u00ecng-d\u0115\u0324ng-ng\u1e73\u0304, \u041d\u043e\u0445\u0447\u0438\u0439\u043d, Cebuano, \u13e3\u13b3\u13a9, \u010cesky, \u0421\u043b\u043e\u0432\u0463\u0301\u043d\u044c\u0441\u043a\u044a \/ \u2c14\u2c0e\u2c11\u2c02\u2c21\u2c10\u2c20\u2c14\u2c0d\u2c1f, \u0427\u04d1\u0432\u0430\u0448\u043b\u0430, Cymraeg, Dansk, Zazaki, \u078b\u07a8\u0788\u07ac\u0780\u07a8\u0784\u07a6\u0790\u07b0, \u0395\u03bb\u03bb\u03b7\u03bd\u03b9\u03ba\u03ac, Emili\u00e0n e rumagn\u00f2l, English, Esperanto, Espa\u00f1ol, Eesti, Euskara, \u0641\u0627\u0631\u0633\u06cc, Suomi, V\u00f5ro, F\u00f8royskt, Fran\u00e7ais, Arpetan, Furlan, Frysk, Gaeilge, \u8d1b\u8a9e, G\u00e0idhlig, Galego, Ava\u00f1e\'\u1ebd, \u0a97\u0ac1\u0a9c\u0ab0\u0abe\u0aa4\u0ac0, Gaelg, \u05e2\u05d1\u05e8\u05d9\u05ea, \u0939\u093f\u0928\u094d\u0926\u0940, Fiji Hindi, Hrvatski, Krey\u00f2l ayisyen, Magyar, \u0540\u0561\u0575\u0565\u0580\u0565\u0576, Interlingua, Bahasa Indonesia, Ilokano, Ido, \u00cdslenska, Italiano, \u65e5\u672c\u8a9e, Lojban, Basa Jawa, \u10e5\u10d0\u10e0\u10d7\u10e3\u10da\u10d8, Kongo, Kalaallisut, \u0c95\u0ca8\u0ccd\u0ca8\u0ca1, \ud55c\uad6d\uc5b4, \u041a\u044a\u0430\u0440\u0430\u0447\u0430\u0439-\u041c\u0430\u043b\u043a\u044a\u0430\u0440, Ripoarisch, Kurd\u00ee, \u041a\u043e\u043c\u0438, Kernewek, \u041a\u044b\u0440\u0433\u044b\u0437\u0447\u0430, Latina, Ladino, L\u00ebtzebuergesch, Limburgs, Ling\u00e1la, \u0ea5\u0eb2\u0ea7, Lietuvi\u0173, Latvie\u0161u, Basa Banyumasan, Malagasy, \u041c\u0430\u043a\u0435\u0434\u043e\u043d\u0441\u043a\u0438, \u0d2e\u0d32\u0d2f\u0d3e\u0d33\u0d02, \u092e\u0930\u093e\u0920\u0940, Bahasa Melayu, \u0645\u0627\u0632\u0650\u0631\u0648\u0646\u06cc, Nnapulitano, Nedersaksisch, \u0928\u0947\u092a\u093e\u0932 \u092d\u093e\u0937\u093e, Nederlands, \u202aNorsk (nynorsk)\u202c, \u202aNorsk (bokm\u00e5l)\u202c, Nouormand, Din\u00e9 bizaad, Occitan, \u0418\u0440\u043e\u043d\u0430\u0443, Papiamentu, Deitsch, Norfuk \/ Pitkern, Polski, \u067e\u0646\u062c\u0627\u0628\u06cc, \u067e\u069a\u062a\u0648, Portugu\u00eas, Runa Simi, Rumantsch, Romani, Rom\u00e2n\u0103, \u0420\u0443\u0441\u0441\u043a\u0438\u0439, \u0421\u0430\u0445\u0430 \u0442\u044b\u043b\u0430, Sardu, Sicilianu, Scots, S\u00e1megiella, Simple English, Sloven\u010dina, Sloven\u0161\u010dina, \u0421\u0440\u043f\u0441\u043a\u0438 \/ Srpski, Seeltersk, Svenska, Kiswahili, \u0ba4\u0bae\u0bbf\u0bb4\u0bcd, \u0c24\u0c46\u0c32\u0c41\u0c17\u0c41, \u0422\u043e\u04b7\u0438\u043a\u04e3, \u0e44\u0e17\u0e22, T\u00fcrkmen\u00e7e, Tagalog, T\u00fcrk\u00e7e, \u0422\u0430\u0442\u0430\u0440\u0447\u0430\/Tatar\u00e7a, \u0423\u043a\u0440\u0430\u0457\u043d\u0441\u044c\u043a\u0430, \u0627\u0631\u062f\u0648, Ti\u1ebfng Vi\u1ec7t, Volap\u00fck, Walon, Winaray, \u5434\u8bed, isiXhosa, \u05d9\u05d9\u05b4\u05d3\u05d9\u05e9, Yor\u00f9b\u00e1, Ze\u00eauws, \u4e2d\u6587, B\u00e2n-l\u00e2m-g\u00fa, \u7cb5\u8a9e","Afrikaans, Alemannisch, Aragon\u00e9s, \u0627\u0644\u0639\u0631\u0628\u064a\u0629, \u0645\u0635\u0631\u0649, Asturianu, Aymar aru, Az\u0259rbaycan, \u0411\u0430\u0448\u04a1\u043e\u0440\u0442, Boarisch, \u017demait\u0117\u0161ka, \u0411\u0435\u043b\u0430\u0440\u0443\u0441\u043a\u0430\u044f, \u0411\u0435\u043b\u0430\u0440\u0443\u0441\u043a\u0430\u044f (\u0442\u0430\u0440\u0430\u0448\u043a\u0435\u0432\u0456\u0446\u0430), \u0411\u044a\u043b\u0433\u0430\u0440\u0441\u043a\u0438, Bamanankan, \u09ac\u09be\u0982\u09b2\u09be, Brezhoneg, Bosanski, Catal\u00e0, M\u00ecng-d\u0115\u0324ng-ng\u1e73\u0304, \u041d\u043e\u0445\u0447\u0438\u0439\u043d, Cebuano, \u13e3\u13b3\u13a9, \u010cesky, \u0421\u043b\u043e\u0432\u0463\u0301\u043d\u044c\u0441\u043a\u044a \/ \u2c14\u2c0e\u2c11\u2c02\u2c21\u2c10\u2c20\u2c14\u2c0d\u2c1f, \u0427\u04d1\u0432\u0430\u0448\u043b\u0430, Cymraeg, Dansk, Zazaki, \u078b\u07a8\u0788\u07ac\u0780\u07a8\u0784\u07a6\u0790\u07b0, \u0395\u03bb\u03bb\u03b7\u03bd\u03b9\u03ba\u03ac, Emili\u00e0n e rumagn\u00f2l, English, Esperanto, Espa\u00f1ol, Eesti, Euskara, \u0641\u0627\u0631\u0633\u06cc, Suomi, V\u00f5ro, F\u00f8royskt, Fran\u00e7ais, Arpetan, Furlan, Frysk, Gaeilge, \u8d1b\u8a9e, G\u00e0idhlig, Galego, Ava\u00f1e\'\u1ebd, \u0a97\u0ac1\u0a9c\u0ab0\u0abe\u0aa4\u0ac0, Gaelg, \u05e2\u05d1\u05e8\u05d9\u05ea, \u0939\u093f\u0928\u094d\u0926\u0940, Fiji Hindi, Hrvatski, Krey\u00f2l ayisyen, Magyar, \u0540\u0561\u0575\u0565\u0580\u0565\u0576, Interlingua, Bahasa Indonesia, Ilokano, Ido, \u00cdslenska, Italiano, \u65e5\u672c\u8a9e, Lojban, Basa Jawa, \u10e5\u10d0\u10e0\u10d7\u10e3\u10da\u10d8, Kongo, Kalaallisut, \u0c95\u0ca8\u0ccd\u0ca8\u0ca1, \ud55c\uad6d\uc5b4, \u041a\u044a\u0430\u0440\u0430\u0447\u0430\u0439-\u041c\u0430\u043b\u043a\u044a\u0430\u0440, Ripoarisch, Kurd\u00ee, \u041a\u043e\u043c\u0438, Kernewek, \u041a\u044b\u0440\u0433\u044b\u0437\u0447\u0430, Latina, Ladino, L\u00ebtzebuergesch, Limburgs, Ling\u00e1la, \u0ea5\u0eb2\u0ea7, Lietuvi\u0173, Latvie\u0161u, Basa Banyumasan, Malagasy, \u041c\u0430\u043a\u0435\u0434\u043e\u043d\u0441\u043a\u0438, \u0d2e\u0d32\u0d2f\u0d3e\u0d33\u0d02, \u092e\u0930\u093e\u0920\u0940, Bahasa Melayu, \u0645\u0627\u0632\u0650\u0631\u0648\u0646\u06cc, Nnapulitano, Nedersaksisch, \u0928\u0947\u092a\u093e\u0932 \u092d\u093e\u0937\u093e, Nederlands, \u202aNorsk (nynorsk)\u202c, \u202aNorsk (bokm\u00e5l)\u202c, Nouormand, Din\u00e9 bizaad, Occitan, \u0418\u0440\u043e\u043d\u0430\u0443, Papiamentu, Deitsch, Norfuk \/ Pitkern, Polski, \u067e\u0646\u062c\u0627\u0628\u06cc, \u067e\u069a\u062a\u0648, Portugu\u00eas, Runa Simi, Rumantsch, Romani, Rom\u00e2n\u0103, \u0420\u0443\u0441\u0441\u043a\u0438\u0439, \u0421\u0430\u0445\u0430 \u0442\u044b\u043b\u0430, Sardu, Sicilianu, Scots, S\u00e1megiella, Simple English, Sloven\u010dina, Sloven\u0161\u010dina, \u0421\u0440\u043f\u0441\u043a\u0438 \/ Srpski, Seeltersk, Svenska, Kiswahili, \u0ba4\u0bae\u0bbf\u0bb4\u0bcd, \u0c24\u0c46\u0c32\u0c41\u0c17\u0c41, \u0422\u043e\u04b7\u0438\u043a\u04e3, \u0e44\u0e17\u0e22, T\u00fcrkmen\u00e7e, Tagalog, T\u00fcrk\u00e7e, \u0422\u0430\u0442\u0430\u0440\u0447\u0430\/Tatar\u00e7a, \u0423\u043a\u0440\u0430\u0457\u043d\u0441\u044c\u043a\u0430, \u0627\u0631\u062f\u0648, Ti\u1ebfng Vi\u1ec7t, Volap\u00fck, Walon, Winaray, \u5434\u8bed, isiXhosa, \u05d9\u05d9\u05b4\u05d3\u05d9\u05e9, Yor\u00f9b\u00e1, Ze\u00eauws, \u4e2d\u6587, B\u00e2n-l\u00e2m-g\u00fa, \u7cb5\u8a9e":"long key"}}';
+
+ self::$testArgsJSON['testSet'] = '{"thing":[1,5,6]}';
+
+ self::$testArgsJSON['testList'] = '{"thing":[1,2,3]}';
+
+ self::$testArgsJSON['testEnum'] = '{"thing":1}';
+
+ self::$testArgsJSON['testTypedef'] = '{"thing":69}';
+ }
+}
diff --git a/lib/php/test/Protocol/TSimpleJSONProtocolTest.php b/lib/php/test/Protocol/TSimpleJSONProtocolTest.php
new file mode 100644
index 000000000..ec6432147
--- /dev/null
+++ b/lib/php/test/Protocol/TSimpleJSONProtocolTest.php
@@ -0,0 +1,254 @@
+<?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.
+ *
+ * @package thrift.test
+ */
+
+namespace Test\Thrift\Protocol;
+
+use PHPUnit\Framework\TestCase;
+use Test\Thrift\Fixtures;
+use Thrift\ClassLoader\ThriftClassLoader;
+use Thrift\Protocol\TSimpleJSONProtocol;
+use Thrift\Transport\TMemoryBuffer;
+
+require_once __DIR__ . '/../../../../vendor/autoload.php';
+
+/***
+ * This test suite depends on running the compiler against the
+ * standard ThriftTest.thrift file:
+ *
+ * lib/php/test$ ../../../compiler/cpp/thrift --gen php -r \
+ * --out ./packages ../../../test/ThriftTest.thrift
+ *
+ * @runTestsInSeparateProcesses
+ */
+class TSimpleJSONProtocolTest extends TestCase
+{
+ private $transport;
+ private $protocol;
+
+ public static function setUpBeforeClass()
+ {
+ $loader = new ThriftClassLoader();
+ $loader->registerDefinition('ThriftTest', __DIR__ . '/../packages');
+ $loader->register();
+
+ Fixtures::populateTestArgs();
+ TSimpleJSONProtocolFixtures::populateTestArgsSimpleJSON();
+ }
+
+ public function setUp()
+ {
+ $this->transport = new TMemoryBuffer();
+ $this->protocol = new TSimpleJSONProtocol($this->transport);
+ $this->transport->open();
+ }
+
+ /**
+ * WRITE TESTS
+ */
+ public function testVoidWrite()
+ {
+ $args = new \ThriftTest\ThriftTest_testVoid_args();
+ $args->write($this->protocol);
+
+ $actual = $this->transport->read(Fixtures::$bufsize);
+ $expected = TSimpleJSONProtocolFixtures::$testArgsJSON['testVoid'];
+
+ $this->assertEquals($expected, $actual);
+ }
+
+ public function testString1Write()
+ {
+ $args = new \ThriftTest\ThriftTest_testString_args();
+ $args->thing = Fixtures::$testArgs['testString1'];
+ $args->write($this->protocol);
+
+ $actual = $this->transport->read(Fixtures::$bufsize);
+ $expected = TSimpleJSONProtocolFixtures::$testArgsJSON['testString1'];
+
+ $this->assertEquals($expected, $actual);
+ }
+
+ public function testString2Write()
+ {
+ $args = new \ThriftTest\ThriftTest_testString_args();
+ $args->thing = Fixtures::$testArgs['testString2'];
+ $args->write($this->protocol);
+
+ $actual = $this->transport->read(Fixtures::$bufsize);
+ $expected = TSimpleJSONProtocolFixtures::$testArgsJSON['testString2'];
+
+ $this->assertEquals($expected, $actual);
+ }
+
+ public function testDoubleWrite()
+ {
+ $args = new \ThriftTest\ThriftTest_testDouble_args();
+ $args->thing = Fixtures::$testArgs['testDouble'];
+ $args->write($this->protocol);
+
+ $actual = $this->transport->read(Fixtures::$bufsize);
+ $expected = TSimpleJSONProtocolFixtures::$testArgsJSON['testDouble'];
+
+ $this->assertEquals($expected, $actual);
+ }
+
+ public function testByteWrite()
+ {
+ $args = new \ThriftTest\ThriftTest_testByte_args();
+ $args->thing = Fixtures::$testArgs['testByte'];
+ $args->write($this->protocol);
+
+ $actual = $this->transport->read(Fixtures::$bufsize);
+ $expected = TSimpleJSONProtocolFixtures::$testArgsJSON['testByte'];
+
+ $this->assertEquals($expected, $actual);
+ }
+
+ public function testI32Write()
+ {
+ $args = new \ThriftTest\ThriftTest_testI32_args();
+ $args->thing = Fixtures::$testArgs['testI32'];
+ $args->write($this->protocol);
+
+ $actual = $this->transport->read(Fixtures::$bufsize);
+ $expected = TSimpleJSONProtocolFixtures::$testArgsJSON['testI32'];
+
+ $this->assertEquals($expected, $actual);
+ }
+
+ public function testI64Write()
+ {
+ $args = new \ThriftTest\ThriftTest_testI64_args();
+ $args->thing = Fixtures::$testArgs['testI64'];
+ $args->write($this->protocol);
+
+ $actual = $this->transport->read(Fixtures::$bufsize);
+ $expected = TSimpleJSONProtocolFixtures::$testArgsJSON['testI64'];
+
+ $this->assertEquals($expected, $actual);
+ }
+
+ public function testStructWrite()
+ {
+ $args = new \ThriftTest\ThriftTest_testStruct_args();
+ $args->thing = Fixtures::$testArgs['testStruct'];
+
+ $args->write($this->protocol);
+
+ $actual = $this->transport->read(Fixtures::$bufsize);
+ $expected = TSimpleJSONProtocolFixtures::$testArgsJSON['testStruct'];
+
+ $this->assertEquals($expected, $actual);
+ }
+
+ public function testNestWrite()
+ {
+ $args = new \ThriftTest\ThriftTest_testNest_args();
+ $args->thing = Fixtures::$testArgs['testNest'];
+
+ $args->write($this->protocol);
+
+ $actual = $this->transport->read(Fixtures::$bufsize);
+ $expected = TSimpleJSONProtocolFixtures::$testArgsJSON['testNest'];
+
+ $this->assertEquals($expected, $actual);
+ }
+
+ public function testMapWrite()
+ {
+ $args = new \ThriftTest\ThriftTest_testMap_args();
+ $args->thing = Fixtures::$testArgs['testMap'];
+
+ $args->write($this->protocol);
+
+ $actual = $this->transport->read(Fixtures::$bufsize);
+ $expected = TSimpleJSONProtocolFixtures::$testArgsJSON['testMap'];
+
+ $this->assertEquals($expected, $actual);
+ }
+
+ public function testStringMapWrite()
+ {
+ $args = new \ThriftTest\ThriftTest_testStringMap_args();
+ $args->thing = Fixtures::$testArgs['testStringMap'];
+
+ $args->write($this->protocol);
+
+ $actual = $this->transport->read(Fixtures::$bufsize);
+ $expected = TSimpleJSONProtocolFixtures::$testArgsJSON['testStringMap'];
+
+ $this->assertEquals($expected, $actual);
+ }
+
+ public function testSetWrite()
+ {
+ $args = new \ThriftTest\ThriftTest_testSet_args();
+ $args->thing = Fixtures::$testArgs['testSet'];
+
+ $args->write($this->protocol);
+
+ $actual = $this->transport->read(Fixtures::$bufsize);
+ $expected = TSimpleJSONProtocolFixtures::$testArgsJSON['testSet'];
+
+ $this->assertEquals($expected, $actual);
+ }
+
+ public function testListWrite()
+ {
+ $args = new \ThriftTest\ThriftTest_testList_args();
+ $args->thing = Fixtures::$testArgs['testList'];
+
+ $args->write($this->protocol);
+
+ $actual = $this->transport->read(Fixtures::$bufsize);
+ $expected = TSimpleJSONProtocolFixtures::$testArgsJSON['testList'];
+
+ $this->assertEquals($expected, $actual);
+ }
+
+ public function testEnumWrite()
+ {
+ $args = new \ThriftTest\ThriftTest_testEnum_args();
+ $args->thing = Fixtures::$testArgs['testEnum'];
+
+ $args->write($this->protocol);
+
+ $actual = $this->transport->read(Fixtures::$bufsize);
+ $expected = TSimpleJSONProtocolFixtures::$testArgsJSON['testEnum'];
+
+ $this->assertEquals($expected, $actual);
+ }
+
+ public function testTypedefWrite()
+ {
+ $args = new \ThriftTest\ThriftTest_testTypedef_args();
+ $args->thing = Fixtures::$testArgs['testTypedef'];
+
+ $args->write($this->protocol);
+
+ $actual = $this->transport->read(Fixtures::$bufsize);
+ $expected = TSimpleJSONProtocolFixtures::$testArgsJSON['testTypedef'];
+
+ $this->assertEquals($expected, $actual);
+ }
+}
diff --git a/lib/php/test/Protocol/TestTJSONProtocol.php b/lib/php/test/Protocol/TestTJSONProtocol.php
deleted file mode 100644
index 1c34efb99..000000000
--- a/lib/php/test/Protocol/TestTJSONProtocol.php
+++ /dev/null
@@ -1,581 +0,0 @@
-<?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.
- *
- * @package thrift.test
- */
-
-namespace test\Thrift\Protocol;
-
-use Thrift\ClassLoader\ThriftClassLoader;
-use Test\Thrift\Fixtures;
-use Thrift\Transport\TMemoryBuffer;
-use Thrift\Protocol\TJSONProtocol;
-
-define( 'BUFSIZ', 8192 ); //big enough to read biggest serialized Fixture arg.
-
-require_once __DIR__.'/../../../../vendor/autoload.php';
-
-$loader = new ThriftClassLoader();
-$loader->registerDefinition('ThriftTest', __DIR__ . '/../packages');
-$loader->register();
-
-/***
- * This test suite depends on running the compiler against the
- * standard ThriftTest.thrift file:
- *
- * lib/php/test$ ../../../compiler/cpp/thrift --gen php -r \
- * --out ./packages ../../../test/ThriftTest.thrift
- */
-
-class TestTJSONProtocol extends \PHPUnit_Framework_TestCase
-{
- private $transport;
- private $protocol;
-
- public static function setUpBeforeClass()
- {
- Fixtures::populateTestArgs();
- TestTJSONProtocol_Fixtures::populateTestArgsJSON();
- }
-
- public function setUp()
- {
- $this->transport = new TMemoryBuffer();
- $this->protocol = new TJSONProtocol($this->transport);
- $this->transport->open();
- }
-
- /***
- * WRITE TESTS
- */
-
- public function testVoid_Write()
- {
- $args = new \ThriftTest\ThriftTest_testVoid_args();
- $args->write( $this->protocol );
-
- $actual = $this->transport->read( BUFSIZ );
- $expected = TestTJSONProtocol_Fixtures::$testArgsJSON['testVoid'];
-
- $this->assertEquals( $expected, $actual );
- }
-
- public function testString1_Write()
- {
- $args = new \ThriftTest\ThriftTest_testString_args();
- $args->thing = Fixtures::$testArgs['testString1'];
- $args->write( $this->protocol );
-
- $actual = $this->transport->read( BUFSIZ );
- $expected = TestTJSONProtocol_Fixtures::$testArgsJSON['testString1'];
-
- #$this->assertEquals( $expected, $actual );
- }
-
- public function testString2_Write()
- {
- $args = new \ThriftTest\ThriftTest_testString_args();
- $args->thing = Fixtures::$testArgs['testString2'];
- $args->write( $this->protocol );
-
- $actual = $this->transport->read( BUFSIZ );
- $expected = TestTJSONProtocol_Fixtures::$testArgsJSON['testString2'];
-
- $this->assertEquals( $expected, $actual );
- }
-
- public function testDouble_Write()
- {
- $args = new \ThriftTest\ThriftTest_testDouble_args();
- $args->thing = Fixtures::$testArgs['testDouble'];
- $args->write( $this->protocol );
-
- $actual = $this->transport->read( BUFSIZ );
- $expected = TestTJSONProtocol_Fixtures::$testArgsJSON['testDouble'];
-
- $this->assertEquals( $expected, $actual );
- }
-
- public function testByte_Write()
- {
- $args = new \ThriftTest\ThriftTest_testByte_args();
- $args->thing = Fixtures::$testArgs['testByte'];
- $args->write( $this->protocol );
-
- $actual = $this->transport->read( BUFSIZ );
- $expected = TestTJSONProtocol_Fixtures::$testArgsJSON['testByte'];
-
- $this->assertEquals( $expected, $actual );
- }
-
- public function testI32_Write()
- {
- $args = new \ThriftTest\ThriftTest_testI32_args();
- $args->thing = Fixtures::$testArgs['testI32'];
- $args->write( $this->protocol );
-
- $actual = $this->transport->read( BUFSIZ );
- $expected = TestTJSONProtocol_Fixtures::$testArgsJSON['testI32'];
-
- $this->assertEquals( $expected, $actual );
- }
-
- public function testI64_Write()
- {
- $args = new \ThriftTest\ThriftTest_testI64_args();
- $args->thing = Fixtures::$testArgs['testI64'];
- $args->write( $this->protocol );
-
- $actual = $this->transport->read( BUFSIZ );
- $expected = TestTJSONProtocol_Fixtures::$testArgsJSON['testI64'];
-
- $this->assertEquals( $expected, $actual );
- }
-
- public function testStruct_Write()
- {
- $args = new \ThriftTest\ThriftTest_testStruct_args();
- $args->thing = Fixtures::$testArgs['testStruct'];
-
- $args->write( $this->protocol );
-
- $actual = $this->transport->read( BUFSIZ );
- $expected = TestTJSONProtocol_Fixtures::$testArgsJSON['testStruct'];
-
- $this->assertEquals( $expected, $actual );
- }
-
- public function testNest_Write()
- {
- $args = new \ThriftTest\ThriftTest_testNest_args();
- $args->thing = Fixtures::$testArgs['testNest'];
-
- $args->write( $this->protocol );
-
- $actual = $this->transport->read( BUFSIZ );
- $expected = TestTJSONProtocol_Fixtures::$testArgsJSON['testNest'];
-
- $this->assertEquals( $expected, $actual );
- }
-
- public function testMap_Write()
- {
- $args = new \ThriftTest\ThriftTest_testMap_args();
- $args->thing = Fixtures::$testArgs['testMap'];
-
- $args->write( $this->protocol );
-
- $actual = $this->transport->read( BUFSIZ );
- $expected = TestTJSONProtocol_Fixtures::$testArgsJSON['testMap'];
-
- $this->assertEquals( $expected, $actual );
- }
-
- public function testStringMap_Write()
- {
- $args = new \ThriftTest\ThriftTest_testStringMap_args();
- $args->thing = Fixtures::$testArgs['testStringMap'];
-
- $args->write( $this->protocol );
-
- $actual = $this->transport->read( BUFSIZ );
- $expected = TestTJSONProtocol_Fixtures::$testArgsJSON['testStringMap'];
-
- /*
- * The $actual returns unescaped string.
- * It is required to to decode then encode it again
- * to get the expected escaped unicode.
- */
- $this->assertEquals( $expected, json_encode(json_decode($actual)) );
- }
-
- public function testSet_Write()
- {
- $args = new \ThriftTest\ThriftTest_testSet_args();
- $args->thing = Fixtures::$testArgs['testSet'];
-
- $args->write( $this->protocol );
-
- $actual = $this->transport->read( BUFSIZ );
- $expected = TestTJSONProtocol_Fixtures::$testArgsJSON['testSet'];
-
- $this->assertEquals( $expected, $actual );
- }
-
- public function testList_Write()
- {
- $args = new \ThriftTest\ThriftTest_testList_args();
- $args->thing = Fixtures::$testArgs['testList'];
-
- $args->write( $this->protocol );
-
- $actual = $this->transport->read( BUFSIZ );
- $expected = TestTJSONProtocol_Fixtures::$testArgsJSON['testList'];
-
- $this->assertEquals( $expected, $actual );
- }
-
- public function testEnum_Write()
- {
- $args = new \ThriftTest\ThriftTest_testEnum_args();
- $args->thing = Fixtures::$testArgs['testEnum'];
-
- $args->write( $this->protocol );
-
- $actual = $this->transport->read( BUFSIZ );
- $expected = TestTJSONProtocol_Fixtures::$testArgsJSON['testEnum'];
-
- $this->assertEquals( $expected, $actual );
- }
-
- public function testTypedef_Write()
- {
- $args = new \ThriftTest\ThriftTest_testTypedef_args();
- $args->thing = Fixtures::$testArgs['testTypedef'];
-
- $args->write( $this->protocol );
-
- $actual = $this->transport->read( BUFSIZ );
- $expected = TestTJSONProtocol_Fixtures::$testArgsJSON['testTypedef'];
-
- $this->assertEquals( $expected, $actual );
- }
-
- /***
- * READ TESTS
- */
-
- public function testVoid_Read()
- {
- $this->transport->write(
- TestTJSONProtocol_Fixtures::$testArgsJSON['testVoid']
- );
- $args = new \ThriftTest\ThriftTest_testVoid_args();
- $args->read( $this->protocol );
- }
-
- public function testString1_Read()
- {
- $this->transport->write(
- TestTJSONProtocol_Fixtures::$testArgsJSON['testString1']
- );
- $args = new \ThriftTest\ThriftTest_testString_args();
- $args->read( $this->protocol );
-
- $actual = $args->thing;
- $expected = Fixtures::$testArgs['testString1'];
-
- $this->assertEquals( $expected, $actual );
- }
-
- public function testString2_Read()
- {
- $this->transport->write(
- TestTJSONProtocol_Fixtures::$testArgsJSON['testString2']
- );
- $args = new \ThriftTest\ThriftTest_testString_args();
- $args->read( $this->protocol );
-
- $actual = $args->thing;
- $expected = Fixtures::$testArgs['testString2'];
-
- $this->assertEquals( $expected, $actual );
- }
-
- public function testString3_Write()
- {
- $args = new \ThriftTest\ThriftTest_testString_args();
- $args->thing = Fixtures::$testArgs['testString3'];
- $args->write( $this->protocol );
-
- $actual = $this->transport->read( BUFSIZ );
- $expected = TestTJSONProtocol_Fixtures::$testArgsJSON['testString3'];
-
- $this->assertEquals( $expected, $actual );
- }
-
- public function testString4_Write()
- {
- $args = new \ThriftTest\ThriftTest_testString_args();
- $args->thing = Fixtures::$testArgs['testUnicodeStringWithNonBMP'];
- $args->write( $this->protocol );
-
- $actual = $this->transport->read( BUFSIZ );
- $expected = TestTJSONProtocol_Fixtures::$testArgsJSON['testUnicodeStringWithNonBMP'];
-
- $this->assertEquals( $expected, $actual );
- }
-
- public function testDouble_Read()
- {
- $this->transport->write(
- TestTJSONProtocol_Fixtures::$testArgsJSON['testDouble']
- );
- $args = new \ThriftTest\ThriftTest_testDouble_args();
- $args->read( $this->protocol );
-
- $actual = $args->thing;
- $expected = Fixtures::$testArgs['testDouble'];
-
- $this->assertEquals( $expected, $actual );
- }
-
- public function testByte_Read()
- {
- $this->transport->write(
- TestTJSONProtocol_Fixtures::$testArgsJSON['testByte']
- );
- $args = new \ThriftTest\ThriftTest_testByte_args();
- $args->read( $this->protocol );
-
- $actual = $args->thing;
- $expected = Fixtures::$testArgs['testByte'];
-
- $this->assertEquals( $expected, $actual );
- }
-
- public function testI32_Read()
- {
- $this->transport->write(
- TestTJSONProtocol_Fixtures::$testArgsJSON['testI32']
- );
- $args = new \ThriftTest\ThriftTest_testI32_args();
- $args->read( $this->protocol );
-
- $actual = $args->thing;
- $expected = Fixtures::$testArgs['testI32'];
-
- $this->assertEquals( $expected, $actual );
- }
-
- public function testI64_Read()
- {
- $this->transport->write(
- TestTJSONProtocol_Fixtures::$testArgsJSON['testI64']
- );
- $args = new \ThriftTest\ThriftTest_testI64_args();
- $args->read( $this->protocol );
-
- $actual = $args->thing;
- $expected = Fixtures::$testArgs['testI64'];
-
- $this->assertEquals( $expected, $actual );
-
- }
-
- public function testStruct_Read()
- {
- $this->transport->write(
- TestTJSONProtocol_Fixtures::$testArgsJSON['testStruct']
- );
- $args = new \ThriftTest\ThriftTest_testStruct_args();
- $args->read( $this->protocol );
-
- $actual = $args->thing;
- $expected = Fixtures::$testArgs['testStruct'];
-
- $this->assertEquals( $expected, $actual );
-
- }
-
- public function testNest_Read()
- {
- $this->transport->write(
- TestTJSONProtocol_Fixtures::$testArgsJSON['testNest']
- );
- $args = new \ThriftTest\ThriftTest_testNest_args();
- $args->read( $this->protocol );
-
- $actual = $args->thing;
- $expected = Fixtures::$testArgs['testNest'];
-
- $this->assertEquals( $expected, $actual );
-
- }
-
- public function testMap_Read()
- {
- $this->transport->write(
- TestTJSONProtocol_Fixtures::$testArgsJSON['testMap']
- );
- $args = new \ThriftTest\ThriftTest_testMap_args();
- $args->read( $this->protocol );
-
- $actual = $args->thing;
- $expected = Fixtures::$testArgs['testMap'];
-
- $this->assertEquals( $expected, $actual );
-
- }
-
- public function testStringMap_Read()
- {
- $this->transport->write(
- TestTJSONProtocol_Fixtures::$testArgsJSON['testStringMap']
- );
- $args = new \ThriftTest\ThriftTest_testStringMap_args();
- $args->read( $this->protocol );
-
- $actual = $args->thing;
- $expected = Fixtures::$testArgs['testStringMap'];
-
- $this->assertEquals( $expected, $actual );
-
- }
-
- public function testSet_Read()
- {
- $this->transport->write(
- TestTJSONProtocol_Fixtures::$testArgsJSON['testSet']
- );
- $args = new \ThriftTest\ThriftTest_testSet_args();
- $args->read( $this->protocol );
-
- $actual = $args->thing;
- $expected = Fixtures::$testArgs['testSet'];
-
- $this->assertEquals( $expected, $actual );
-
- }
-
- public function testList_Read()
- {
- $this->transport->write(
- TestTJSONProtocol_Fixtures::$testArgsJSON['testList']
- );
- $args = new \ThriftTest\ThriftTest_testList_args();
- $args->read( $this->protocol );
-
- $actual = $args->thing;
- $expected = Fixtures::$testArgs['testList'];
-
- $this->assertEquals( $expected, $actual );
-
- }
-
- public function testEnum_Read()
- {
- $this->transport->write(
- TestTJSONProtocol_Fixtures::$testArgsJSON['testEnum']
- );
- $args = new \ThriftTest\ThriftTest_testEnum_args();
- $args->read( $this->protocol );
-
- $actual = $args->thing;
- $expected = Fixtures::$testArgs['testEnum'];
-
- $this->assertEquals( $expected, $actual );
-
- }
-
- public function testTypedef_Read()
- {
- $this->transport->write(
- TestTJSONProtocol_Fixtures::$testArgsJSON['testTypedef']
- );
- $args = new \ThriftTest\ThriftTest_testTypedef_args();
- $args->read( $this->protocol );
-
- $actual = $args->thing;
- $expected = Fixtures::$testArgs['testTypedef'];
-
- $this->assertEquals( $expected, $actual );
- }
-
- public function testMapMap_Read()
- {
- $this->transport->write(
- TestTJSONProtocol_Fixtures::$testArgsJSON['testMapMap']
- );
- $result = new \ThriftTest\ThriftTest_testMapMap_result();
- $result->read( $this->protocol );
-
- $actual = $result->success;
- $expected = Fixtures::$testArgs['testMapMapExpectedResult'];
-
- $this->assertEquals( $expected, $actual );
- }
-
- public function testInsanity_Read()
- {
- $this->transport->write(
- TestTJSONProtocol_Fixtures::$testArgsJSON['testInsanity']
- );
- $result = new \ThriftTest\ThriftTest_testInsanity_result();
- $result->read( $this->protocol );
-
- $actual = $result->success;
- $expected = Fixtures::$testArgs['testInsanityExpectedResult'];
-
- $this->assertEquals( $expected, $actual );
- }
-
-}
-
-class TestTJSONProtocol_Fixtures
-{
- public static $testArgsJSON = array();
-
- public static function populateTestArgsJSON()
- {
- self::$testArgsJSON['testVoid'] = '{}';
-
- self::$testArgsJSON['testString1'] = '{"1":{"str":"Afrikaans, Alemannisch, Aragon\u00e9s, \u0627\u0644\u0639\u0631\u0628\u064a\u0629, \u0645\u0635\u0631\u0649, Asturianu, Aymar aru, Az\u0259rbaycan, \u0411\u0430\u0448\u04a1\u043e\u0440\u0442, Boarisch, \u017demait\u0117\u0161ka, \u0411\u0435\u043b\u0430\u0440\u0443\u0441\u043a\u0430\u044f, \u0411\u0435\u043b\u0430\u0440\u0443\u0441\u043a\u0430\u044f (\u0442\u0430\u0440\u0430\u0448\u043a\u0435\u0432\u0456\u0446\u0430), \u0411\u044a\u043b\u0433\u0430\u0440\u0441\u043a\u0438, Bamanankan, \u09ac\u09be\u0982\u09b2\u09be, Brezhoneg, Bosanski, Catal\u00e0, M\u00ecng-d\u0115\u0324ng-ng\u1e73\u0304, \u041d\u043e\u0445\u0447\u0438\u0439\u043d, Cebuano, \u13e3\u13b3\u13a9, \u010cesky, \u0421\u043b\u043e\u0432\u0463\u0301\u043d\u044c\u0441\u043a\u044a \/ \u2c14\u2c0e\u2c11\u2c02\u2c21\u2c10\u2c20\u2c14\u2c0d\u2c1f, \u0427\u04d1\u0432\u0430\u0448\u043b\u0430, Cymraeg, Dansk, Zazaki, \u078b\u07a8\u0788\u07ac\u0780\u07a8\u0784\u07a6\u0790\u07b0, \u0395\u03bb\u03bb\u03b7\u03bd\u03b9\u03ba\u03ac, Emili\u00e0n e rumagn\u00f2l, English, Esperanto, Espa\u00f1ol, Eesti, Euskara, \u0641\u0627\u0631\u0633\u06cc, Suomi, V\u00f5ro, F\u00f8royskt, Fran\u00e7ais, Arpetan, Furlan, Frysk, Gaeilge, \u8d1b\u8a9e, G\u00e0idhlig, Galego, Ava\u00f1e\'\u1ebd, \u0a97\u0ac1\u0a9c\u0ab0\u0abe\u0aa4\u0ac0, Gaelg, \u05e2\u05d1\u05e8\u05d9\u05ea, \u0939\u093f\u0928\u094d\u0926\u0940, Fiji Hindi, Hrvatski, Krey\u00f2l ayisyen, Magyar, \u0540\u0561\u0575\u0565\u0580\u0565\u0576, Interlingua, Bahasa Indonesia, Ilokano, Ido, \u00cdslenska, Italiano, \u65e5\u672c\u8a9e, Lojban, Basa Jawa, \u10e5\u10d0\u10e0\u10d7\u10e3\u10da\u10d8, Kongo, Kalaallisut, \u0c95\u0ca8\u0ccd\u0ca8\u0ca1, \ud55c\uad6d\uc5b4, \u041a\u044a\u0430\u0440\u0430\u0447\u0430\u0439-\u041c\u0430\u043b\u043a\u044a\u0430\u0440, Ripoarisch, Kurd\u00ee, \u041a\u043e\u043c\u0438, Kernewek, \u041a\u044b\u0440\u0433\u044b\u0437\u0447\u0430, Latina, Ladino, L\u00ebtzebuergesch, Limburgs, Ling\u00e1la, \u0ea5\u0eb2\u0ea7, Lietuvi\u0173, Latvie\u0161u, Basa Banyumasan, Malagasy, \u041c\u0430\u043a\u0435\u0434\u043e\u043d\u0441\u043a\u0438, \u0d2e\u0d32\u0d2f\u0d3e\u0d33\u0d02, \u092e\u0930\u093e\u0920\u0940, Bahasa Melayu, \u0645\u0627\u0632\u0650\u0631\u0648\u0646\u06cc, Nnapulitano, Nedersaksisch, \u0928\u0947\u092a\u093e\u0932 \u092d\u093e\u0937\u093e, Nederlands, \u202aNorsk (nynorsk)\u202c, \u202aNorsk (bokm\u00e5l)\u202c, Nouormand, Din\u00e9 bizaad, Occitan, \u0418\u0440\u043e\u043d\u0430\u0443, Papiamentu, Deitsch, Norfuk \/ Pitkern, Polski, \u067e\u0646\u062c\u0627\u0628\u06cc, \u067e\u069a\u062a\u0648, Portugu\u00eas, Runa Simi, Rumantsch, Romani, Rom\u00e2n\u0103, \u0420\u0443\u0441\u0441\u043a\u0438\u0439, \u0421\u0430\u0445\u0430 \u0442\u044b\u043b\u0430, Sardu, Sicilianu, Scots, S\u00e1megiella, Simple English, Sloven\u010dina, Sloven\u0161\u010dina, \u0421\u0440\u043f\u0441\u043a\u0438 \/ Srpski, Seeltersk, Svenska, Kiswahili, \u0ba4\u0bae\u0bbf\u0bb4\u0bcd, \u0c24\u0c46\u0c32\u0c41\u0c17\u0c41, \u0422\u043e\u04b7\u0438\u043a\u04e3, \u0e44\u0e17\u0e22, T\u00fcrkmen\u00e7e, Tagalog, T\u00fcrk\u00e7e, \u0422\u0430\u0442\u0430\u0440\u0447\u0430\/Tatar\u00e7a, \u0423\u043a\u0440\u0430\u0457\u043d\u0441\u044c\u043a\u0430, \u0627\u0631\u062f\u0648, Ti\u1ebfng Vi\u1ec7t, Volap\u00fck, Walon, Winaray, \u5434\u8bed, isiXhosa, \u05d9\u05d9\u05b4\u05d3\u05d9\u05e9, Yor\u00f9b\u00e1, Ze\u00eauws, \u4e2d\u6587, B\u00e2n-l\u00e2m-g\u00fa, \u7cb5\u8a9e"}}';
-
- self::$testArgsJSON['testString2'] = '{"1":{"str":"quote: \\\\\" backslash: forwardslash-escaped: \\\\\/ backspace: \\\\b formfeed: \f newline: \n return: \r tab: now-all-of-them-together: \"\\\\\\\\\/\\\\b\n\r\t now-a-bunch-of-junk: !@#$%&()(&%$#{}{}<><><"}}';
-
- self::$testArgsJSON['testString3'] = '{"1":{"str":"string that ends in double-backslash \\\\\\\\"}}';
-
- self::$testArgsJSON['testUnicodeStringWithNonBMP'] = '{"1":{"str":"สวัสดี\/𝒯"}}';
-
- self::$testArgsJSON['testDouble'] = '{"1":{"dbl":3.1415926535898}}';
-
- self::$testArgsJSON['testByte'] = '{"1":{"i8":1}}';
-
- self::$testArgsJSON['testI32'] = '{"1":{"i32":1073741824}}';
-
- if (PHP_INT_SIZE == 8) {
- self::$testArgsJSON['testI64'] = '{"1":{"i64":'.pow( 2, 60 ).'}}';
- self::$testArgsJSON['testStruct'] = '{"1":{"rec":{"1":{"str":"worked"},"4":{"i8":1},"9":{"i32":1073741824},"11":{"i64":'.pow( 2, 60 ).'}}}}';
- self::$testArgsJSON['testNest'] = '{"1":{"rec":{"1":{"i8":1},"2":{"rec":{"1":{"str":"worked"},"4":{"i8":1},"9":{"i32":1073741824},"11":{"i64":'.pow( 2, 60 ).'}}},"3":{"i32":32768}}}}';
- } else {
- self::$testArgsJSON['testI64'] = '{"1":{"i64":1152921504606847000}}';
- self::$testArgsJSON['testStruct'] = '{"1":{"rec":{"1":{"str":"worked"},"4":{"i8":1},"9":{"i32":1073741824},"11":{"i64":1152921504606847000}}}}';
- self::$testArgsJSON['testNest'] = '{"1":{"rec":{"1":{"i8":1},"2":{"rec":{"1":{"str":"worked"},"4":{"i8":1},"9":{"i32":1073741824},"11":{"i64":1152921504606847000}}},"3":{"i32":32768}}}}';
- }
-
- self::$testArgsJSON['testMap'] = '{"1":{"map":["i32","i32",3,{"7":77,"8":88,"9":99}]}}';
-
- self::$testArgsJSON['testStringMap'] = '{"1":{"map":["str","str",6,{"a":"123","a b":"with spaces ","same":"same","0":"numeric key","longValue":"Afrikaans, Alemannisch, Aragon\u00e9s, \u0627\u0644\u0639\u0631\u0628\u064a\u0629, \u0645\u0635\u0631\u0649, Asturianu, Aymar aru, Az\u0259rbaycan, \u0411\u0430\u0448\u04a1\u043e\u0440\u0442, Boarisch, \u017demait\u0117\u0161ka, \u0411\u0435\u043b\u0430\u0440\u0443\u0441\u043a\u0430\u044f, \u0411\u0435\u043b\u0430\u0440\u0443\u0441\u043a\u0430\u044f (\u0442\u0430\u0440\u0430\u0448\u043a\u0435\u0432\u0456\u0446\u0430), \u0411\u044a\u043b\u0433\u0430\u0440\u0441\u043a\u0438, Bamanankan, \u09ac\u09be\u0982\u09b2\u09be, Brezhoneg, Bosanski, Catal\u00e0, M\u00ecng-d\u0115\u0324ng-ng\u1e73\u0304, \u041d\u043e\u0445\u0447\u0438\u0439\u043d, Cebuano, \u13e3\u13b3\u13a9, \u010cesky, \u0421\u043b\u043e\u0432\u0463\u0301\u043d\u044c\u0441\u043a\u044a \/ \u2c14\u2c0e\u2c11\u2c02\u2c21\u2c10\u2c20\u2c14\u2c0d\u2c1f, \u0427\u04d1\u0432\u0430\u0448\u043b\u0430, Cymraeg, Dansk, Zazaki, \u078b\u07a8\u0788\u07ac\u0780\u07a8\u0784\u07a6\u0790\u07b0, \u0395\u03bb\u03bb\u03b7\u03bd\u03b9\u03ba\u03ac, Emili\u00e0n e rumagn\u00f2l, English, Esperanto, Espa\u00f1ol, Eesti, Euskara, \u0641\u0627\u0631\u0633\u06cc, Suomi, V\u00f5ro, F\u00f8royskt, Fran\u00e7ais, Arpetan, Furlan, Frysk, Gaeilge, \u8d1b\u8a9e, G\u00e0idhlig, Galego, Ava\u00f1e\'\u1ebd, \u0a97\u0ac1\u0a9c\u0ab0\u0abe\u0aa4\u0ac0, Gaelg, \u05e2\u05d1\u05e8\u05d9\u05ea, \u0939\u093f\u0928\u094d\u0926\u0940, Fiji Hindi, Hrvatski, Krey\u00f2l ayisyen, Magyar, \u0540\u0561\u0575\u0565\u0580\u0565\u0576, Interlingua, Bahasa Indonesia, Ilokano, Ido, \u00cdslenska, Italiano, \u65e5\u672c\u8a9e, Lojban, Basa Jawa, \u10e5\u10d0\u10e0\u10d7\u10e3\u10da\u10d8, Kongo, Kalaallisut, \u0c95\u0ca8\u0ccd\u0ca8\u0ca1, \ud55c\uad6d\uc5b4, \u041a\u044a\u0430\u0440\u0430\u0447\u0430\u0439-\u041c\u0430\u043b\u043a\u044a\u0430\u0440, Ripoarisch, Kurd\u00ee, \u041a\u043e\u043c\u0438, Kernewek, \u041a\u044b\u0440\u0433\u044b\u0437\u0447\u0430, Latina, Ladino, L\u00ebtzebuergesch, Limburgs, Ling\u00e1la, \u0ea5\u0eb2\u0ea7, Lietuvi\u0173, Latvie\u0161u, Basa Banyumasan, Malagasy, \u041c\u0430\u043a\u0435\u0434\u043e\u043d\u0441\u043a\u0438, \u0d2e\u0d32\u0d2f\u0d3e\u0d33\u0d02, \u092e\u0930\u093e\u0920\u0940, Bahasa Melayu, \u0645\u0627\u0632\u0650\u0631\u0648\u0646\u06cc, Nnapulitano, Nedersaksisch, \u0928\u0947\u092a\u093e\u0932 \u092d\u093e\u0937\u093e, Nederlands, \u202aNorsk (nynorsk)\u202c, \u202aNorsk (bokm\u00e5l)\u202c, Nouormand, Din\u00e9 bizaad, Occitan, \u0418\u0440\u043e\u043d\u0430\u0443, Papiamentu, Deitsch, Norfuk \/ Pitkern, Polski, \u067e\u0646\u062c\u0627\u0628\u06cc, \u067e\u069a\u062a\u0648, Portugu\u00eas, Runa Simi, Rumantsch, Romani, Rom\u00e2n\u0103, \u0420\u0443\u0441\u0441\u043a\u0438\u0439, \u0421\u0430\u0445\u0430 \u0442\u044b\u043b\u0430, Sardu, Sicilianu, Scots, S\u00e1megiella, Simple English, Sloven\u010dina, Sloven\u0161\u010dina, \u0421\u0440\u043f\u0441\u043a\u0438 \/ Srpski, Seeltersk, Svenska, Kiswahili, \u0ba4\u0bae\u0bbf\u0bb4\u0bcd, \u0c24\u0c46\u0c32\u0c41\u0c17\u0c41, \u0422\u043e\u04b7\u0438\u043a\u04e3, \u0e44\u0e17\u0e22, T\u00fcrkmen\u00e7e, Tagalog, T\u00fcrk\u00e7e, \u0422\u0430\u0442\u0430\u0440\u0447\u0430\/Tatar\u00e7a, \u0423\u043a\u0440\u0430\u0457\u043d\u0441\u044c\u043a\u0430, \u0627\u0631\u062f\u0648, Ti\u1ebfng Vi\u1ec7t, Volap\u00fck, Walon, Winaray, \u5434\u8bed, isiXhosa, \u05d9\u05d9\u05b4\u05d3\u05d9\u05e9, Yor\u00f9b\u00e1, Ze\u00eauws, \u4e2d\u6587, B\u00e2n-l\u00e2m-g\u00fa, \u7cb5\u8a9e","Afrikaans, Alemannisch, Aragon\u00e9s, \u0627\u0644\u0639\u0631\u0628\u064a\u0629, \u0645\u0635\u0631\u0649, Asturianu, Aymar aru, Az\u0259rbaycan, \u0411\u0430\u0448\u04a1\u043e\u0440\u0442, Boarisch, \u017demait\u0117\u0161ka, \u0411\u0435\u043b\u0430\u0440\u0443\u0441\u043a\u0430\u044f, \u0411\u0435\u043b\u0430\u0440\u0443\u0441\u043a\u0430\u044f (\u0442\u0430\u0440\u0430\u0448\u043a\u0435\u0432\u0456\u0446\u0430), \u0411\u044a\u043b\u0433\u0430\u0440\u0441\u043a\u0438, Bamanankan, \u09ac\u09be\u0982\u09b2\u09be, Brezhoneg, Bosanski, Catal\u00e0, M\u00ecng-d\u0115\u0324ng-ng\u1e73\u0304, \u041d\u043e\u0445\u0447\u0438\u0439\u043d, Cebuano, \u13e3\u13b3\u13a9, \u010cesky, \u0421\u043b\u043e\u0432\u0463\u0301\u043d\u044c\u0441\u043a\u044a \/ \u2c14\u2c0e\u2c11\u2c02\u2c21\u2c10\u2c20\u2c14\u2c0d\u2c1f, \u0427\u04d1\u0432\u0430\u0448\u043b\u0430, Cymraeg, Dansk, Zazaki, \u078b\u07a8\u0788\u07ac\u0780\u07a8\u0784\u07a6\u0790\u07b0, \u0395\u03bb\u03bb\u03b7\u03bd\u03b9\u03ba\u03ac, Emili\u00e0n e rumagn\u00f2l, English, Esperanto, Espa\u00f1ol, Eesti, Euskara, \u0641\u0627\u0631\u0633\u06cc, Suomi, V\u00f5ro, F\u00f8royskt, Fran\u00e7ais, Arpetan, Furlan, Frysk, Gaeilge, \u8d1b\u8a9e, G\u00e0idhlig, Galego, Ava\u00f1e\'\u1ebd, \u0a97\u0ac1\u0a9c\u0ab0\u0abe\u0aa4\u0ac0, Gaelg, \u05e2\u05d1\u05e8\u05d9\u05ea, \u0939\u093f\u0928\u094d\u0926\u0940, Fiji Hindi, Hrvatski, Krey\u00f2l ayisyen, Magyar, \u0540\u0561\u0575\u0565\u0580\u0565\u0576, Interlingua, Bahasa Indonesia, Ilokano, Ido, \u00cdslenska, Italiano, \u65e5\u672c\u8a9e, Lojban, Basa Jawa, \u10e5\u10d0\u10e0\u10d7\u10e3\u10da\u10d8, Kongo, Kalaallisut, \u0c95\u0ca8\u0ccd\u0ca8\u0ca1, \ud55c\uad6d\uc5b4, \u041a\u044a\u0430\u0440\u0430\u0447\u0430\u0439-\u041c\u0430\u043b\u043a\u044a\u0430\u0440, Ripoarisch, Kurd\u00ee, \u041a\u043e\u043c\u0438, Kernewek, \u041a\u044b\u0440\u0433\u044b\u0437\u0447\u0430, Latina, Ladino, L\u00ebtzebuergesch, Limburgs, Ling\u00e1la, \u0ea5\u0eb2\u0ea7, Lietuvi\u0173, Latvie\u0161u, Basa Banyumasan, Malagasy, \u041c\u0430\u043a\u0435\u0434\u043e\u043d\u0441\u043a\u0438, \u0d2e\u0d32\u0d2f\u0d3e\u0d33\u0d02, \u092e\u0930\u093e\u0920\u0940, Bahasa Melayu, \u0645\u0627\u0632\u0650\u0631\u0648\u0646\u06cc, Nnapulitano, Nedersaksisch, \u0928\u0947\u092a\u093e\u0932 \u092d\u093e\u0937\u093e, Nederlands, \u202aNorsk (nynorsk)\u202c, \u202aNorsk (bokm\u00e5l)\u202c, Nouormand, Din\u00e9 bizaad, Occitan, \u0418\u0440\u043e\u043d\u0430\u0443, Papiamentu, Deitsch, Norfuk \/ Pitkern, Polski, \u067e\u0646\u062c\u0627\u0628\u06cc, \u067e\u069a\u062a\u0648, Portugu\u00eas, Runa Simi, Rumantsch, Romani, Rom\u00e2n\u0103, \u0420\u0443\u0441\u0441\u043a\u0438\u0439, \u0421\u0430\u0445\u0430 \u0442\u044b\u043b\u0430, Sardu, Sicilianu, Scots, S\u00e1megiella, Simple English, Sloven\u010dina, Sloven\u0161\u010dina, \u0421\u0440\u043f\u0441\u043a\u0438 \/ Srpski, Seeltersk, Svenska, Kiswahili, \u0ba4\u0bae\u0bbf\u0bb4\u0bcd, \u0c24\u0c46\u0c32\u0c41\u0c17\u0c41, \u0422\u043e\u04b7\u0438\u043a\u04e3, \u0e44\u0e17\u0e22, T\u00fcrkmen\u00e7e, Tagalog, T\u00fcrk\u00e7e, \u0422\u0430\u0442\u0430\u0440\u0447\u0430\/Tatar\u00e7a, \u0423\u043a\u0440\u0430\u0457\u043d\u0441\u044c\u043a\u0430, \u0627\u0631\u062f\u0648, Ti\u1ebfng Vi\u1ec7t, Volap\u00fck, Walon, Winaray, \u5434\u8bed, isiXhosa, \u05d9\u05d9\u05b4\u05d3\u05d9\u05e9, Yor\u00f9b\u00e1, Ze\u00eauws, \u4e2d\u6587, B\u00e2n-l\u00e2m-g\u00fa, \u7cb5\u8a9e":"long key"}]}}';
-
- self::$testArgsJSON['testSet'] = '{"1":{"set":["i32",3,1,5,6]}}';
-
- self::$testArgsJSON['testList'] = '{"1":{"lst":["i32",3,1,2,3]}}';
-
- self::$testArgsJSON['testEnum'] = '{"1":{"i32":1}}';
-
- self::$testArgsJSON['testTypedef'] = '{"1":{"i64":69}}';
-
- self::$testArgsJSON['testMapMap'] = '{"0":{"map":["i32","map",2,{"4":["i32","i32",4,{"1":1,"2":2,"3":3,"4":4}],"-4":["i32","i32",4,{"-4":-4,"-3":-3,"-2":-2,"-1":-1}]}]}}';
-
- self::$testArgsJSON['testInsanity'] = '{"0":{"map":["i64","map",2,{"1":["i32","rec",2,{"2":{"1":{"map":["i32","i64",2,{"5":5,"8":8}]},"2":{"lst":["rec",2,{"1":{"str":"Goodbye4"},"4":{"i8":4},"9":{"i32":4},"11":{"i64":4}},{"1":{"str":"Hello2"},"4":{"i8":2},"9":{"i32":2},"11":{"i64":2}}]}},"3":{"1":{"map":["i32","i64",2,{"5":5,"8":8}]},"2":{"lst":["rec",2,{"1":{"str":"Goodbye4"},"4":{"i8":4},"9":{"i32":4},"11":{"i64":4}},{"1":{"str":"Hello2"},"4":{"i8":2},"9":{"i32":2},"11":{"i64":2}}]}}}],"2":["i32","rec",1,{"6":{}}]}]}}';
-
- }
-}
diff --git a/lib/php/test/Protocol/TestTSimpleJSONProtocol.php b/lib/php/test/Protocol/TestTSimpleJSONProtocol.php
deleted file mode 100644
index 1f696a5bc..000000000
--- a/lib/php/test/Protocol/TestTSimpleJSONProtocol.php
+++ /dev/null
@@ -1,298 +0,0 @@
-<?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.
- *
- * @package thrift.test
- */
-
-namespace test\Thrift\Protocol;
-
-use Thrift\ClassLoader\ThriftClassLoader;
-use Test\Thrift\Fixtures;
-use Thrift\Transport\TMemoryBuffer;
-use Thrift\Protocol\TSimpleJSONProtocol;
-
-define( 'BUFSIZ', 8192 ); //big enough to read biggest serialized Fixture arg.
-
-require_once __DIR__.'/../../../../vendor/autoload.php';
-
-$loader = new ThriftClassLoader();
-$loader->registerDefinition('ThriftTest', __DIR__ . '/../packages');
-$loader->register();
-
-/***
- * This test suite depends on running the compiler against the
- * standard ThriftTest.thrift file:
- *
- * lib/php/test$ ../../../compiler/cpp/thrift --gen php -r \
- * --out ./packages ../../../test/ThriftTest.thrift
- */
-
-class TestTSimpleJSONProtocol extends \PHPUnit_Framework_TestCase
-{
- private $transport;
- private $protocol;
-
- public static function setUpBeforeClass()
- {
- Fixtures::populateTestArgs();
- TestTSimpleJSONProtocol_Fixtures::populateTestArgsSimpleJSON();
- }
-
- public function setUp()
- {
- $this->transport = new TMemoryBuffer();
- $this->protocol = new TSimpleJSONProtocol($this->transport);
- $this->transport->open();
- }
-
- /***
- * WRITE TESTS
- */
-
- public function testVoid_Write()
- {
- $args = new \ThriftTest\ThriftTest_testVoid_args();
- $args->write( $this->protocol );
-
- $actual = $this->transport->read( BUFSIZ );
- $expected = TestTSimpleJSONProtocol_Fixtures::$testArgsJSON['testVoid'];
-
- $this->assertEquals( $expected, $actual );
- }
-
- public function testString1_Write()
- {
- $args = new \ThriftTest\ThriftTest_testString_args();
- $args->thing = Fixtures::$testArgs['testString1'];
- $args->write( $this->protocol );
-
- $actual = $this->transport->read( BUFSIZ );
- $expected = TestTSimpleJSONProtocol_Fixtures::$testArgsJSON['testString1'];
-
- #$this->assertEquals( $expected, $actual );
- }
-
- public function testString2_Write()
- {
- $args = new \ThriftTest\ThriftTest_testString_args();
- $args->thing = Fixtures::$testArgs['testString2'];
- $args->write( $this->protocol );
-
- $actual = $this->transport->read( BUFSIZ );
- $expected = TestTSimpleJSONProtocol_Fixtures::$testArgsJSON['testString2'];
-
- $this->assertEquals( $expected, $actual );
- }
-
- public function testDouble_Write()
- {
- $args = new \ThriftTest\ThriftTest_testDouble_args();
- $args->thing = Fixtures::$testArgs['testDouble'];
- $args->write( $this->protocol );
-
- $actual = $this->transport->read( BUFSIZ );
- $expected = TestTSimpleJSONProtocol_Fixtures::$testArgsJSON['testDouble'];
-
- $this->assertEquals( $expected, $actual );
- }
-
- public function testByte_Write()
- {
- $args = new \ThriftTest\ThriftTest_testByte_args();
- $args->thing = Fixtures::$testArgs['testByte'];
- $args->write( $this->protocol );
-
- $actual = $this->transport->read( BUFSIZ );
- $expected = TestTSimpleJSONProtocol_Fixtures::$testArgsJSON['testByte'];
-
- $this->assertEquals( $expected, $actual );
- }
-
- public function testI32_Write()
- {
- $args = new \ThriftTest\ThriftTest_testI32_args();
- $args->thing = Fixtures::$testArgs['testI32'];
- $args->write( $this->protocol );
-
- $actual = $this->transport->read( BUFSIZ );
- $expected = TestTSimpleJSONProtocol_Fixtures::$testArgsJSON['testI32'];
-
- $this->assertEquals( $expected, $actual );
- }
-
- public function testI64_Write()
- {
- $args = new \ThriftTest\ThriftTest_testI64_args();
- $args->thing = Fixtures::$testArgs['testI64'];
- $args->write( $this->protocol );
-
- $actual = $this->transport->read( BUFSIZ );
- $expected = TestTSimpleJSONProtocol_Fixtures::$testArgsJSON['testI64'];
-
- $this->assertEquals( $expected, $actual );
- }
-
- public function testStruct_Write()
- {
- $args = new \ThriftTest\ThriftTest_testStruct_args();
- $args->thing = Fixtures::$testArgs['testStruct'];
-
- $args->write( $this->protocol );
-
- $actual = $this->transport->read( BUFSIZ );
- $expected = TestTSimpleJSONProtocol_Fixtures::$testArgsJSON['testStruct'];
-
- $this->assertEquals( $expected, $actual );
- }
-
- public function testNest_Write()
- {
- $args = new \ThriftTest\ThriftTest_testNest_args();
- $args->thing = Fixtures::$testArgs['testNest'];
-
- $args->write( $this->protocol );
-
- $actual = $this->transport->read( BUFSIZ );
- $expected = TestTSimpleJSONProtocol_Fixtures::$testArgsJSON['testNest'];
-
- $this->assertEquals( $expected, $actual );
- }
-
- public function testMap_Write()
- {
- $args = new \ThriftTest\ThriftTest_testMap_args();
- $args->thing = Fixtures::$testArgs['testMap'];
-
- $args->write( $this->protocol );
-
- $actual = $this->transport->read( BUFSIZ );
- $expected = TestTSimpleJSONProtocol_Fixtures::$testArgsJSON['testMap'];
-
- $this->assertEquals( $expected, $actual );
- }
-
- public function testStringMap_Write()
- {
- $args = new \ThriftTest\ThriftTest_testStringMap_args();
- $args->thing = Fixtures::$testArgs['testStringMap'];
-
- $args->write( $this->protocol );
-
- $actual = $this->transport->read( BUFSIZ );
- $expected = TestTSimpleJSONProtocol_Fixtures::$testArgsJSON['testStringMap'];
-
- $this->assertEquals( $expected, $actual );
- }
-
- public function testSet_Write()
- {
- $args = new \ThriftTest\ThriftTest_testSet_args();
- $args->thing = Fixtures::$testArgs['testSet'];
-
- $args->write( $this->protocol );
-
- $actual = $this->transport->read( BUFSIZ );
- $expected = TestTSimpleJSONProtocol_Fixtures::$testArgsJSON['testSet'];
-
- $this->assertEquals( $expected, $actual );
- }
-
- public function testList_Write()
- {
- $args = new \ThriftTest\ThriftTest_testList_args();
- $args->thing = Fixtures::$testArgs['testList'];
-
- $args->write( $this->protocol );
-
- $actual = $this->transport->read( BUFSIZ );
- $expected = TestTSimpleJSONProtocol_Fixtures::$testArgsJSON['testList'];
-
- $this->assertEquals( $expected, $actual );
- }
-
- public function testEnum_Write()
- {
- $args = new \ThriftTest\ThriftTest_testEnum_args();
- $args->thing = Fixtures::$testArgs['testEnum'];
-
- $args->write( $this->protocol );
-
- $actual = $this->transport->read( BUFSIZ );
- $expected = TestTSimpleJSONProtocol_Fixtures::$testArgsJSON['testEnum'];
-
- $this->assertEquals( $expected, $actual );
- }
-
- public function testTypedef_Write()
- {
- $args = new \ThriftTest\ThriftTest_testTypedef_args();
- $args->thing = Fixtures::$testArgs['testTypedef'];
-
- $args->write( $this->protocol );
-
- $actual = $this->transport->read( BUFSIZ );
- $expected = TestTSimpleJSONProtocol_Fixtures::$testArgsJSON['testTypedef'];
-
- $this->assertEquals( $expected, $actual );
- }
-}
-
-class TestTSimpleJSONProtocol_Fixtures
-{
- public static $testArgsJSON = array();
-
- public static function populateTestArgsSimpleJSON()
- {
- self::$testArgsJSON['testVoid'] = '{}';
-
- self::$testArgsJSON['testString1'] = '{"1":{"str":"Afrikaans, Alemannisch, Aragon\u00e9s, \u0627\u0644\u0639\u0631\u0628\u064a\u0629, \u0645\u0635\u0631\u0649, Asturianu, Aymar aru, Az\u0259rbaycan, \u0411\u0430\u0448\u04a1\u043e\u0440\u0442, Boarisch, \u017demait\u0117\u0161ka, \u0411\u0435\u043b\u0430\u0440\u0443\u0441\u043a\u0430\u044f, \u0411\u0435\u043b\u0430\u0440\u0443\u0441\u043a\u0430\u044f (\u0442\u0430\u0440\u0430\u0448\u043a\u0435\u0432\u0456\u0446\u0430), \u0411\u044a\u043b\u0433\u0430\u0440\u0441\u043a\u0438, Bamanankan, \u09ac\u09be\u0982\u09b2\u09be, Brezhoneg, Bosanski, Catal\u00e0, M\u00ecng-d\u0115\u0324ng-ng\u1e73\u0304, \u041d\u043e\u0445\u0447\u0438\u0439\u043d, Cebuano, \u13e3\u13b3\u13a9, \u010cesky, \u0421\u043b\u043e\u0432\u0463\u0301\u043d\u044c\u0441\u043a\u044a \/ \u2c14\u2c0e\u2c11\u2c02\u2c21\u2c10\u2c20\u2c14\u2c0d\u2c1f, \u0427\u04d1\u0432\u0430\u0448\u043b\u0430, Cymraeg, Dansk, Zazaki, \u078b\u07a8\u0788\u07ac\u0780\u07a8\u0784\u07a6\u0790\u07b0, \u0395\u03bb\u03bb\u03b7\u03bd\u03b9\u03ba\u03ac, Emili\u00e0n e rumagn\u00f2l, English, Esperanto, Espa\u00f1ol, Eesti, Euskara, \u0641\u0627\u0631\u0633\u06cc, Suomi, V\u00f5ro, F\u00f8royskt, Fran\u00e7ais, Arpetan, Furlan, Frysk, Gaeilge, \u8d1b\u8a9e, G\u00e0idhlig, Galego, Ava\u00f1e\'\u1ebd, \u0a97\u0ac1\u0a9c\u0ab0\u0abe\u0aa4\u0ac0, Gaelg, \u05e2\u05d1\u05e8\u05d9\u05ea, \u0939\u093f\u0928\u094d\u0926\u0940, Fiji Hindi, Hrvatski, Krey\u00f2l ayisyen, Magyar, \u0540\u0561\u0575\u0565\u0580\u0565\u0576, Interlingua, Bahasa Indonesia, Ilokano, Ido, \u00cdslenska, Italiano, \u65e5\u672c\u8a9e, Lojban, Basa Jawa, \u10e5\u10d0\u10e0\u10d7\u10e3\u10da\u10d8, Kongo, Kalaallisut, \u0c95\u0ca8\u0ccd\u0ca8\u0ca1, \ud55c\uad6d\uc5b4, \u041a\u044a\u0430\u0440\u0430\u0447\u0430\u0439-\u041c\u0430\u043b\u043a\u044a\u0430\u0440, Ripoarisch, Kurd\u00ee, \u041a\u043e\u043c\u0438, Kernewek, \u041a\u044b\u0440\u0433\u044b\u0437\u0447\u0430, Latina, Ladino, L\u00ebtzebuergesch, Limburgs, Ling\u00e1la, \u0ea5\u0eb2\u0ea7, Lietuvi\u0173, Latvie\u0161u, Basa Banyumasan, Malagasy, \u041c\u0430\u043a\u0435\u0434\u043e\u043d\u0441\u043a\u0438, \u0d2e\u0d32\u0d2f\u0d3e\u0d33\u0d02, \u092e\u0930\u093e\u0920\u0940, Bahasa Melayu, \u0645\u0627\u0632\u0650\u0631\u0648\u0646\u06cc, Nnapulitano, Nedersaksisch, \u0928\u0947\u092a\u093e\u0932 \u092d\u093e\u0937\u093e, Nederlands, \u202aNorsk (nynorsk)\u202c, \u202aNorsk (bokm\u00e5l)\u202c, Nouormand, Din\u00e9 bizaad, Occitan, \u0418\u0440\u043e\u043d\u0430\u0443, Papiamentu, Deitsch, Norfuk \/ Pitkern, Polski, \u067e\u0646\u062c\u0627\u0628\u06cc, \u067e\u069a\u062a\u0648, Portugu\u00eas, Runa Simi, Rumantsch, Romani, Rom\u00e2n\u0103, \u0420\u0443\u0441\u0441\u043a\u0438\u0439, \u0421\u0430\u0445\u0430 \u0442\u044b\u043b\u0430, Sardu, Sicilianu, Scots, S\u00e1megiella, Simple English, Sloven\u010dina, Sloven\u0161\u010dina, \u0421\u0440\u043f\u0441\u043a\u0438 \/ Srpski, Seeltersk, Svenska, Kiswahili, \u0ba4\u0bae\u0bbf\u0bb4\u0bcd, \u0c24\u0c46\u0c32\u0c41\u0c17\u0c41, \u0422\u043e\u04b7\u0438\u043a\u04e3, \u0e44\u0e17\u0e22, T\u00fcrkmen\u00e7e, Tagalog, T\u00fcrk\u00e7e, \u0422\u0430\u0442\u0430\u0440\u0447\u0430\/Tatar\u00e7a, \u0423\u043a\u0440\u0430\u0457\u043d\u0441\u044c\u043a\u0430, \u0627\u0631\u062f\u0648, Ti\u1ebfng Vi\u1ec7t, Volap\u00fck, Walon, Winaray, \u5434\u8bed, isiXhosa, \u05d9\u05d9\u05b4\u05d3\u05d9\u05e9, Yor\u00f9b\u00e1, Ze\u00eauws, \u4e2d\u6587, B\u00e2n-l\u00e2m-g\u00fa, \u7cb5\u8a9e"}}';
-
- self::$testArgsJSON['testString2'] = '{"thing":"quote: \\\\\" backslash: forwardslash-escaped: \\\\\/ backspace: \\\\b formfeed: \f newline: \n return: \r tab: now-all-of-them-together: \"\\\\\\\\\/\\\\b\n\r\t now-a-bunch-of-junk: !@#$%&()(&%$#{}{}<><><"}';
-
- self::$testArgsJSON['testDouble'] = '{"thing":3.1415926535898}';
-
- self::$testArgsJSON['testByte'] = '{"thing":1}';
-
- self::$testArgsJSON['testI32'] = '{"thing":1073741824}';
-
- if (PHP_INT_SIZE == 8) {
- self::$testArgsJSON['testI64'] = '{"thing":'.pow( 2, 60 ).'}';
- self::$testArgsJSON['testStruct'] = '{"thing":{"string_thing":"worked","byte_thing":1,"i32_thing":1073741824,"i64_thing":'.pow( 2, 60 ).'}}';
- self::$testArgsJSON['testNest'] = '{"thing":{"byte_thing":1,"struct_thing":{"string_thing":"worked","byte_thing":1,"i32_thing":1073741824,"i64_thing":'.pow( 2, 60 ).'},"i32_thing":32768}}';
- } else {
- self::$testArgsJSON['testI64'] = '{"thing":1152921504606847000}';
-
- self::$testArgsJSON['testStruct'] = '{"thing":{"string_thing":"worked","byte_thing":1,"i32_thing":1073741824,"i64_thing":1152921504606847000}}';
- self::$testArgsJSON['testNest'] = '{"thing":{"byte_thing":1,"struct_thing":{"string_thing":"worked","byte_thing":1,"i32_thing":1073741824,"i64_thing":1152921504606847000},"i32_thing":32768}}';
- }
-
- self::$testArgsJSON['testMap'] = '{"thing":{"7":77,"8":88,"9":99}}';
-
- self::$testArgsJSON['testStringMap'] = '{"thing":{"a":"123","a b":"with spaces ","same":"same","0":"numeric key","longValue":"Afrikaans, Alemannisch, Aragon\u00e9s, \u0627\u0644\u0639\u0631\u0628\u064a\u0629, \u0645\u0635\u0631\u0649, Asturianu, Aymar aru, Az\u0259rbaycan, \u0411\u0430\u0448\u04a1\u043e\u0440\u0442, Boarisch, \u017demait\u0117\u0161ka, \u0411\u0435\u043b\u0430\u0440\u0443\u0441\u043a\u0430\u044f, \u0411\u0435\u043b\u0430\u0440\u0443\u0441\u043a\u0430\u044f (\u0442\u0430\u0440\u0430\u0448\u043a\u0435\u0432\u0456\u0446\u0430), \u0411\u044a\u043b\u0433\u0430\u0440\u0441\u043a\u0438, Bamanankan, \u09ac\u09be\u0982\u09b2\u09be, Brezhoneg, Bosanski, Catal\u00e0, M\u00ecng-d\u0115\u0324ng-ng\u1e73\u0304, \u041d\u043e\u0445\u0447\u0438\u0439\u043d, Cebuano, \u13e3\u13b3\u13a9, \u010cesky, \u0421\u043b\u043e\u0432\u0463\u0301\u043d\u044c\u0441\u043a\u044a \/ \u2c14\u2c0e\u2c11\u2c02\u2c21\u2c10\u2c20\u2c14\u2c0d\u2c1f, \u0427\u04d1\u0432\u0430\u0448\u043b\u0430, Cymraeg, Dansk, Zazaki, \u078b\u07a8\u0788\u07ac\u0780\u07a8\u0784\u07a6\u0790\u07b0, \u0395\u03bb\u03bb\u03b7\u03bd\u03b9\u03ba\u03ac, Emili\u00e0n e rumagn\u00f2l, English, Esperanto, Espa\u00f1ol, Eesti, Euskara, \u0641\u0627\u0631\u0633\u06cc, Suomi, V\u00f5ro, F\u00f8royskt, Fran\u00e7ais, Arpetan, Furlan, Frysk, Gaeilge, \u8d1b\u8a9e, G\u00e0idhlig, Galego, Ava\u00f1e\'\u1ebd, \u0a97\u0ac1\u0a9c\u0ab0\u0abe\u0aa4\u0ac0, Gaelg, \u05e2\u05d1\u05e8\u05d9\u05ea, \u0939\u093f\u0928\u094d\u0926\u0940, Fiji Hindi, Hrvatski, Krey\u00f2l ayisyen, Magyar, \u0540\u0561\u0575\u0565\u0580\u0565\u0576, Interlingua, Bahasa Indonesia, Ilokano, Ido, \u00cdslenska, Italiano, \u65e5\u672c\u8a9e, Lojban, Basa Jawa, \u10e5\u10d0\u10e0\u10d7\u10e3\u10da\u10d8, Kongo, Kalaallisut, \u0c95\u0ca8\u0ccd\u0ca8\u0ca1, \ud55c\uad6d\uc5b4, \u041a\u044a\u0430\u0440\u0430\u0447\u0430\u0439-\u041c\u0430\u043b\u043a\u044a\u0430\u0440, Ripoarisch, Kurd\u00ee, \u041a\u043e\u043c\u0438, Kernewek, \u041a\u044b\u0440\u0433\u044b\u0437\u0447\u0430, Latina, Ladino, L\u00ebtzebuergesch, Limburgs, Ling\u00e1la, \u0ea5\u0eb2\u0ea7, Lietuvi\u0173, Latvie\u0161u, Basa Banyumasan, Malagasy, \u041c\u0430\u043a\u0435\u0434\u043e\u043d\u0441\u043a\u0438, \u0d2e\u0d32\u0d2f\u0d3e\u0d33\u0d02, \u092e\u0930\u093e\u0920\u0940, Bahasa Melayu, \u0645\u0627\u0632\u0650\u0631\u0648\u0646\u06cc, Nnapulitano, Nedersaksisch, \u0928\u0947\u092a\u093e\u0932 \u092d\u093e\u0937\u093e, Nederlands, \u202aNorsk (nynorsk)\u202c, \u202aNorsk (bokm\u00e5l)\u202c, Nouormand, Din\u00e9 bizaad, Occitan, \u0418\u0440\u043e\u043d\u0430\u0443, Papiamentu, Deitsch, Norfuk \/ Pitkern, Polski, \u067e\u0646\u062c\u0627\u0628\u06cc, \u067e\u069a\u062a\u0648, Portugu\u00eas, Runa Simi, Rumantsch, Romani, Rom\u00e2n\u0103, \u0420\u0443\u0441\u0441\u043a\u0438\u0439, \u0421\u0430\u0445\u0430 \u0442\u044b\u043b\u0430, Sardu, Sicilianu, Scots, S\u00e1megiella, Simple English, Sloven\u010dina, Sloven\u0161\u010dina, \u0421\u0440\u043f\u0441\u043a\u0438 \/ Srpski, Seeltersk, Svenska, Kiswahili, \u0ba4\u0bae\u0bbf\u0bb4\u0bcd, \u0c24\u0c46\u0c32\u0c41\u0c17\u0c41, \u0422\u043e\u04b7\u0438\u043a\u04e3, \u0e44\u0e17\u0e22, T\u00fcrkmen\u00e7e, Tagalog, T\u00fcrk\u00e7e, \u0422\u0430\u0442\u0430\u0440\u0447\u0430\/Tatar\u00e7a, \u0423\u043a\u0440\u0430\u0457\u043d\u0441\u044c\u043a\u0430, \u0627\u0631\u062f\u0648, Ti\u1ebfng Vi\u1ec7t, Volap\u00fck, Walon, Winaray, \u5434\u8bed, isiXhosa, \u05d9\u05d9\u05b4\u05d3\u05d9\u05e9, Yor\u00f9b\u00e1, Ze\u00eauws, \u4e2d\u6587, B\u00e2n-l\u00e2m-g\u00fa, \u7cb5\u8a9e","Afrikaans, Alemannisch, Aragon\u00e9s, \u0627\u0644\u0639\u0631\u0628\u064a\u0629, \u0645\u0635\u0631\u0649, Asturianu, Aymar aru, Az\u0259rbaycan, \u0411\u0430\u0448\u04a1\u043e\u0440\u0442, Boarisch, \u017demait\u0117\u0161ka, \u0411\u0435\u043b\u0430\u0440\u0443\u0441\u043a\u0430\u044f, \u0411\u0435\u043b\u0430\u0440\u0443\u0441\u043a\u0430\u044f (\u0442\u0430\u0440\u0430\u0448\u043a\u0435\u0432\u0456\u0446\u0430), \u0411\u044a\u043b\u0433\u0430\u0440\u0441\u043a\u0438, Bamanankan, \u09ac\u09be\u0982\u09b2\u09be, Brezhoneg, Bosanski, Catal\u00e0, M\u00ecng-d\u0115\u0324ng-ng\u1e73\u0304, \u041d\u043e\u0445\u0447\u0438\u0439\u043d, Cebuano, \u13e3\u13b3\u13a9, \u010cesky, \u0421\u043b\u043e\u0432\u0463\u0301\u043d\u044c\u0441\u043a\u044a \/ \u2c14\u2c0e\u2c11\u2c02\u2c21\u2c10\u2c20\u2c14\u2c0d\u2c1f, \u0427\u04d1\u0432\u0430\u0448\u043b\u0430, Cymraeg, Dansk, Zazaki, \u078b\u07a8\u0788\u07ac\u0780\u07a8\u0784\u07a6\u0790\u07b0, \u0395\u03bb\u03bb\u03b7\u03bd\u03b9\u03ba\u03ac, Emili\u00e0n e rumagn\u00f2l, English, Esperanto, Espa\u00f1ol, Eesti, Euskara, \u0641\u0627\u0631\u0633\u06cc, Suomi, V\u00f5ro, F\u00f8royskt, Fran\u00e7ais, Arpetan, Furlan, Frysk, Gaeilge, \u8d1b\u8a9e, G\u00e0idhlig, Galego, Ava\u00f1e\'\u1ebd, \u0a97\u0ac1\u0a9c\u0ab0\u0abe\u0aa4\u0ac0, Gaelg, \u05e2\u05d1\u05e8\u05d9\u05ea, \u0939\u093f\u0928\u094d\u0926\u0940, Fiji Hindi, Hrvatski, Krey\u00f2l ayisyen, Magyar, \u0540\u0561\u0575\u0565\u0580\u0565\u0576, Interlingua, Bahasa Indonesia, Ilokano, Ido, \u00cdslenska, Italiano, \u65e5\u672c\u8a9e, Lojban, Basa Jawa, \u10e5\u10d0\u10e0\u10d7\u10e3\u10da\u10d8, Kongo, Kalaallisut, \u0c95\u0ca8\u0ccd\u0ca8\u0ca1, \ud55c\uad6d\uc5b4, \u041a\u044a\u0430\u0440\u0430\u0447\u0430\u0439-\u041c\u0430\u043b\u043a\u044a\u0430\u0440, Ripoarisch, Kurd\u00ee, \u041a\u043e\u043c\u0438, Kernewek, \u041a\u044b\u0440\u0433\u044b\u0437\u0447\u0430, Latina, Ladino, L\u00ebtzebuergesch, Limburgs, Ling\u00e1la, \u0ea5\u0eb2\u0ea7, Lietuvi\u0173, Latvie\u0161u, Basa Banyumasan, Malagasy, \u041c\u0430\u043a\u0435\u0434\u043e\u043d\u0441\u043a\u0438, \u0d2e\u0d32\u0d2f\u0d3e\u0d33\u0d02, \u092e\u0930\u093e\u0920\u0940, Bahasa Melayu, \u0645\u0627\u0632\u0650\u0631\u0648\u0646\u06cc, Nnapulitano, Nedersaksisch, \u0928\u0947\u092a\u093e\u0932 \u092d\u093e\u0937\u093e, Nederlands, \u202aNorsk (nynorsk)\u202c, \u202aNorsk (bokm\u00e5l)\u202c, Nouormand, Din\u00e9 bizaad, Occitan, \u0418\u0440\u043e\u043d\u0430\u0443, Papiamentu, Deitsch, Norfuk \/ Pitkern, Polski, \u067e\u0646\u062c\u0627\u0628\u06cc, \u067e\u069a\u062a\u0648, Portugu\u00eas, Runa Simi, Rumantsch, Romani, Rom\u00e2n\u0103, \u0420\u0443\u0441\u0441\u043a\u0438\u0439, \u0421\u0430\u0445\u0430 \u0442\u044b\u043b\u0430, Sardu, Sicilianu, Scots, S\u00e1megiella, Simple English, Sloven\u010dina, Sloven\u0161\u010dina, \u0421\u0440\u043f\u0441\u043a\u0438 \/ Srpski, Seeltersk, Svenska, Kiswahili, \u0ba4\u0bae\u0bbf\u0bb4\u0bcd, \u0c24\u0c46\u0c32\u0c41\u0c17\u0c41, \u0422\u043e\u04b7\u0438\u043a\u04e3, \u0e44\u0e17\u0e22, T\u00fcrkmen\u00e7e, Tagalog, T\u00fcrk\u00e7e, \u0422\u0430\u0442\u0430\u0440\u0447\u0430\/Tatar\u00e7a, \u0423\u043a\u0440\u0430\u0457\u043d\u0441\u044c\u043a\u0430, \u0627\u0631\u062f\u0648, Ti\u1ebfng Vi\u1ec7t, Volap\u00fck, Walon, Winaray, \u5434\u8bed, isiXhosa, \u05d9\u05d9\u05b4\u05d3\u05d9\u05e9, Yor\u00f9b\u00e1, Ze\u00eauws, \u4e2d\u6587, B\u00e2n-l\u00e2m-g\u00fa, \u7cb5\u8a9e":"long key"}}';
-
- self::$testArgsJSON['testSet'] = '{"thing":[1,5,6]}';
-
- self::$testArgsJSON['testList'] = '{"thing":[1,2,3]}';
-
- self::$testArgsJSON['testEnum'] = '{"thing":1}';
-
- self::$testArgsJSON['testTypedef'] = '{"thing":69}';
- }
-}
diff --git a/lib/php/test/TestValidators.php b/lib/php/test/TestValidators.php
deleted file mode 100644
index 84c01f896..000000000
--- a/lib/php/test/TestValidators.php
+++ /dev/null
@@ -1,155 +0,0 @@
-<?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;
-
-require_once __DIR__.'/../../../vendor/autoload.php';
-
-use Thrift\ClassLoader\ThriftClassLoader;
-use Thrift\Exception\TProtocolException;
-use Thrift\Protocol\TBinaryProtocol;
-use Thrift\Transport\TMemoryBuffer;
-
-$oop_mode = (isset($argv[1]) && $argv[1] === '-oop');
-$GEN_DIR = $oop_mode ? 'phpvo' : 'phpv';
-
-$loader = new ThriftClassLoader();
-$loader->registerDefinition('ThriftTest', __DIR__ . '/packages/' . $GEN_DIR);
-$loader->registerDefinition('TestValidators', __DIR__ . '/packages/' . $GEN_DIR);
-$loader->register();
-
-// Would be nice to have PHPUnit here, but for now just hack it.
-
-set_exception_handler(function ($e) {
- my_assert(false, "Unexpected exception caught: " . $e->getMessage());
-});
-
-set_error_handler(function ($errno, $errmsg) {
- my_assert(false, "Unexpected PHP error: " . $errmsg);
-});
-
-// Empty structs should not have validators
-assert_has_no_read_validator('ThriftTest\EmptyStruct');
-assert_has_no_write_validator('ThriftTest\EmptyStruct');
-
-// Bonk has only opt_in_req_out fields
-{
- assert_has_no_read_validator('ThriftTest\Bonk');
- assert_has_a_write_validator('ThriftTest\Bonk');
- {
- // Check that we can read an empty object
- $bonk = new \ThriftTest\Bonk();
- $transport = new TMemoryBuffer("\000");
- $protocol = new TBinaryProtocol($transport);
- $bonk->read($protocol);
- }
- {
- // ...but not write an empty object
- $bonk = new \ThriftTest\Bonk();
- $transport = new TMemoryBuffer();
- $protocol = new TBinaryProtocol($transport);
- assert_protocol_exception_thrown(function () use ($bonk, $protocol) { $bonk->write($protocol); },
- 'Bonk was able to write an empty object');
- }
-}
-
-// StructA has a single required field
-{
- assert_has_a_read_validator('ThriftTest\StructA');
- assert_has_a_write_validator('ThriftTest\StructA');
- {
- // Check that we are not able to write StructA with a missing required field
- $structa = new \ThriftTest\StructA();
- $transport = new TMemoryBuffer();
- $protocol = new TBinaryProtocol($transport);
- assert_protocol_exception_thrown(function () use ($structa, $protocol) { $structa->write($protocol); },
- 'StructA was able to write an empty object');
- }
- {
- // Check that we are able to read and write a message with a good StructA
- $transport = new TMemoryBuffer(base64_decode('CwABAAAAA2FiYwA='));
- $protocol = new TBinaryProtocol($transport);
- $structa = new \ThriftTest\StructA();
- $structa->read($protocol);
- $structa->write($protocol);
- }
-}
-
-// Unions should not get write validators
-assert_has_no_write_validator('TestValidators\UnionOfStrings');
-
-// Service _result classes should not get any validators
-assert_has_no_read_validator('TestValidators\TestService_test_result');
-assert_has_no_write_validator('TestValidators\TestService_test_result');
-
-function assert_has_a_read_validator($class)
-{
- my_assert(has_read_validator_method($class),
- $class . ' class should have a read validator');
-}
-
-function assert_has_no_read_validator($class)
-{
- my_assert(!has_read_validator_method($class),
- $class . ' class should not have a read validator');
-}
-
-function assert_has_a_write_validator($class)
-{
- my_assert(has_write_validator_method($class),
- $class . ' class should have a write validator');
-}
-
-function assert_has_no_write_validator($class)
-{
- my_assert(!has_write_validator_method($class),
- $class . ' class should not have a write validator');
-}
-
-function assert_protocol_exception_thrown($callable, $message)
-{
- try {
- call_user_func($callable);
- my_assert(false, $message);
- } catch (TProtocolException $e) {
- }
-}
-
-function has_write_validator_method($class)
-{
- $rc = new \ReflectionClass($class);
-
- return $rc->hasMethod('_validateForWrite');
-}
-
-function has_read_validator_method($class)
-{
- $rc = new \ReflectionClass($class);
-
- return $rc->hasMethod('_validateForRead');
-}
-
-function my_assert($something, $message)
-{
- if (!$something) {
- fwrite(STDERR, basename(__FILE__) . " FAILED: $message\n");
- exit(1);
- }
-}
diff --git a/lib/php/test/Validator/BaseValidatorTest.php b/lib/php/test/Validator/BaseValidatorTest.php
new file mode 100644
index 000000000..60290830e
--- /dev/null
+++ b/lib/php/test/Validator/BaseValidatorTest.php
@@ -0,0 +1,154 @@
+<?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;
+
+use PHPUnit\Framework\TestCase;
+use Thrift\Exception\TProtocolException;
+use Thrift\Protocol\TBinaryProtocol;
+use Thrift\Transport\TMemoryBuffer;
+
+abstract class BaseValidatorTest extends TestCase
+{
+ public function testEmptyStructValidator()
+ {
+ $this->assertNoReadValidator('ThriftTest\EmptyStruct');
+ $this->assertNoWriteValidator('ThriftTest\EmptyStruct');
+ }
+
+ public function testBonkValidator()
+ {
+ $this->assertNoReadValidator('ThriftTest\Bonk');
+ $this->assertHasWriteValidator('ThriftTest\Bonk');
+ }
+
+ public function testStructAValidator()
+ {
+ $this->assertHasReadValidator('ThriftTest\StructA');
+ $this->assertHasWriteValidator('ThriftTest\StructA');
+ }
+
+ public function testUnionOfStringsValidator()
+ {
+ $this->assertNoWriteValidator('TestValidators\UnionOfStrings');
+ }
+
+ public function testServiceResultValidator()
+ {
+ $this->assertNoReadValidator('TestValidators\TestService_test_result');
+ $this->assertNoWriteValidator('TestValidators\TestService_test_result');
+ }
+
+ public function testReadEmpty()
+ {
+ $bonk = new \ThriftTest\Bonk();
+ $transport = new TMemoryBuffer("\000");
+ $protocol = new TBinaryProtocol($transport);
+ $bonk->read($protocol);
+ }
+
+ public function testWriteEmpty()
+ {
+ $bonk = new \ThriftTest\Bonk();
+ $transport = new TMemoryBuffer();
+ $protocol = new TBinaryProtocol($transport);
+ try {
+ $bonk->write($protocol);
+ $this->fail('Bonk was able to write an empty object');
+ } catch (TProtocolException $e) {
+ }
+ }
+
+ public function testWriteWithMissingRequired()
+ {
+ // Check that we are not able to write StructA with a missing required field
+ $structa = new \ThriftTest\StructA();
+ $transport = new TMemoryBuffer();
+ $protocol = new TBinaryProtocol($transport);
+
+ try {
+ $structa->write($protocol);
+ $this->fail('StructA was able to write an empty object');
+ } catch (TProtocolException $e) {
+ }
+ }
+
+ public function testReadStructA()
+ {
+ $transport = new TMemoryBuffer(base64_decode('CwABAAAAA2FiYwA='));
+ $protocol = new TBinaryProtocol($transport);
+ $structa = new \ThriftTest\StructA();
+ $structa->read($protocol);
+ $this->assertEquals("abc", $structa->s);
+ }
+
+ public function testWriteStructA()
+ {
+ $transport = new TMemoryBuffer();
+ $protocol = new TBinaryProtocol($transport);
+ $structa = new \ThriftTest\StructA();
+ $structa->s = "abc";
+ $structa->write($protocol);
+ $writeResult = base64_encode($transport->getBuffer());
+ $this->assertEquals('CwABAAAAA2FiYwA=', $writeResult);
+ }
+
+ protected static function assertHasReadValidator($class)
+ {
+ if (!static::hasReadValidator($class)) {
+ static::fail($class . ' class should have a read validator');
+ }
+ }
+
+ protected static function assertNoReadValidator($class)
+ {
+ if (static::hasReadValidator($class)) {
+ static::fail($class . ' class should not have a write validator');
+ }
+ }
+
+ protected static function assertHasWriteValidator($class)
+ {
+ if (!static::hasWriteValidator($class)) {
+ static::fail($class . ' class should have a write validator');
+ }
+ }
+
+ protected static function assertNoWriteValidator($class)
+ {
+ if (static::hasWriteValidator($class)) {
+ static::fail($class . ' class should not have a write validator');
+ }
+ }
+
+ private static function hasReadValidator($class)
+ {
+ $rc = new \ReflectionClass($class);
+
+ return $rc->hasMethod('_validateForRead');
+ }
+
+ private static function hasWriteValidator($class)
+ {
+ $rc = new \ReflectionClass($class);
+
+ return $rc->hasMethod('_validateForWrite');
+ }
+}
diff --git a/lib/php/test/Validator/ValidatorTest.php b/lib/php/test/Validator/ValidatorTest.php
new file mode 100644
index 000000000..ace3075de
--- /dev/null
+++ b/lib/php/test/Validator/ValidatorTest.php
@@ -0,0 +1,42 @@
+<?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;
+
+require_once __DIR__ . '/../../../../vendor/autoload.php';
+
+use Thrift\ClassLoader\ThriftClassLoader;
+
+/**
+ * Class TestValidators
+ * @package Test\Thrift
+ *
+ * @runTestsInSeparateProcesses
+ */
+class ValidatorTest extends BaseValidatorTest
+{
+ public function setUp()
+ {
+ $loader = new ThriftClassLoader();
+ $loader->registerDefinition('ThriftTest', __DIR__ . '/../packages/phpv');
+ $loader->registerDefinition('TestValidators', __DIR__ . '/../packages/phpv');
+ $loader->register();
+ }
+}
diff --git a/lib/php/test/Validator/ValidatorTestOop.php b/lib/php/test/Validator/ValidatorTestOop.php
new file mode 100644
index 000000000..5a8e3bfb9
--- /dev/null
+++ b/lib/php/test/Validator/ValidatorTestOop.php
@@ -0,0 +1,42 @@
+<?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;
+
+require_once __DIR__ . '/../../../../vendor/autoload.php';
+
+use Thrift\ClassLoader\ThriftClassLoader;
+
+/**
+ * Class TestValidatorsOop
+ * @package Test\Thrift
+ *
+ * @runTestsInSeparateProcesses
+ */
+class ValidatorTestOop extends BaseValidatorTest
+{
+ public function setUp()
+ {
+ $loader = new ThriftClassLoader();
+ $loader->registerDefinition('ThriftTest', __DIR__ . '/../packages/phpvo');
+ $loader->registerDefinition('TestValidators', __DIR__ . '/../packages/phpvo');
+ $loader->register();
+ }
+}
diff --git a/phpcs.xml.dist b/phpcs.xml.dist
index 9c65eaf98..180388aea 100644
--- a/phpcs.xml.dist
+++ b/phpcs.xml.dist
@@ -1,10 +1,10 @@
<?xml version="1.0"?>
-<ruleset name="PHP_CodeSniffer">
- <description>The coding standard for PHP_CodeSniffer itself.</description>
+<ruleset name="Apache_Thrift">
+ <description>The coding standard for thrift.</description>
<file>lib/php/lib</file>
-
- <exclude-pattern>*/Standards/*/Tests/*\.(inc|css|js)</exclude-pattern>
+ <file>lib/php/test</file>
+ <exclude-pattern>lib/php/test/packages/*</exclude-pattern>
<arg name="basepath" value="."/>
<arg name="colors" />
@@ -15,4 +15,11 @@
<exclude name="PSR2.Classes.PropertyDeclaration.Underscore"/>
</rule>
+ <rule ref="PSR1.Files.SideEffects">
+ <exclude-pattern>lib/php/test/*</exclude-pattern>
+ </rule>
+ <rule ref="Generic.Files.LineLength">
+ <exclude-pattern>lib/php/test/*</exclude-pattern>
+ </rule>
+
</ruleset>