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