blob: d9d487fe09b7c28de35913fd09d36238010738c1 [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
Jens Geyer8bcfdd92014-12-14 03:14:26 +010051 // TODO: add testBinary() call
52
Roger Meier21c0a852012-09-05 19:47:14 +000053 self::$testArgs['testByte'] = 0x01;
54
55 self::$testArgs['testI32'] = pow( 2, 30 );
56
Roger Thomas6fb59232014-11-04 10:09:23 +000057 if (PHP_INT_SIZE == 8) {
Roger Meier21c0a852012-09-05 19:47:14 +000058 self::$testArgs['testI64'] = pow( 2, 60 );
Roger Thomas6fb59232014-11-04 10:09:23 +000059 } else {
Roger Meier21c0a852012-09-05 19:47:14 +000060 self::$testArgs['testI64'] = "1152921504606847000";
61 }
62
63 self::$testArgs['testStruct'] =
64 new Xtruct(
65 array(
66 'string_thing' => 'worked',
67 'byte_thing' => 0x01,
68 'i32_thing' => pow( 2, 30 ),
69 'i64_thing' => self::$testArgs['testI64']
70 )
71 );
72
73 self::$testArgs['testNestNested'] =
74 new Xtruct(
75 array(
76 'string_thing' => 'worked',
77 'byte_thing' => 0x01,
78 'i32_thing' => pow( 2, 30 ),
79 'i64_thing' => self::$testArgs['testI64']
80 )
81 );
82
83 self::$testArgs['testNest'] =
84 new Xtruct2(
85 array(
86 'byte_thing' => 0x01,
87 'struct_thing' => self::$testArgs['testNestNested'],
88 'i32_thing' => pow( 2, 15 )
89 )
90 );
91
92 self::$testArgs['testMap'] =
93 array(
94 7 => 77,
95 8 => 88,
96 9 => 99
97 );
98
99 self::$testArgs['testStringMap'] =
100 array(
101 "a" => "123",
102 "a b" => "with spaces ",
103 "same" => "same",
104 "0" => "numeric key",
105 "longValue" => self::$testArgs['testString1'],
106 self::$testArgs['testString1'] => "long key"
107 );
108
109 self::$testArgs['testSet'] = array( 1 => true, 5 => true, 6 => true );
110
111 self::$testArgs['testList'] = array( 1, 2, 3 );
112
113 self::$testArgs['testEnum'] = Numberz::ONE;
114
115 self::$testArgs['testTypedef'] = 69;
116
117 self::$testArgs['testMapMapExpectedResult'] =
118 array(
119 4 => array(
120 1 => 1,
121 2 => 2,
122 3 => 3,
123 4 => 4,
124 ),
125 -4 => array(
126 -4 => -4,
127 -3 => -3,
128 -2 => -2,
129 -1 => -1
130 )
131 );
132
133 // testInsanity ... takes a few steps to set up!
134
135 $xtruct1 =
136 new Xtruct(
137 array(
138 'string_thing' => 'Goodbye4',
139 'byte_thing' => 4,
140 'i32_thing' => 4,
141 'i64_thing' => 4
142 )
143 );
144
145 $xtruct2 =
146 new Xtruct(
147 array(
148 'string_thing' => 'Hello2',
149 'byte_thing' =>2,
150 'i32_thing' => 2,
151 'i64_thing' => 2
152 )
153 );
154
155 $userMap =
156 array(
157 Numberz::FIVE => 5,
158 Numberz::EIGHT => 8
159 );
160
161 $insanity2 =
162 new Insanity(
163 array(
164 'userMap' => $userMap,
165 'xtructs' => array($xtruct1,$xtruct2)
166 )
167 );
168
169 $insanity3 = $insanity2;
170
171 $insanity6 =
172 new Insanity(
173 array(
174 'userMap' => null,
175 'xtructs' => null
176 )
177 );
178
179 self::$testArgs['testInsanityExpectedResult'] =
180 array(
181 "1" => array(
182 Numberz::TWO => $insanity2,
183 Numberz::THREE => $insanity3
184 ),
185 "2" => array(
186 Numberz::SIX => $insanity6
187 )
188 );
189
190 }
191}