blob: de7d9aaf9eac2f8b731428ef098d871db9941ca8 [file] [log] [blame]
Roger Meier33b720a2012-01-24 18:42:46 +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
24$GLOBALS['THRIFT_ROOT'] = dirname(__FILE__) . '/../src';
25require_once $GLOBALS['THRIFT_ROOT'] . '/packages/ThriftTest/ThriftTest.php';
26
27class Fixtures
28{
29 public static $testArgs = array();
30
31 public static function populateTestArgs()
32 {
33 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ú, 粵語";
34
35 self::$testArgs['testString2'] =
36 "quote: \\\" backslash:" .
37 " forwardslash-escaped: \\/ " .
38 " backspace: \b formfeed: \f newline: \n return: \r tab: " .
39 " now-all-of-them-together: \"\\\/\b\n\r\t" .
40 " now-a-bunch-of-junk: !@#\$%&()(&%$#{}{}<><><";
41
42 self::$testArgs['testString3'] =
43 "string that ends in double-backslash \\\\";
44
45 self::$testArgs['testDouble'] = 3.1415926535898;
46
47 self::$testArgs['testByte'] = 0x01;
48
49 self::$testArgs['testI32'] = pow( 2, 30 );
50
51 if ( PHP_INT_SIZE == 8 )
52 {
53 self::$testArgs['testI64'] = pow( 2, 60 );
54 }
55 else
56 {
57 self::$testArgs['testI64'] = "1152921504606847000";
58 }
59
60 self::$testArgs['testStruct'] =
61 new ThriftTest_Xtruct(
62 array(
63 'string_thing' => 'worked',
64 'byte_thing' => 0x01,
65 'i32_thing' => pow( 2, 30 ),
66 'i64_thing' => self::$testArgs['testI64']
67 )
68 );
69
70 self::$testArgs['testNestNested'] =
71 new ThriftTest_Xtruct(
72 array(
73 'string_thing' => 'worked',
74 'byte_thing' => 0x01,
75 'i32_thing' => pow( 2, 30 ),
76 'i64_thing' => self::$testArgs['testI64']
77 )
78 );
79
80 self::$testArgs['testNest'] =
81 new ThriftTest_Xtruct2(
82 array(
83 'byte_thing' => 0x01,
84 'struct_thing' => self::$testArgs['testNestNested'],
85 'i32_thing' => pow( 2, 15 )
86 )
87 );
88
89 self::$testArgs['testMap'] =
90 array(
91 7 => 77,
92 8 => 88,
93 9 => 99
94 );
95
96 self::$testArgs['testStringMap'] =
97 array(
98 "a" => "123",
99 "a b" => "with spaces ",
100 "same" => "same",
101 "0" => "numeric key",
102 "longValue" => self::$testArgs['testString1'],
103 self::$testArgs['testString1'] => "long key"
104 );
105
106 self::$testArgs['testSet'] = array( 1 => true, 5 => true, 6 => true );
107
108 self::$testArgs['testList'] = array( 1, 2, 3 );
109
110 self::$testArgs['testEnum'] = ThriftTest_Numberz::ONE;
111
112 self::$testArgs['testTypedef'] = 69;
113
114 self::$testArgs['testMapMapExpectedResult'] =
115 array(
116 4 => array(
117 1 => 1,
118 2 => 2,
119 3 => 3,
120 4 => 4,
121 ),
122 -4 => array(
123 -4 => -4,
124 -3 => -3,
125 -2 => -2,
126 -1 => -1
127 )
128 );
129
130 // testInsanity ... takes a few steps to set up!
131
132 $xtruct1 =
133 new ThriftTest_Xtruct(
134 array(
135 'string_thing' => 'Goodbye4',
136 'byte_thing' => 4,
137 'i32_thing' => 4,
138 'i64_thing' => 4
139 )
140 );
141
142 $xtruct2 =
143 new ThriftTest_Xtruct(
144 array(
145 'string_thing' => 'Hello2',
146 'byte_thing' =>2,
147 'i32_thing' => 2,
148 'i64_thing' => 2
149 )
150 );
151
152 $userMap =
153 array(
154 ThriftTest_Numberz::FIVE => 5,
155 ThriftTest_Numberz::EIGHT => 8
156 );
157
158 $insanity2 =
159 new ThriftTest_Insanity(
160 array(
161 'userMap' => $userMap,
162 'xtructs' => array($xtruct1,$xtruct2)
163 )
164 );
165
166 $insanity3 = $insanity2;
167
168 $insanity6 =
169 new ThriftTest_Insanity(
170 array(
171 'userMap' => null,
172 'xtructs' => null
173 )
174 );
175
176 self::$testArgs['testInsanityExpectedResult'] =
177 array(
178 "1" => array(
179 ThriftTest_Numberz::TWO => $insanity2,
180 ThriftTest_Numberz::THREE => $insanity3
181 ),
182 "2" => array(
183 ThriftTest_Numberz::SIX => $insanity6
184 )
185 );
186
187 }
188}