blob: 35fc0d9144a722f84f06a8df1357fb01f435fe7c [file] [log] [blame]
Roger Meier21c0a852012-09-05 19:47:14 +00001<?php
2
3/*
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
19 * under the License.
20 *
21 * @package thrift.test
22 */
23
24namespace Test\Thrift;
25
26use ThriftTest\Xtruct;
27use ThriftTest\Xtruct2;
28use ThriftTest\Numberz;
29use ThriftTest\Insanity;
30
31class Fixtures
32{
33 public static $testArgs = array();
34
35 public static function populateTestArgs()
36 {
37 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ú, 粵語";
38
39 self::$testArgs['testString2'] =
40 "quote: \\\" backslash:" .
41 " forwardslash-escaped: \\/ " .
42 " backspace: \b formfeed: \f newline: \n return: \r tab: " .
43 " now-all-of-them-together: \"\\\/\b\n\r\t" .
44 " now-a-bunch-of-junk: !@#\$%&()(&%$#{}{}<><><";
45
46 self::$testArgs['testString3'] =
47 "string that ends in double-backslash \\\\";
48
49 self::$testArgs['testDouble'] = 3.1415926535898;
50
51 self::$testArgs['testByte'] = 0x01;
52
53 self::$testArgs['testI32'] = pow( 2, 30 );
54
Roger Thomas6fb59232014-11-04 10:09:23 +000055 if (PHP_INT_SIZE == 8) {
Roger Meier21c0a852012-09-05 19:47:14 +000056 self::$testArgs['testI64'] = pow( 2, 60 );
Roger Thomas6fb59232014-11-04 10:09:23 +000057 } else {
Roger Meier21c0a852012-09-05 19:47:14 +000058 self::$testArgs['testI64'] = "1152921504606847000";
59 }
60
61 self::$testArgs['testStruct'] =
62 new Xtruct(
63 array(
64 'string_thing' => 'worked',
65 'byte_thing' => 0x01,
66 'i32_thing' => pow( 2, 30 ),
67 'i64_thing' => self::$testArgs['testI64']
68 )
69 );
70
71 self::$testArgs['testNestNested'] =
72 new Xtruct(
73 array(
74 'string_thing' => 'worked',
75 'byte_thing' => 0x01,
76 'i32_thing' => pow( 2, 30 ),
77 'i64_thing' => self::$testArgs['testI64']
78 )
79 );
80
81 self::$testArgs['testNest'] =
82 new Xtruct2(
83 array(
84 'byte_thing' => 0x01,
85 'struct_thing' => self::$testArgs['testNestNested'],
86 'i32_thing' => pow( 2, 15 )
87 )
88 );
89
90 self::$testArgs['testMap'] =
91 array(
92 7 => 77,
93 8 => 88,
94 9 => 99
95 );
96
97 self::$testArgs['testStringMap'] =
98 array(
99 "a" => "123",
100 "a b" => "with spaces ",
101 "same" => "same",
102 "0" => "numeric key",
103 "longValue" => self::$testArgs['testString1'],
104 self::$testArgs['testString1'] => "long key"
105 );
106
107 self::$testArgs['testSet'] = array( 1 => true, 5 => true, 6 => true );
108
109 self::$testArgs['testList'] = array( 1, 2, 3 );
110
111 self::$testArgs['testEnum'] = Numberz::ONE;
112
113 self::$testArgs['testTypedef'] = 69;
114
115 self::$testArgs['testMapMapExpectedResult'] =
116 array(
117 4 => array(
118 1 => 1,
119 2 => 2,
120 3 => 3,
121 4 => 4,
122 ),
123 -4 => array(
124 -4 => -4,
125 -3 => -3,
126 -2 => -2,
127 -1 => -1
128 )
129 );
130
131 // testInsanity ... takes a few steps to set up!
132
133 $xtruct1 =
134 new Xtruct(
135 array(
136 'string_thing' => 'Goodbye4',
137 'byte_thing' => 4,
138 'i32_thing' => 4,
139 'i64_thing' => 4
140 )
141 );
142
143 $xtruct2 =
144 new Xtruct(
145 array(
146 'string_thing' => 'Hello2',
147 'byte_thing' =>2,
148 'i32_thing' => 2,
149 'i64_thing' => 2
150 )
151 );
152
153 $userMap =
154 array(
155 Numberz::FIVE => 5,
156 Numberz::EIGHT => 8
157 );
158
159 $insanity2 =
160 new Insanity(
161 array(
162 'userMap' => $userMap,
163 'xtructs' => array($xtruct1,$xtruct2)
164 )
165 );
166
167 $insanity3 = $insanity2;
168
169 $insanity6 =
170 new Insanity(
171 array(
172 'userMap' => null,
173 'xtructs' => null
174 )
175 );
176
177 self::$testArgs['testInsanityExpectedResult'] =
178 array(
179 "1" => array(
180 Numberz::TWO => $insanity2,
181 Numberz::THREE => $insanity3
182 ),
183 "2" => array(
184 Numberz::SIX => $insanity6
185 )
186 );
187
188 }
189}