akaaafk commited on
Commit
498bf94
·
verified ·
1 Parent(s): c67ccf5

Add files using upload-large-folder tool

Browse files
Files changed (20) hide show
  1. benchmark/NYU_CTF_Bench/development/2013/CSAW-Finals/web/historypeats/csaw/fuel/core/lang/.gitkeep +0 -0
  2. benchmark/NYU_CTF_Bench/development/2013/CSAW-Finals/web/historypeats/csaw/fuel/core/tasks/install.php +47 -0
  3. benchmark/NYU_CTF_Bench/development/2013/CSAW-Finals/web/historypeats/csaw/fuel/core/tasks/migrate.php +383 -0
  4. benchmark/NYU_CTF_Bench/development/2013/CSAW-Finals/web/historypeats/csaw/fuel/core/tasks/session.php +181 -0
  5. benchmark/NYU_CTF_Bench/development/2013/CSAW-Finals/web/historypeats/csaw/fuel/core/tests/agent.php +247 -0
  6. benchmark/NYU_CTF_Bench/development/2013/CSAW-Finals/web/historypeats/csaw/fuel/core/tests/arr.php +1008 -0
  7. benchmark/NYU_CTF_Bench/development/2013/CSAW-Finals/web/historypeats/csaw/fuel/core/tests/asset.php +24 -0
  8. benchmark/NYU_CTF_Bench/development/2013/CSAW-Finals/web/historypeats/csaw/fuel/core/tests/autoloader.php +24 -0
  9. benchmark/NYU_CTF_Bench/development/2013/CSAW-Finals/web/historypeats/csaw/fuel/core/tests/cache.php +24 -0
  10. benchmark/NYU_CTF_Bench/development/2013/CSAW-Finals/web/historypeats/csaw/fuel/core/tests/cli.php +25 -0
  11. benchmark/NYU_CTF_Bench/development/2013/CSAW-Finals/web/historypeats/csaw/fuel/core/tests/config.php +24 -0
  12. benchmark/NYU_CTF_Bench/development/2013/CSAW-Finals/web/historypeats/csaw/fuel/core/tests/controller.php +24 -0
  13. benchmark/NYU_CTF_Bench/development/2013/CSAW-Finals/web/historypeats/csaw/fuel/core/tests/cookie.php +24 -0
  14. benchmark/NYU_CTF_Bench/development/2013/CSAW-Finals/web/historypeats/csaw/fuel/core/tests/crypt.php +24 -0
  15. benchmark/NYU_CTF_Bench/development/2013/CSAW-Finals/web/historypeats/csaw/fuel/core/tests/date.php +170 -0
  16. benchmark/NYU_CTF_Bench/development/2013/CSAW-Finals/web/historypeats/csaw/fuel/core/tests/db.php +24 -0
  17. benchmark/NYU_CTF_Bench/development/2013/CSAW-Finals/web/historypeats/csaw/fuel/core/tests/dbutil.php +24 -0
  18. benchmark/NYU_CTF_Bench/development/2013/CSAW-Finals/web/historypeats/csaw/fuel/core/tests/debug.php +68 -0
  19. benchmark/NYU_CTF_Bench/development/2013/CSAW-Finals/web/historypeats/csaw/fuel/core/tests/email.php +24 -0
  20. benchmark/NYU_CTF_Bench/development/2013/CSAW-Finals/web/historypeats/csaw/fuel/core/tests/error.php +27 -0
benchmark/NYU_CTF_Bench/development/2013/CSAW-Finals/web/historypeats/csaw/fuel/core/lang/.gitkeep ADDED
File without changes
benchmark/NYU_CTF_Bench/development/2013/CSAW-Finals/web/historypeats/csaw/fuel/core/tasks/install.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Part of the Fuel framework.
4
+ *
5
+ * @package Fuel
6
+ * @version 1.7
7
+ * @author Fuel Development Team
8
+ * @license MIT License
9
+ * @copyright 2010 - 2013 Fuel Development Team
10
+ * @link http://fuelphp.com
11
+ */
12
+
13
+ namespace Fuel\Tasks;
14
+
15
+ /**
16
+ * Install task
17
+ *
18
+ * Run this task to set default write permissions and environment stuff
19
+ * for your app. This could be expanded in app/tasks for applicaiton specific stuff.
20
+ *
21
+ * @package Fuel
22
+ * @version 1.0
23
+ * @author Phil Sturgeon
24
+ */
25
+
26
+ class Install
27
+ {
28
+
29
+ public static function run()
30
+ {
31
+ $writable_paths = array(APPPATH.'cache', APPPATH.'logs', APPPATH.'tmp', APPPATH.'config');
32
+
33
+ foreach ($writable_paths as $path)
34
+ {
35
+ if (@chmod($path, 0777))
36
+ {
37
+ \Cli::write("\t".'Made writable: '.$path, 'green');
38
+ }
39
+
40
+ else
41
+ {
42
+ \Cli::write("\t".'Failed to make writable: '.$path, 'red');
43
+ }
44
+ }
45
+ }
46
+ }
47
+
benchmark/NYU_CTF_Bench/development/2013/CSAW-Finals/web/historypeats/csaw/fuel/core/tasks/migrate.php ADDED
@@ -0,0 +1,383 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Part of the Fuel framework.
4
+ *
5
+ * @package Fuel
6
+ * @version 1.7
7
+ * @author Fuel Development Team
8
+ * @license MIT License
9
+ * @copyright 2010 - 2013 Fuel Development Team
10
+ * @link http://fuelphp.com
11
+ */
12
+
13
+ namespace Fuel\Tasks;
14
+
15
+ /**
16
+ * migrate task
17
+ *
18
+ * use this command line task to deploy and rollback changes
19
+ */
20
+ class Migrate
21
+ {
22
+ /**
23
+ * @var boolean if true, migrate the app
24
+ */
25
+ protected static $default = true;
26
+
27
+ /**
28
+ * @var array list of modules to migrate
29
+ */
30
+ protected static $modules = array();
31
+
32
+ /**
33
+ * @var array list of packages to migrate
34
+ */
35
+ protected static $packages = array();
36
+
37
+ /**
38
+ * @var int number of modules migrated
39
+ */
40
+ protected static $module_count = 0;
41
+
42
+ /**
43
+ * @var int number of packages migrated
44
+ */
45
+ protected static $package_count = 0;
46
+
47
+ /**
48
+ * sets the properties by grabbing Cli options
49
+ */
50
+ public function __construct()
51
+ {
52
+ // load config
53
+ \Config::load('migrations', true);
54
+
55
+ // get Cli options
56
+ $modules = \Cli::option('modules', \Cli::option('m'));
57
+ $packages = \Cli::option('packages', \Cli::option('p'));
58
+ $default = \Cli::option('default');
59
+ $all = \Cli::option('all');
60
+
61
+ if ($all)
62
+ {
63
+ $modules = true;
64
+ $packages = true;
65
+ $default = true;
66
+ }
67
+
68
+ // if modules option set
69
+ if ( ! empty($modules))
70
+ {
71
+ // if true - get all modules
72
+ if ($modules === true)
73
+ {
74
+ // loop through module paths
75
+ foreach (\Config::get('module_paths') as $path)
76
+ {
77
+ // get all modules that have files in the migration folder
78
+ foreach(new \GlobIterator(realpath($path).DS.'*') as $m)
79
+ {
80
+ if (count(new \GlobIterator($m->getPathname().rtrim(DS.\Config::get('migrations.folder'),'\\/').DS.'*.php')))
81
+ {
82
+ static::$modules[] = $m->getBasename();
83
+ }
84
+ }
85
+ }
86
+ }
87
+ // else do selected modules
88
+ else
89
+ {
90
+ static::$modules = explode(',', $modules);
91
+ }
92
+ }
93
+
94
+ // if packages option set
95
+ if ( ! empty($packages))
96
+ {
97
+ // if true - get all packages
98
+ if ($packages === true)
99
+ {
100
+ // get all packages that have files in the migration folder
101
+ foreach (\Config::get('package_paths', array(PKGPATH)) as $path)
102
+ {
103
+ // get all modules that have files in the migration folder
104
+ foreach(new \GlobIterator(realpath($path).DS.'*') as $p)
105
+ {
106
+ if (count(new \GlobIterator($p->getPathname().rtrim(DS.\Config::get('migrations.folder'),'\\/').DS.'*.php')))
107
+ {
108
+ static::$packages[] = $p->getBasename();
109
+ }
110
+ }
111
+ }
112
+ }
113
+ // else do selected packages
114
+ else
115
+ {
116
+ static::$packages = explode(',', $packages);
117
+ }
118
+ }
119
+
120
+ // if packages or modules are specified, and the app isn't, disable app migrations
121
+ if ( ( ! empty($packages) or ! empty($modules)) and empty($default))
122
+ {
123
+ static::$default = false;
124
+ }
125
+
126
+ // set the module and package count
127
+ static::$module_count = count(static::$modules);
128
+ static::$package_count = count(static::$packages);
129
+ }
130
+
131
+ /**
132
+ * catches requested method call and runs as needed
133
+ *
134
+ * @param string name of the method to run
135
+ * @param string any additional method arguments (not used here!)
136
+ */
137
+ public function __call($name, $args)
138
+ {
139
+ // set method name
140
+ $name = '_'.$name;
141
+
142
+ // make sure the called name exists
143
+ if ( ! method_exists(get_called_class(), $name))
144
+ {
145
+ return static::help();
146
+ }
147
+
148
+ // run app (default) migrations if default is true
149
+ if (static::$default)
150
+ {
151
+ static::$name('default', 'app');
152
+ }
153
+
154
+ // run migrations on all specified modules
155
+ foreach (static::$modules as $module)
156
+ {
157
+ static::$name($module, 'module');
158
+ }
159
+
160
+ // run migrations on all specified packages
161
+ foreach (static::$packages as $package)
162
+ {
163
+ static::$name($package, 'package');
164
+ }
165
+ }
166
+
167
+ /**
168
+ * migrates to the latest version unless -version is specified
169
+ *
170
+ * @param string name of the type (in case of app, it's 'default')
171
+ * @param string type (app, module or package)
172
+ * @param string direction of migration (up or down)
173
+ */
174
+ protected static function _run($name, $type)
175
+ {
176
+ // -v or --version
177
+ $version = \Cli::option('v', \Cli::option('version', ''));
178
+
179
+ // version is used as a flag, so show it
180
+ if ($version === true)
181
+ {
182
+ \Cli::write('Currently installed migrations for '.$type.':'.$name.':', 'green');
183
+
184
+ foreach (\Config::get('migrations.version.'.$type.'.'.$name, array()) as $version)
185
+ {
186
+ \Cli::write('- '.$version);
187
+ }
188
+ return;
189
+ }
190
+
191
+ // version contains a timestamp of sorts
192
+ elseif ($version !== '')
193
+ {
194
+ // if version has a value, make sure only 1 item was passed
195
+ if (static::$default + static::$module_count + static::$package_count > 1)
196
+ {
197
+ \Cli::write('Migration: version only accepts 1 item.');
198
+ return;
199
+ }
200
+ $migrations = \Migrate::version($version, $name, $type, \Cli::option('catchup', false));
201
+ }
202
+
203
+ // migrate to the latest version
204
+ else
205
+ {
206
+ $migrations = \Migrate::latest($name, $type, \Cli::option('catchup', false));
207
+ }
208
+
209
+ // any migrations executed?
210
+ if ($migrations)
211
+ {
212
+ \Cli::write('Performed migrations for '.$type.':'.$name.':', 'green');
213
+
214
+ foreach ($migrations as $migration)
215
+ {
216
+ \Cli::write($migration);
217
+ }
218
+ }
219
+ else
220
+ {
221
+ if ($migrations === false)
222
+ {
223
+ \Cli::write('Some migrations where skipped for '.$type.':'.$name.'. Please re-run the migrations.', 'cyan');
224
+ }
225
+ elseif ($version !== '')
226
+ {
227
+ \Cli::write('No migrations were found for '.$type.':'.$name.'.');
228
+ }
229
+ else
230
+ {
231
+ \Cli::write('Already on the latest migration for '.$type.':'.$name.'.');
232
+ }
233
+ }
234
+ }
235
+
236
+ /**
237
+ * migrates item to current config version
238
+ *
239
+ * @param string name of the type (in case of app, it's 'default')
240
+ * @param string type (app, module or package)
241
+ */
242
+ protected static function _current($name, $type)
243
+ {
244
+ // -v or --version
245
+ if (\Cli::option('v', \Cli::option('version', '')) !== '')
246
+ {
247
+ \Cli::write('You can not define a version when using the "current" command.', 'red');
248
+ }
249
+
250
+ $migrations = \Migrate::current($name, $type);
251
+
252
+ if ($migrations)
253
+ {
254
+ \Cli::write('Newly installed migrations for '.$type.':'.$name.':', 'green');
255
+ foreach ($migrations as $migration)
256
+ {
257
+ \Cli::write('- '.$migration);
258
+ }
259
+ }
260
+ else
261
+ {
262
+ // migration is already on current version
263
+ \Cli::write('Already on the current migration version for '.$type.':'.$name.'.');
264
+ }
265
+ }
266
+
267
+ /**
268
+ * migrates item up to the given version
269
+ *
270
+ * @param string
271
+ * @param string
272
+ */
273
+ protected static function _up($name, $type)
274
+ {
275
+ // -v or --version
276
+ $version = \Cli::option('v', \Cli::option('version', null));
277
+
278
+ // if version has a value, make sure only 1 item was passed
279
+ if ($version and (static::$default + static::$module_count + static::$package_count > 1))
280
+ {
281
+ \Cli::write('Migration: version only accepts 1 item.');
282
+ return;
283
+ }
284
+
285
+ $migrations = \Migrate::up($version, $name, $type);
286
+
287
+ if ($migrations)
288
+ {
289
+ \Cli::write('Newly installed migrations for '.$type.':'.$name.':', 'green');
290
+ foreach ($migrations as $migration)
291
+ {
292
+ \Cli::write('- '.$migration);
293
+ }
294
+ }
295
+ else
296
+ {
297
+ // there is no 'up'...
298
+ \Cli::write('You are already on the latest migration version for '.$type.':'.$name.'.');
299
+ }
300
+ }
301
+
302
+ /**
303
+ * migrates item down to the given version
304
+ *
305
+ * @param string
306
+ * @param string
307
+ */
308
+ protected static function _down($name, $type)
309
+ {
310
+ // -v or --version
311
+ $version = \Cli::option('v', \Cli::option('version', null));
312
+
313
+ // if version has a value, make sure only 1 item was passed
314
+ if ($version and (static::$default + static::$module_count + static::$package_count > 1))
315
+ {
316
+ \Cli::write('Migration: version only accepts 1 item.');
317
+ return;
318
+ }
319
+
320
+ $migrations = \Migrate::down($version, $name, $type);
321
+
322
+ if ($migrations)
323
+ {
324
+ \Cli::write('Reverted migrations for '.$type.':'.$name.':', 'green');
325
+ foreach ($migrations as $migration)
326
+ {
327
+ \Cli::write('- '.$migration);
328
+ }
329
+ }
330
+ else
331
+ {
332
+ // there is no 'down'...
333
+ \Cli::write('There are no migrations installed to revert for '.$type.':'.$name.'.');
334
+ }
335
+ }
336
+
337
+ /**
338
+ * Shows basic help instructions for using migrate in oil
339
+ */
340
+ public static function help()
341
+ {
342
+ echo <<<HELP
343
+ Usage:
344
+ php oil refine migrate[:command] [--version=X]
345
+
346
+ Fuel commands:
347
+ help shows this text
348
+ current migrates to the version defined in the migration configuration file
349
+ up migrate up to the next version
350
+ down migrate down to the previous version
351
+ run run all migrations (default)
352
+
353
+ Fuel options:
354
+ -v, [--version] # Migrate to a specific version ( only 1 item at a time)
355
+ --catchup # Use if you have out-of-sequence migrations that can be safely run
356
+
357
+ # The following disable default migrations unless you add --default to the command
358
+ --default # re-enables default migration
359
+ --modules -m # Migrates all modules
360
+ --modules=item1,item2 -m=item1,item2 # Migrates specific modules
361
+ --packages -p # Migrates all packages
362
+ --packages=item1,item2 -p=item1,item2 # Migrates specific modules
363
+ --all # shortcut for --modules --packages --default
364
+
365
+ Description:
366
+ The migrate task can run migrations. You can go up, down or by default go to the current migration marked in the config file.
367
+
368
+ Examples:
369
+ php oil r migrate
370
+ php oil r migrate:current
371
+ php oil r migrate:up -v=6
372
+ php oil r migrate:down
373
+ php oil r migrate --version=201203171206
374
+ php oil r migrate --modules --packages --default
375
+ php oil r migrate:up --modules=module1,module2 --packages=package1
376
+ php oil r migrate --modules=module1 -v=3
377
+ php oil r migrate --all
378
+
379
+ HELP;
380
+
381
+ }
382
+
383
+ }
benchmark/NYU_CTF_Bench/development/2013/CSAW-Finals/web/historypeats/csaw/fuel/core/tasks/session.php ADDED
@@ -0,0 +1,181 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Part of the Fuel framework.
4
+ *
5
+ * @package Fuel
6
+ * @version 1.7
7
+ * @author Fuel Development Team
8
+ * @license MIT License
9
+ * @copyright 2010 - 2013 Fuel Development Team
10
+ * @link http://fuelphp.com
11
+ */
12
+
13
+ namespace Fuel\Tasks;
14
+
15
+ /**
16
+ * Sessions DB Table Task
17
+ *
18
+ * @PullRequest https://github.com/fuel/core/pull/786
19
+ *
20
+ * Run this task to set add/remove/clear the db sessions table
21
+ * Table name will be generated from your config file.
22
+ * for your app. This could be expanded in app/tasks for application specific stuff.
23
+ *
24
+ * @package Fuel
25
+ * @version 1.1
26
+ * @author Daniel Berry
27
+ * @license MIT License
28
+ *
29
+ * Usage:
30
+ * php oil r session = will prompt with menu
31
+ * php oil r session:create = create the db table.
32
+ * php oil r session:remove = remove the sessions table
33
+ * php oil r session:clear = clear the sessions table
34
+ */
35
+
36
+ class Session
37
+ {
38
+
39
+ // default function if no command is selected. Provided user with menu
40
+ public static function run()
41
+ {
42
+ // Prompt the user with menu options
43
+ $option = \Cli::prompt('What would you like to do?', array('create','remove', 'clear', 'help'));
44
+
45
+ switch($option)
46
+ {
47
+ case "create":
48
+ return static::create();
49
+ break;
50
+ case "remove":
51
+ return static::remove();
52
+ break;
53
+ case "clear":
54
+ return static::clear();
55
+ break;
56
+ default:
57
+ return static::help();
58
+ break;
59
+ }
60
+ }
61
+
62
+ /**
63
+ * create the sessions table
64
+ * php oil r session:create
65
+ */
66
+ public static function create()
67
+ {
68
+ // load session config
69
+ \Config::load('session', true);
70
+
71
+ if (\Config::get('session.driver') != 'db')
72
+ {
73
+ // prompt the user to confirm they want to remove the table.
74
+ $continue = \Cli::prompt(\Cli::color('Your current driver type is not set db. Would you like to continue and add the sessions table anyway?', 'yellow'), array('y','n'));
75
+
76
+ if ($continue === 'n')
77
+ {
78
+ return \Cli::color('Database sessions table was not created.', 'red');
79
+ }
80
+ }
81
+
82
+ if (\DBUtil::table_exists(\Config::get('session.db.table')))
83
+ {
84
+ return \Cli::write('Session table already exists.');
85
+ }
86
+
87
+ // create the session table using the table name from the config file
88
+ \DBUtil::create_table(\Config::get('session.db.table'), array(
89
+ 'session_id' => array('constraint' => 40, 'type' => 'varchar'),
90
+ 'previous_id' => array('constraint' => 40, 'type' => 'varchar'),
91
+ 'user_agent' => array('type' => 'text', 'null' => false),
92
+ 'ip_hash' => array('constraint' => 32, 'type' => 'char'),
93
+ 'created' => array('constraint' => 10, 'type' => 'int', 'unsigned' => true),
94
+ 'updated' => array('constraint' => 10, 'type' => 'int', 'unsigned' => true),
95
+ 'payload' => array('type' => 'longtext'),
96
+ ), array('session_id'), false, 'InnoDB', \Config::get('db.default.charset'));
97
+
98
+ // make previous_id a unique_key. speeds up query and prevents duplicate id's
99
+ \DBUtil::create_index(\Config::get('session.db.table'), 'previous_id', 'previous_id', 'unique');
100
+
101
+ if (\Config::get('session.driver') === 'db')
102
+ {
103
+ // return success message.
104
+ return \Cli::color('Success! Your session table has been created!', 'green');
105
+ }
106
+ else
107
+ {
108
+ // return success message notifying that the driver is not db.
109
+ return \Cli::color('Success! Your session table has been created! Your current session driver type is set to '.\Config::get('session.driver').'. In order to use the table you just created to manage your sessions, you will need to set your driver type to "db" in your session config file.', 'green');
110
+ }
111
+ }
112
+
113
+ /**
114
+ * remove the sessions table
115
+ * php oil r session:remove
116
+ */
117
+ public static function remove()
118
+ {
119
+ // load session config
120
+ \Config::load('session', true);
121
+
122
+ // prompt the user to confirm they want to remove the table.
123
+ $iamsure = \Cli::prompt('Are you sure you want to delete the sessions table?', array('y','n'));
124
+
125
+ // if they are sure, then let's drop it
126
+ if ($iamsure === 'y')
127
+ {
128
+ \DBUtil::drop_table(\Config::get('session.db.table'));
129
+ return \Cli::color('Session database table deleted.', 'green');
130
+ }
131
+
132
+ // if we made it to here, than that means the user said no.
133
+ return \Cli::color('Session database table was not deleted.', 'red');
134
+ }
135
+
136
+ /**
137
+ * clear the sessions table
138
+ * php oil r session:clear
139
+ */
140
+ public static function clear()
141
+ {
142
+ // load session config
143
+ \Config::load('session', true);
144
+
145
+ // prompt the user to confirm they want to clear the table.
146
+ $iamsure = \Cli::prompt('Are you sure you want to clear the sessions table?', array('y','n'));
147
+
148
+ // if they are sure, then let's drop it
149
+ if ($iamsure === 'y')
150
+ {
151
+ \DBUtil::truncate_table(\Config::get('session.db.table'));
152
+ return \Cli::color('Session database table successfully truncated.', 'green');
153
+ }
154
+
155
+ // if we made it to here, than that means the user said no.
156
+ return \Cli::color('Session database table was not cleared.', 'red');
157
+ }
158
+
159
+ /**
160
+ * Shows basic help instructions for using migrate in oil
161
+ */
162
+ public static function help()
163
+ {
164
+ echo <<<HELP
165
+ Usage:
166
+ php oil refine session
167
+
168
+ Description:
169
+ The session task will create the necessary db tables.
170
+
171
+ Examples:
172
+ php oil r session:create
173
+ php oil r session:remove
174
+ php oil r session:clear
175
+ php oil r session:help
176
+
177
+ HELP;
178
+ }
179
+ }
180
+
181
+ /* End of file tasks/session.php */
benchmark/NYU_CTF_Bench/development/2013/CSAW-Finals/web/historypeats/csaw/fuel/core/tests/agent.php ADDED
@@ -0,0 +1,247 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Part of the Fuel framework.
4
+ *
5
+ * @package Fuel
6
+ * @version 1.7
7
+ * @author Fuel Development Team
8
+ * @license MIT License
9
+ * @copyright 2010 - 2013 Fuel Development Team
10
+ * @link http://fuelphp.com
11
+ */
12
+
13
+ namespace Fuel\Core;
14
+
15
+ /**
16
+ * Agent class tests
17
+ *
18
+ * @group Core
19
+ * @group Agent
20
+ */
21
+ class Test_Agent extends TestCase
22
+ {
23
+
24
+ /**
25
+ * need to setup a fake browser environment
26
+ */
27
+ protected function setUp()
28
+ {
29
+ // make sure we've got the Agent class in a known state
30
+ $_SERVER['HTTP_ACCEPT_LANGUAGE'] = 'en-us,en;q=0.8,nl-be;q=0.5,nl;q=0.3';
31
+ $_SERVER['HTTP_ACCEPT_CHARSET'] = 'UTF-8,ISO-8859-1,*';
32
+ $_SERVER['HTTP_USER_AGENT'] = 'Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.16) Gecko/20110322 Fedora/3.6.16-1.fc14 Firefox/3.6.16';
33
+
34
+ // by re-running the class init manually
35
+ \Agent::_init();
36
+ }
37
+
38
+ /**
39
+ * Tests Agent::browser()
40
+ *
41
+ * @test
42
+ */
43
+ public function test_browser()
44
+ {
45
+ $expected = "Firefox";
46
+ $output = Agent::browser();
47
+ $this->assertEquals($expected, $output);
48
+ }
49
+
50
+ /**
51
+ * Tests Agent::platform()
52
+ *
53
+ * @test
54
+ */
55
+ public function test_platform()
56
+ {
57
+ $expected = "Linux";
58
+ $output = Agent::platform();
59
+ $this->assertEquals($expected, $output);
60
+ }
61
+
62
+ /**
63
+ * Tests Agent::version()
64
+ *
65
+ * @test
66
+ */
67
+ public function test_version()
68
+ {
69
+ $expected = 3.6;
70
+ $output = Agent::version();
71
+ $this->assertInternalType('float', $output);
72
+ $this->assertEquals($expected, $output);
73
+ }
74
+
75
+ public function property_provider()
76
+ {
77
+ return array(
78
+ array(
79
+ 'Browser','Firefox',
80
+ ),
81
+ array(
82
+ 'Version',3.6,
83
+ ),
84
+ array(
85
+ 'MajorVer',3,
86
+ ),
87
+ array(
88
+ 'MinorVer',6,
89
+ ),
90
+ array(
91
+ 'Platform','Linux',
92
+ ),
93
+ array(
94
+ 'Alpha',false,
95
+ ),
96
+ array(
97
+ 'Beta',false,
98
+ ),
99
+ array(
100
+ 'Win16',false,
101
+ ),
102
+ array(
103
+ 'Win32',false,
104
+ ),
105
+ array(
106
+ 'Win64',false,
107
+ ),
108
+ array(
109
+ 'Frames',true,
110
+ ),
111
+ array(
112
+ 'IFrames',true,
113
+ ),
114
+ array(
115
+ 'Tables',true,
116
+ ),
117
+ array(
118
+ 'Cookies',true,
119
+ ),
120
+ array(
121
+ 'BackgroundSounds',false,
122
+ ),
123
+ array(
124
+ 'JavaScript',true,
125
+ ),
126
+ array(
127
+ 'VBScript',false,
128
+ ),
129
+ array(
130
+ 'JavaApplets',true,
131
+ ),
132
+ array(
133
+ 'ActiveXControls',false,
134
+ ),
135
+ array(
136
+ 'isBanned',false,
137
+ ),
138
+ array(
139
+ 'isMobile',false,
140
+ ),
141
+ array(
142
+ 'isSyndicationReader',false,
143
+ ),
144
+ array(
145
+ 'Crawler',false,
146
+ ),
147
+ array(
148
+ 'CssVersion',3,
149
+ ),
150
+ array(
151
+ 'AolVersion',0,
152
+ ),
153
+ );
154
+ }
155
+
156
+ /**
157
+ * Tests Agent::property()
158
+ *
159
+ * @test
160
+ * @dataProvider property_provider
161
+ */
162
+ public function test_property($property, $expected)
163
+ {
164
+ $output = Agent::property($property);
165
+ $this->assertEquals($expected, $output);
166
+ }
167
+
168
+ /**
169
+ * Tests Agent::is_robot()
170
+ *
171
+ * @test
172
+ */
173
+ public function test_is_robot()
174
+ {
175
+ $output = Agent::is_robot();
176
+ $this->assertFalse($output);
177
+ }
178
+
179
+ /**
180
+ * Tests Agent::is_mobiledevice()
181
+ *
182
+ * @test
183
+ */
184
+ public function test_is_mobiledevice()
185
+ {
186
+ $output = Agent::is_mobiledevice();
187
+ $this->assertFalse($output);
188
+ }
189
+
190
+ /**
191
+ * Tests Agent::languages()
192
+ *
193
+ * @test
194
+ */
195
+ public function test_languages()
196
+ {
197
+ $expected = array("en-us", "en", "nl-be", "nl");
198
+ $output = Agent::languages();
199
+ $this->assertEquals($expected, $output);
200
+ }
201
+
202
+ /**
203
+ * Tests Agent::accepts_language()
204
+ *
205
+ * @test
206
+ */
207
+ public function test_accepts_language_success()
208
+ {
209
+ $output = Agent::accepts_language('en-us');
210
+ $this->assertTrue($output);
211
+ }
212
+
213
+ public function test_accepts_language_fail()
214
+ {
215
+ $output = Agent::accepts_language('pt-br');
216
+ $this->assertFalse($output);
217
+ }
218
+
219
+ /**
220
+ * Tests Agent::charsets()
221
+ *
222
+ * @test
223
+ */
224
+ public function test_charsets()
225
+ {
226
+ $expected = array("utf-8", "iso-8859-1", "*");
227
+ $output = Agent::charsets();
228
+ $this->assertEquals($expected, $output);
229
+ }
230
+
231
+ /**
232
+ * Tests Agent::accepts_charset()
233
+ *
234
+ * @test
235
+ */
236
+ public function test_accepts_charset_success()
237
+ {
238
+ $output = Agent::accepts_charset('utf-8');
239
+ $this->assertTrue($output);
240
+ }
241
+
242
+ public function test_accepts_charset_fail()
243
+ {
244
+ $output = Agent::accepts_charset('cp2');
245
+ $this->assertFalse($output);
246
+ }
247
+ }
benchmark/NYU_CTF_Bench/development/2013/CSAW-Finals/web/historypeats/csaw/fuel/core/tests/arr.php ADDED
@@ -0,0 +1,1008 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Part of the Fuel framework.
4
+ *
5
+ * @package Fuel
6
+ * @version 1.7
7
+ * @author Fuel Development Team
8
+ * @license MIT License
9
+ * @copyright 2010 - 2013 Fuel Development Team
10
+ * @link http://fuelphp.com
11
+ */
12
+
13
+ namespace Fuel\Core;
14
+
15
+ /**
16
+ * Arr class tests
17
+ *
18
+ * @group Core
19
+ * @group Arr
20
+ */
21
+ class Test_Arr extends TestCase
22
+ {
23
+
24
+ public static function person_provider()
25
+ {
26
+ return array(
27
+ array(
28
+ array(
29
+ "name" => "Jack",
30
+ "age" => "21",
31
+ "weight" => 200,
32
+ "location" => array(
33
+ "city" => "Pittsburgh",
34
+ "state" => "PA",
35
+ "country" => "US"
36
+ ),
37
+ ),
38
+ ),
39
+ );
40
+ }
41
+
42
+ public static function collection_provider()
43
+ {
44
+ $object = new \stdClass;
45
+ $object->id = 7;
46
+ $object->name = 'Bert';
47
+ $object->surname = 'Visser';
48
+
49
+ return array(
50
+ array(
51
+ array(
52
+ array(
53
+ 'id' => 2,
54
+ 'name' => 'Bill',
55
+ 'surname' => 'Cosby',
56
+ ),
57
+ array(
58
+ 'id' => 5,
59
+ 'name' => 'Chris',
60
+ 'surname' => 'Rock',
61
+ ),
62
+ $object,
63
+ ),
64
+ ),
65
+ );
66
+ }
67
+
68
+ /**
69
+ * Test Arr::pluck()
70
+ *
71
+ * @test
72
+ * @dataProvider collection_provider
73
+ */
74
+ public function test_pluck($collection)
75
+ {
76
+ $output = \Arr::pluck($collection, 'id');
77
+ $expected = array(2, 5, 7);
78
+ $this->assertEquals($expected, $output);
79
+ }
80
+
81
+ /**
82
+ * Test Arr::pluck()
83
+ *
84
+ * @test
85
+ * @dataProvider collection_provider
86
+ */
87
+ public function test_pluck_with_index($collection)
88
+ {
89
+ $output = \Arr::pluck($collection, 'name', 'id');
90
+ $expected = array(2 => 'Bill', 5 => 'Chris', 7 => 'Bert');
91
+ $this->assertEquals($expected, $output);
92
+ }
93
+
94
+ /**
95
+ * Tests Arr::assoc_to_keyval()
96
+ *
97
+ * @test
98
+ */
99
+ public function test_assoc_to_keyval()
100
+ {
101
+ $assoc = array(
102
+ array(
103
+ 'color' => 'red',
104
+ 'rank' => 4,
105
+ 'name' => 'Apple',
106
+ ),
107
+ array(
108
+ 'color' => 'yellow',
109
+ 'rank' => 3,
110
+ 'name' => 'Banana',
111
+ ),
112
+ array(
113
+ 'color' => 'purple',
114
+ 'rank' => 2,
115
+ 'name' => 'Grape',
116
+ ),
117
+ );
118
+
119
+ $expected = array(
120
+ 'red' => 'Apple',
121
+ 'yellow' => 'Banana',
122
+ 'purple' => 'Grape',
123
+ );
124
+ $output = Arr::assoc_to_keyval($assoc, 'color', 'name');
125
+ $this->assertEquals($expected, $output);
126
+ }
127
+
128
+ /**
129
+ * Tests Arr::key_exists()
130
+ *
131
+ * @test
132
+ * @dataProvider person_provider
133
+ */
134
+ public function test_key_exists_with_key_found($person)
135
+ {
136
+ $expected = true;
137
+ $output = Arr::key_exists($person, "name");
138
+ $this->assertEquals($expected, $output);
139
+ }
140
+
141
+ /**
142
+ * Tests Arr::key_exists()
143
+ *
144
+ * @test
145
+ * @dataProvider person_provider
146
+ */
147
+ public function test_key_exists_with_key_not_found($person)
148
+ {
149
+ $expected = false;
150
+ $output = Arr::key_exists($person, "unknown");
151
+ $this->assertEquals($expected, $output);
152
+ }
153
+
154
+ /**
155
+ * Tests Arr::key_exists()
156
+ *
157
+ * @test
158
+ * @dataProvider person_provider
159
+ */
160
+ public function test_key_exists_with_dot_separated_key($person)
161
+ {
162
+ $expected = true;
163
+ $output = Arr::key_exists($person, "location.city");
164
+ $this->assertEquals($expected, $output);
165
+ }
166
+
167
+ /**
168
+ * Tests Arr::get()
169
+ *
170
+ * @test
171
+ * @dataProvider person_provider
172
+ */
173
+ public function test_get_with_element_found($person)
174
+ {
175
+ $expected = "Jack";
176
+ $output = Arr::get($person, "name", "Unknown Name");
177
+ $this->assertEquals($expected, $output);
178
+ }
179
+
180
+ /**
181
+ * Tests Arr::get()
182
+ *
183
+ * @test
184
+ * @dataProvider person_provider
185
+ */
186
+ public function test_get_with_element_not_found($person)
187
+ {
188
+ $expected = "Unknown job";
189
+ $output = Arr::get($person, "job", "Unknown job");
190
+ $this->assertEquals($expected, $output);
191
+ }
192
+
193
+ /**
194
+ * Tests Arr::get()
195
+ *
196
+ * @test
197
+ * @dataProvider person_provider
198
+ */
199
+ public function test_get_with_dot_separated_key($person)
200
+ {
201
+ $expected = "Pittsburgh";
202
+ $output = Arr::get($person, "location.city", "Unknown City");
203
+ $this->assertEquals($expected, $output);
204
+
205
+ }
206
+
207
+ /**
208
+ * Tests Arr::get()
209
+ *
210
+ * @test
211
+ * @expectedException InvalidArgumentException
212
+ */
213
+ public function test_get_throws_exception_when_array_is_not_an_array()
214
+ {
215
+ $output = Arr::get('Jack', 'name', 'Unknown Name');
216
+ }
217
+
218
+ /**
219
+ * Tests Arr::get()
220
+ *
221
+ * @test
222
+ * @dataProvider person_provider
223
+ */
224
+ public function test_get_when_dot_notated_key_is_not_array($person)
225
+ {
226
+ $expected = "Unknown Name";
227
+ $output = Arr::get($person, 'foo.first', 'Unknown Name');
228
+ $this->assertEquals($expected, $output);
229
+ }
230
+
231
+ /**
232
+ * Tests Arr::get()
233
+ *
234
+ * @test
235
+ * @dataProvider person_provider
236
+ */
237
+ public function test_get_with_all_elements_found($person)
238
+ {
239
+ $expected = array(
240
+ 'name' => 'Jack',
241
+ 'weight' => 200,
242
+ );
243
+ $output = Arr::get($person, array('name', 'weight'), 'Unknown');
244
+ $this->assertEquals($expected, $output);
245
+ }
246
+
247
+
248
+ /**
249
+ * Tests Arr::get()
250
+ *
251
+ * @test
252
+ * @dataProvider person_provider
253
+ */
254
+ public function test_get_with_all_elements_not_found($person)
255
+ {
256
+ $expected = array(
257
+ 'name' => 'Jack',
258
+ 'height' => 'Unknown',
259
+ );
260
+ $output = Arr::get($person, array('name', 'height'), 'Unknown');
261
+ $this->assertEquals($expected, $output);
262
+ }
263
+
264
+ /**
265
+ * Tests Arr::get()
266
+ *
267
+ * @test
268
+ * @dataProvider person_provider
269
+ */
270
+ public function test_get_when_keys_is_not_an_array($person)
271
+ {
272
+ $expected = 'Jack';
273
+ $output = Arr::get($person, 'name', 'Unknown');
274
+ $this->assertEquals($expected, $output);
275
+ }
276
+
277
+ /**
278
+ * Tests Arr::flatten()
279
+ *
280
+ * @test
281
+ */
282
+ public function test_flatten()
283
+ {
284
+ $indexed = array ( array('a'), array('b'), array('c') );
285
+
286
+ $expected = array(
287
+ "0_0" => "a",
288
+ "1_0" => "b",
289
+ "2_0" => "c",
290
+ );
291
+
292
+ $output = Arr::flatten($indexed, '_');
293
+ $this->assertEquals($expected, $output);
294
+ }
295
+
296
+ /**
297
+ * Tests Arr::flatten_assoc()
298
+ *
299
+ * @test
300
+ */
301
+ public function test_flatten_assoc()
302
+ {
303
+ $people = array(
304
+ array(
305
+ "name" => "Jack",
306
+ "age" => 21
307
+ ),
308
+ array(
309
+ "name" => "Jill",
310
+ "age" => 23
311
+ )
312
+ );
313
+
314
+ $expected = array(
315
+ "0:name" => "Jack",
316
+ "0:age" => 21,
317
+ "1:name" => "Jill",
318
+ "1:age" => 23
319
+ );
320
+
321
+ $output = Arr::flatten_assoc($people);
322
+ $this->assertEquals($expected, $output);
323
+ }
324
+
325
+ /**
326
+ * Tests Arr::merge_assoc()
327
+ *
328
+ * @test
329
+ */
330
+ public function test_merge_assoc()
331
+ {
332
+ $arr1 = array(
333
+ 'one' => 1,
334
+ 2 => 2,
335
+ 3 => 3,
336
+ 4 => array(
337
+ 56
338
+ ),
339
+ 5=> 87
340
+ );
341
+
342
+ $arr2 = array(
343
+ 1 => 27,
344
+ 2 => 90,
345
+ 4 => array(
346
+ 'give_me' => 'bandwidth',
347
+ ),
348
+ 6 => '90',
349
+ 7 => 'php',
350
+ );
351
+
352
+ $expected = array(
353
+ 'one' => 1,
354
+ 2 => 90,
355
+ 3 => 3,
356
+ 4 => array(
357
+ 56,
358
+ 'give_me' => 'bandwidth',
359
+ ),
360
+ 5=> 87,
361
+ 1 => 27,
362
+ 6 => '90',
363
+ 7 => 'php',
364
+ );
365
+
366
+ $output = Arr::merge_assoc($arr1, $arr2);
367
+ $this->assertEquals($expected, $output);
368
+ }
369
+
370
+ /**
371
+ * Tests Arr::insert()
372
+ *
373
+ * @test
374
+ */
375
+ public function test_insert()
376
+ {
377
+ $people = array("Jack", "Jill");
378
+
379
+ $expected = array("Humpty", "Jack", "Jill");
380
+ $output = Arr::insert($people, "Humpty", 0);
381
+
382
+ $this->assertEquals(true, $output);
383
+ $this->assertEquals($expected, $people);
384
+ }
385
+
386
+ /**
387
+ * Tests Arr::insert()
388
+ *
389
+ * @test
390
+ */
391
+ public function test_insert_with_index_out_of_range()
392
+ {
393
+ $people = array("Jack", "Jill");
394
+
395
+ $output = Arr::insert($people, "Humpty", 4);
396
+
397
+ $this->assertFalse($output);
398
+ }
399
+
400
+ /**
401
+ * Tests Arr::insert_after_key()
402
+ *
403
+ * @test
404
+ */
405
+ public function test_insert_after_key_that_exists()
406
+ {
407
+ $people = array("Jack", "Jill");
408
+
409
+ $expected = array("Jack", "Jill", "Humpty");
410
+ $output = Arr::insert_after_key($people, "Humpty", 1);
411
+
412
+ $this->assertTrue($output);
413
+ $this->assertEquals($expected, $people);
414
+ }
415
+
416
+ /**
417
+ * Tests Arr::insert_after_key()
418
+ *
419
+ * @test
420
+ */
421
+ public function test_insert_after_key_that_does_not_exist()
422
+ {
423
+ $people = array("Jack", "Jill");
424
+ $output = Arr::insert_after_key($people, "Humpty", 6);
425
+ $this->assertFalse($output);
426
+ }
427
+
428
+ /**
429
+ * Tests Arr::insert_after_value()
430
+ *
431
+ * @test
432
+ */
433
+ public function test_insert_after_value_that_exists()
434
+ {
435
+ $people = array("Jack", "Jill");
436
+ $expected = array("Jack", "Humpty", "Jill");
437
+ $output = Arr::insert_after_value($people, "Humpty", "Jack");
438
+ $this->assertTrue($output);
439
+ $this->assertEquals($expected, $people);
440
+ }
441
+
442
+ /**
443
+ * Tests Arr::insert_after_value()
444
+ *
445
+ * @test
446
+ */
447
+ public function test_insert_after_value_that_does_not_exists()
448
+ {
449
+ $people = array("Jack", "Jill");
450
+ $output = Arr::insert_after_value($people, "Humpty", "Joe");
451
+ $this->assertFalse($output);
452
+ }
453
+
454
+ /**
455
+ * Tests Arr::average()
456
+ *
457
+ * @test
458
+ */
459
+ public function test_average()
460
+ {
461
+ $arr = array(13, 8, 6);
462
+ $this->assertEquals(9, Arr::average($arr));
463
+ }
464
+
465
+ /**
466
+ * Tests Arr::average()
467
+ *
468
+ * @test
469
+ */
470
+ public function test_average_of_empty_array()
471
+ {
472
+ $arr = array();
473
+ $this->assertEquals(0, Arr::average($arr));
474
+ }
475
+
476
+ /**
477
+ * Tests Arr::filter_prefixed()
478
+ *
479
+ * @test
480
+ */
481
+ public function test_filter_prefixed()
482
+ {
483
+ $arr = array('foo' => 'baz', 'prefix_bar' => 'yay');
484
+
485
+ $output = Arr::filter_prefixed($arr, 'prefix_');
486
+ $this->assertEquals(array('bar' => 'yay'), $output);
487
+ }
488
+
489
+ /**
490
+ * Tests Arr::sort()
491
+ *
492
+ * @test
493
+ * @expectedException InvalidArgumentException
494
+ */
495
+ public function test_sort_of_non_array()
496
+ {
497
+ $sorted = Arr::sort('not an array', 'foo.key');
498
+ }
499
+
500
+ public function sort_provider()
501
+ {
502
+ return array(
503
+ array(
504
+ // Unsorted Array
505
+ array(
506
+ array(
507
+ 'info' => array(
508
+ 'pet' => array(
509
+ 'type' => 'dog'
510
+ )
511
+ ),
512
+ ),
513
+ array(
514
+ 'info' => array(
515
+ 'pet' => array(
516
+ 'type' => 'fish'
517
+ )
518
+ ),
519
+ ),
520
+ array(
521
+ 'info' => array(
522
+ 'pet' => array(
523
+ 'type' => 'cat'
524
+ )
525
+ ),
526
+ ),
527
+ ),
528
+
529
+ // Sorted Array
530
+ array(
531
+ array(
532
+ 'info' => array(
533
+ 'pet' => array(
534
+ 'type' => 'cat'
535
+ )
536
+ ),
537
+ ),
538
+ array(
539
+ 'info' => array(
540
+ 'pet' => array(
541
+ 'type' => 'dog'
542
+ )
543
+ ),
544
+ ),
545
+ array(
546
+ 'info' => array(
547
+ 'pet' => array(
548
+ 'type' => 'fish'
549
+ )
550
+ ),
551
+ ),
552
+ )
553
+ )
554
+ );
555
+ }
556
+
557
+ /**
558
+ * Tests Arr::sort()
559
+ *
560
+ * @test
561
+ * @dataProvider sort_provider
562
+ */
563
+ public function test_sort_asc($data, $expected)
564
+ {
565
+ $this->assertEquals($expected, Arr::sort($data, 'info.pet.type', 'asc'));
566
+ }
567
+
568
+ /**
569
+ * Tests Arr::sort()
570
+ *
571
+ * @test
572
+ * @dataProvider sort_provider
573
+ */
574
+ public function test_sort_desc($data, $expected)
575
+ {
576
+ $expected = array_reverse($expected);
577
+ $this->assertEquals($expected, Arr::sort($data, 'info.pet.type', 'desc'));
578
+ }
579
+
580
+ /**
581
+ * Tests Arr::sort()
582
+ *
583
+ * @test
584
+ * @dataProvider sort_provider
585
+ * @expectedException InvalidArgumentException
586
+ */
587
+ public function test_sort_invalid_direction($data, $expected)
588
+ {
589
+ $this->assertEquals($expected, Arr::sort($data, 'info.pet.type', 'downer'));
590
+ }
591
+
592
+ public function test_sort_empty()
593
+ {
594
+ $expected = array();
595
+ $output = Arr::sort(array(), 'test', 'test');
596
+ $this->assertEquals($expected, $output);
597
+ }
598
+
599
+ /**
600
+ * Tests Arr::filter_keys()
601
+ *
602
+ * @test
603
+ */
604
+ public function test_filter_keys()
605
+ {
606
+ $data = array(
607
+ 'epic' => 'win',
608
+ 'weak' => 'sauce',
609
+ 'foo' => 'bar'
610
+ );
611
+ $expected = array(
612
+ 'epic' => 'win',
613
+ 'foo' => 'bar'
614
+ );
615
+ $expected_remove = array(
616
+ 'weak' => 'sauce',
617
+ );
618
+ $keys = array('epic', 'foo');
619
+ $this->assertEquals($expected, Arr::filter_keys($data, $keys));
620
+ $this->assertEquals($expected_remove, Arr::filter_keys($data, $keys, true));
621
+ }
622
+
623
+ /**
624
+ * Tests Arr::to_assoc()
625
+ *
626
+ * @test
627
+ */
628
+ public function test_to_assoc_with_even_number_of_elements()
629
+ {
630
+ $arr = array('foo', 'bar', 'baz', 'yay');
631
+ $expected = array('foo' => 'bar', 'baz' => 'yay');
632
+ $this->assertEquals($expected, Arr::to_assoc($arr));
633
+ }
634
+
635
+ /**
636
+ * Tests Arr::to_assoc()
637
+ *
638
+ * @test
639
+ * @expectedException BadMethodCallException
640
+ */
641
+ public function test_to_assoc_with_odd_number_of_elements()
642
+ {
643
+ $arr = array('foo', 'bar', 'baz');
644
+ Arr::to_assoc($arr);
645
+ }
646
+
647
+ /**
648
+ * Tests Arr::prepend()
649
+ *
650
+ * @test
651
+ */
652
+ public function test_prepend()
653
+ {
654
+ $arr = array(
655
+ 'two' => 2,
656
+ 'three' => 3,
657
+ );
658
+ $expected = array(
659
+ 'one' => 1,
660
+ 'two' => 2,
661
+ 'three' => 3,
662
+ );
663
+ Arr::prepend($arr, 'one', 1);
664
+ $this->assertEquals($expected, $arr);
665
+ }
666
+
667
+ /**
668
+ * Tests Arr::prepend()
669
+ *
670
+ * @test
671
+ */
672
+ public function test_prepend_array()
673
+ {
674
+ $arr = array(
675
+ 'two' => 2,
676
+ 'three' => 3,
677
+ );
678
+ $expected = array(
679
+ 'one' => 1,
680
+ 'two' => 2,
681
+ 'three' => 3,
682
+ );
683
+ Arr::prepend($arr, array('one' => 1));
684
+ $this->assertEquals($expected, $arr);
685
+ }
686
+
687
+ /**
688
+ * Tests Arr::is_multi()
689
+ *
690
+ * @test
691
+ */
692
+ public function test_multidimensional_array()
693
+ {
694
+ // Single array
695
+ $arr_single = array('one' => 1, 'two' => 2);
696
+ $this->assertFalse(Arr::is_multi($arr_single));
697
+
698
+ // Multi-dimensional array
699
+ $arr_multi = array('one' => array('test' => 1), 'two' => array('test' => 2), 'three' => array('test' => 3));
700
+ $this->assertTrue(Arr::is_multi($arr_multi));
701
+
702
+ // Multi-dimensional array (not all elements are arrays)
703
+ $arr_multi_strange = array('one' => array('test' => 1), 'two' => array('test' => 2), 'three' => 3);
704
+ $this->assertTrue(Arr::is_multi($arr_multi_strange, false));
705
+ $this->assertFalse(Arr::is_multi($arr_multi_strange, true));
706
+ }
707
+
708
+ /**
709
+ * Tests Arr::search()
710
+ *
711
+ * @test
712
+ */
713
+ public function test_search_single_array()
714
+ {
715
+ // Single array
716
+ $arr_single = array('one' => 1, 'two' => 2);
717
+ $expected = 'one';
718
+ $this->assertEquals($expected, Arr::search($arr_single, 1));
719
+
720
+ // Default
721
+ $expected = null;
722
+ $this->assertEquals($expected, Arr::search($arr_single, 3));
723
+ $expected = 'three';
724
+ $this->assertEquals($expected, Arr::search($arr_single, 3, 'three'));
725
+
726
+ // Single array (int key)
727
+ $arr_single = array(0 => 'zero', 'one' => 1, 'two' => 2);
728
+ $expected = 0;
729
+ $this->assertEquals($expected, Arr::search($arr_single, 0));
730
+ }
731
+
732
+ /**
733
+ * Tests Arr::search()
734
+ *
735
+ * @test
736
+ */
737
+ public function test_search_multi_array()
738
+ {
739
+ // Multi-dimensional array
740
+ $arr_multi = array('one' => array('test' => 1), 'two' => array('test' => 2), 'three' => array('test' => array('a' => 'a', 'b' => 'b')));
741
+ $expected = 'one';
742
+ $this->assertEquals($expected, Arr::search($arr_multi, array('test' => 1), null, false));
743
+ $expected = null;
744
+ $this->assertEquals($expected, Arr::search($arr_multi, 1, null, false));
745
+
746
+ // Multi-dimensional array (recursive)
747
+ $expected = 'one.test';
748
+ $this->assertEquals($expected, Arr::search($arr_multi, 1));
749
+
750
+ $expected = 'three.test.b';
751
+ $this->assertEquals($expected, Arr::search($arr_multi, 'b', null, true));
752
+ }
753
+
754
+
755
+ /**
756
+ * Tests Arr::sum()
757
+ *
758
+ * @test
759
+ */
760
+ public function test_sum_multi_array()
761
+ {
762
+ $arr_multi = array(
763
+ array(
764
+ 'name' => 'foo',
765
+ 'scores' => array(
766
+ 'sports' => 5,
767
+ 'math' => 20,
768
+ ),
769
+ ),
770
+ array(
771
+ 'name' => 'bar',
772
+ 'scores' => array(
773
+ 'sports' => 7,
774
+ 'math' => 15,
775
+ ),
776
+ ),
777
+ array(
778
+ 'name' => 'fuel',
779
+ 'scores' => array(
780
+ 'sports' => 8,
781
+ 'math' => 5,
782
+ ),
783
+ ),
784
+ array(
785
+ 'name' => 'php',
786
+ 'scores' => array(
787
+ 'math' => 10,
788
+ ),
789
+ ),
790
+ );
791
+
792
+ $expected = 50;
793
+ $test = \Arr::sum($arr_multi, 'scores.math');
794
+ $this->assertEquals($expected, $test);
795
+
796
+ $expected = 20;
797
+ $test = \Arr::sum($arr_multi, 'scores.sports');
798
+ $this->assertEquals($expected, $test);
799
+ }
800
+
801
+ /**
802
+ * Tests Arr::previous_by_key()
803
+ *
804
+ * @test
805
+ */
806
+ public function test_previous_by_key()
807
+ {
808
+ // our test array
809
+ $arr = array(2 => 'A', 4 => 'B', 6 => 'C');
810
+
811
+ // test: key not found in array
812
+ $expected = false;
813
+ $test = \Arr::previous_by_key($arr, 1);
814
+ $this->assertTrue($expected === $test);
815
+
816
+ // test: no previous key
817
+ $expected = null;
818
+ $test = \Arr::previous_by_key($arr, 2);
819
+ $this->assertTrue($expected === $test);
820
+
821
+ // test: strict key comparison
822
+ $expected = false;
823
+ $test = \Arr::previous_by_key($arr, '2', false, true);
824
+ $this->assertTrue($expected === $test);
825
+
826
+ // test: get previous key
827
+ $expected = 2;
828
+ $test = \Arr::previous_by_key($arr, 4);
829
+ $this->assertTrue($expected === $test);
830
+
831
+ // test: get previous value
832
+ $expected = 'A';
833
+ $test = \Arr::previous_by_key($arr, 4, true);
834
+ $this->assertTrue($expected === $test);
835
+ }
836
+
837
+ /**
838
+ * Tests Arr::next_by_key()
839
+ *
840
+ * @test
841
+ */
842
+ public function test_next_by_key()
843
+ {
844
+ // our test array
845
+ $arr = array(2 => 'A', 4 => 'B', 6 => 'C');
846
+
847
+ // test: key not found in array
848
+ $expected = false;
849
+ $test = \Arr::next_by_key($arr, 1);
850
+ $this->assertTrue($expected === $test);
851
+
852
+ // test: no next key
853
+ $expected = null;
854
+ $test = \Arr::next_by_key($arr, 6);
855
+ $this->assertTrue($expected === $test);
856
+
857
+ // test: strict key comparison
858
+ $expected = false;
859
+ $test = \Arr::next_by_key($arr, '6', false, true);
860
+ $this->assertTrue($expected === $test);
861
+
862
+ // test: get next key
863
+ $expected = 6;
864
+ $test = \Arr::next_by_key($arr, 4);
865
+ $this->assertTrue($expected === $test);
866
+
867
+ // test: get next value
868
+ $expected = 'C';
869
+ $test = \Arr::next_by_key($arr, 4, true);
870
+ $this->assertTrue($expected === $test);
871
+ }
872
+
873
+ /**
874
+ * Tests Arr::previous_by_value()
875
+ *
876
+ * @test
877
+ */
878
+ public function test_previous_by_value()
879
+ {
880
+ // our test array
881
+ $arr = array(2 => 'A', 4 => '2', 6 => 'C');
882
+
883
+ // test: value not found in array
884
+ $expected = false;
885
+ $test = \Arr::previous_by_value($arr, 'Z');
886
+ $this->assertTrue($expected === $test);
887
+
888
+ // test: no previous value
889
+ $expected = null;
890
+ $test = \Arr::previous_by_value($arr, 'A');
891
+ $this->assertTrue($expected === $test);
892
+
893
+ // test: strict value comparison
894
+ $expected = false;
895
+ $test = \Arr::previous_by_value($arr, 2, true, true);
896
+ $this->assertTrue($expected === $test);
897
+
898
+ // test: get previous value
899
+ $expected = 'A';
900
+ $test = \Arr::previous_by_value($arr, '2');
901
+ $this->assertTrue($expected === $test);
902
+
903
+ // test: get previous key
904
+ $expected = 4;
905
+ $test = \Arr::previous_by_value($arr, 'C', false);
906
+ $this->assertTrue($expected === $test);
907
+ }
908
+
909
+ /**
910
+ * Tests Arr::next_by_value()
911
+ *
912
+ * @test
913
+ */
914
+ public function test_next_by_value()
915
+ {
916
+ // our test array
917
+ $arr = array(2 => 'A', 4 => '2', 6 => 'C');
918
+
919
+ // test: value not found in array
920
+ $expected = false;
921
+ $test = \Arr::next_by_value($arr, 'Z');
922
+ $this->assertTrue($expected === $test);
923
+
924
+ // test: no next value
925
+ $expected = null;
926
+ $test = \Arr::next_by_value($arr, 'C');
927
+ $this->assertTrue($expected === $test);
928
+
929
+ // test: strict value comparison
930
+ $expected = false;
931
+ $test = \Arr::next_by_value($arr, 2, true, true);
932
+ $this->assertTrue($expected === $test);
933
+
934
+ // test: get next value
935
+ $expected = 'C';
936
+ $test = \Arr::next_by_value($arr, '2');
937
+ $this->assertTrue($expected === $test);
938
+
939
+ // test: get next key
940
+ $expected = 4;
941
+ $test = \Arr::next_by_value($arr, 'A', false);
942
+ $this->assertTrue($expected === $test);
943
+ }
944
+
945
+ /**
946
+ * Tests Arr::subset()
947
+ *
948
+ * @test
949
+ * @dataProvider person_provider
950
+ */
951
+ public function test_subset_basic_usage($person)
952
+ {
953
+ $expected = array(
954
+ "name" => "Jack",
955
+ "location" => array(
956
+ "city" => "Pittsburgh",
957
+ "state" => "PA",
958
+ "country" => "US"
959
+ ),
960
+ );
961
+
962
+ $got = \Arr::subset($person, array("name", "location"));
963
+ $this->assertEquals($expected, $got);
964
+
965
+ $expected = array(
966
+ "name" => "Jack",
967
+ "location" => array(
968
+ "country" => "US"
969
+ ),
970
+ );
971
+
972
+ $got = \Arr::subset($person, array("name", "location.country"));
973
+ $this->assertEquals($expected, $got);
974
+ }
975
+
976
+ /**
977
+ * Tests Arr::subset()
978
+ *
979
+ * @test
980
+ * @dataProvider person_provider
981
+ */
982
+ public function test_subset_missing_items($person)
983
+ {
984
+ $expected = array(
985
+ "name" => "Jack",
986
+ "location" => array(
987
+ "street" => null,
988
+ "country" => "US"
989
+ ),
990
+ "occupation" => null
991
+ );
992
+
993
+ $got = \Arr::subset($person, array("name", "location.street", "location.country", "occupation"));
994
+ $this->assertEquals($expected, $got);
995
+
996
+ $expected = array(
997
+ "name" => "Jack",
998
+ "location" => array(
999
+ "street" => "Unknown",
1000
+ "country" => "US"
1001
+ ),
1002
+ "occupation" => "Unknown"
1003
+ );
1004
+
1005
+ $got = \Arr::subset($person, array("name", "location.street", "location.country", "occupation"), "Unknown");
1006
+ $this->assertEquals($expected, $got);
1007
+ }
1008
+ }
benchmark/NYU_CTF_Bench/development/2013/CSAW-Finals/web/historypeats/csaw/fuel/core/tests/asset.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Part of the Fuel framework.
4
+ *
5
+ * @package Fuel
6
+ * @version 1.7
7
+ * @author Fuel Development Team
8
+ * @license MIT License
9
+ * @copyright 2010 - 2013 Fuel Development Team
10
+ * @link http://fuelphp.com
11
+ */
12
+
13
+ namespace Fuel\Core;
14
+
15
+ /**
16
+ * Asset class tests
17
+ *
18
+ * @group Core
19
+ * @group Asset
20
+ */
21
+ class Test_Asset extends TestCase
22
+ {
23
+ public function test_foo() {}
24
+ }
benchmark/NYU_CTF_Bench/development/2013/CSAW-Finals/web/historypeats/csaw/fuel/core/tests/autoloader.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Part of the Fuel framework.
4
+ *
5
+ * @package Fuel
6
+ * @version 1.6
7
+ * @author Fuel Development Team
8
+ * @license MIT License
9
+ * @copyright 2010 - 2013 Fuel Development Team
10
+ * @link http://fuelphp.com
11
+ */
12
+
13
+ namespace Fuel\Core;
14
+
15
+ /**
16
+ * Autoloader class tests
17
+ *
18
+ * @group Core
19
+ * @group Autoloader
20
+ */
21
+ class Test_Autoloader extends TestCase
22
+ {
23
+ public function test_foo() {}
24
+ }
benchmark/NYU_CTF_Bench/development/2013/CSAW-Finals/web/historypeats/csaw/fuel/core/tests/cache.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Part of the Fuel framework.
4
+ *
5
+ * @package Fuel
6
+ * @version 1.7
7
+ * @author Fuel Development Team
8
+ * @license MIT License
9
+ * @copyright 2010 - 2013 Fuel Development Team
10
+ * @link http://fuelphp.com
11
+ */
12
+
13
+ namespace Fuel\Core;
14
+
15
+ /**
16
+ * Cache class tests
17
+ *
18
+ * @group Core
19
+ * @group Cache
20
+ */
21
+ class Test_Cache extends TestCase
22
+ {
23
+ public function test_foo() {}
24
+ }
benchmark/NYU_CTF_Bench/development/2013/CSAW-Finals/web/historypeats/csaw/fuel/core/tests/cli.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Part of the Fuel framework.
4
+ *
5
+ * @package Fuel
6
+ * @version 1.7
7
+ * @author Fuel Development Team
8
+ * @license MIT License
9
+ * @copyright 2010 - 2013 Fuel Development Team
10
+ * @link http://fuelphp.com
11
+ */
12
+
13
+ namespace Fuel\Core;
14
+
15
+ /**
16
+ * Cli class tests
17
+ *
18
+ * @group Core
19
+ * @group Cli
20
+ */
21
+ class Test_Cli extends TestCase
22
+ {
23
+
24
+ public function test_foo() {}
25
+ }
benchmark/NYU_CTF_Bench/development/2013/CSAW-Finals/web/historypeats/csaw/fuel/core/tests/config.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Part of the Fuel framework.
4
+ *
5
+ * @package Fuel
6
+ * @version 1.6
7
+ * @author Fuel Development Team
8
+ * @license MIT License
9
+ * @copyright 2010 - 2013 Fuel Development Team
10
+ * @link http://fuelphp.com
11
+ */
12
+
13
+ namespace Fuel\Core;
14
+
15
+ /**
16
+ * Config class tests
17
+ *
18
+ * @group Core
19
+ * @group Config
20
+ */
21
+ class Test_Config extends TestCase
22
+ {
23
+ public function test_foo() {}
24
+ }
benchmark/NYU_CTF_Bench/development/2013/CSAW-Finals/web/historypeats/csaw/fuel/core/tests/controller.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Part of the Fuel framework.
4
+ *
5
+ * @package Fuel
6
+ * @version 1.6
7
+ * @author Fuel Development Team
8
+ * @license MIT License
9
+ * @copyright 2010 - 2013 Fuel Development Team
10
+ * @link http://fuelphp.com
11
+ */
12
+
13
+ namespace Fuel\Core;
14
+
15
+ /**
16
+ * Controller class tests
17
+ *
18
+ * @group Core
19
+ * @group Controller
20
+ */
21
+ class Test_Controller extends TestCase
22
+ {
23
+ public function test_foo() {}
24
+ }
benchmark/NYU_CTF_Bench/development/2013/CSAW-Finals/web/historypeats/csaw/fuel/core/tests/cookie.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Part of the Fuel framework.
4
+ *
5
+ * @package Fuel
6
+ * @version 1.7
7
+ * @author Fuel Development Team
8
+ * @license MIT License
9
+ * @copyright 2010 - 2013 Fuel Development Team
10
+ * @link http://fuelphp.com
11
+ */
12
+
13
+ namespace Fuel\Core;
14
+
15
+ /**
16
+ * Cookie class tests
17
+ *
18
+ * @group Core
19
+ * @group Cookie
20
+ */
21
+ class Test_Cookie extends TestCase
22
+ {
23
+ public function test_foo() {}
24
+ }
benchmark/NYU_CTF_Bench/development/2013/CSAW-Finals/web/historypeats/csaw/fuel/core/tests/crypt.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Part of the Fuel framework.
4
+ *
5
+ * @package Fuel
6
+ * @version 1.7
7
+ * @author Fuel Development Team
8
+ * @license MIT License
9
+ * @copyright 2010 - 2013 Fuel Development Team
10
+ * @link http://fuelphp.com
11
+ */
12
+
13
+ namespace Fuel\Core;
14
+
15
+ /**
16
+ * Crypt class tests
17
+ *
18
+ * @group Core
19
+ * @group Crypt
20
+ */
21
+ class Test_Crypt extends TestCase
22
+ {
23
+ public function test_foo() {}
24
+ }
benchmark/NYU_CTF_Bench/development/2013/CSAW-Finals/web/historypeats/csaw/fuel/core/tests/date.php ADDED
@@ -0,0 +1,170 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Part of the Fuel framework.
4
+ *
5
+ * @package Fuel
6
+ * @version 1.7
7
+ * @author Fuel Development Team
8
+ * @license MIT License
9
+ * @copyright 2010 - 2013 Fuel Development Team
10
+ * @link http://fuelphp.com
11
+ */
12
+
13
+ namespace Fuel\Core;
14
+
15
+ /**
16
+ * Date class tests
17
+ *
18
+ * @group Core
19
+ * @group Date
20
+ */
21
+ class Test_Date extends TestCase
22
+ {
23
+ protected function setUp()
24
+ {
25
+ // make sure the locale and language are is set correctly for the tests
26
+ setlocale(LC_ALL, 'en_US') === false and setlocale(LC_ALL, 'en_US.UTF8');
27
+ \Config::set('language', 'en');
28
+ }
29
+
30
+ /**
31
+ * Test for Date::days_in_month()
32
+ *
33
+ * @test
34
+ */
35
+ public function test_days_in_month()
36
+ {
37
+ $output = Date::days_in_month(8);
38
+ $expected = 31;
39
+ $this->assertEquals($expected, $output);
40
+
41
+ $output = Date::days_in_month(2,2001);
42
+ $expected = 28;
43
+ $this->assertEquals($expected, $output);
44
+
45
+ $output = Date::days_in_month(2,2000);
46
+ $expected = 29;
47
+ $this->assertEquals($expected, $output);
48
+ }
49
+
50
+ /**
51
+ * Test for Date::days_in_month(0)
52
+ * @expectedException UnexpectedValueException
53
+ * @test
54
+ */
55
+ public function test_days_in_month_0_exception()
56
+ {
57
+ $output = Date::days_in_month(0);
58
+ }
59
+
60
+ /**
61
+ * Test for Date::days_in_month(13)
62
+ * @expectedException UnexpectedValueException
63
+ * @test
64
+ */
65
+ public function test_days_in_month_13_exception()
66
+ {
67
+ $output = Date::days_in_month(13);
68
+ }
69
+
70
+
71
+
72
+ /**
73
+ * Test for Date::format()
74
+ *
75
+ * @test
76
+ */
77
+ public function test_format()
78
+ {
79
+ $default_timezone = date_default_timezone_get();
80
+ date_default_timezone_set('UTC');
81
+
82
+ $output = Date::forge( 1294176140 )->format("%m/%d/%Y");
83
+ $expected = "01/04/2011";
84
+
85
+ date_default_timezone_set($default_timezone);
86
+
87
+ $this->assertEquals($expected, $output);
88
+ }
89
+
90
+ /**
91
+ * Test for Date::get_timestamp()
92
+ *
93
+ * @test
94
+ */
95
+ public function test_get_timestamp()
96
+ {
97
+ $output = Date::forge( 1294176140 )->get_timestamp();
98
+ $expected = 1294176140;
99
+
100
+ $this->assertEquals($expected, $output);
101
+ }
102
+
103
+ /**
104
+ * Test for Date::get_timezone()
105
+ *
106
+ * @test
107
+ */
108
+ public function test_get_timezone()
109
+ {
110
+ $output = Date::forge( 1294176140, "Europe/London" )->get_timezone();
111
+ $expected = "Europe/London";
112
+
113
+ $this->assertEquals($expected, $output);
114
+ }
115
+
116
+ /**
117
+ * Test for Date::set_timezone()
118
+ *
119
+ * @test
120
+ */
121
+ public function test_set_timezone()
122
+ {
123
+ $output = Date::forge( 1294176140 )->set_timezone("America/Chicago")->get_timezone();
124
+ $expected = "America/Chicago";
125
+
126
+ $this->assertEquals($expected, $output);
127
+ }
128
+
129
+ /**
130
+ * Test for Date::time_ago()
131
+ *
132
+ * @test
133
+ */
134
+ public function test_time_ago_null_timestamp()
135
+ {
136
+ $output = Date::time_ago(null);
137
+
138
+ $this->assertEquals(null, $output);
139
+ }
140
+
141
+ /**
142
+ * Test for Date::time_ago()
143
+ *
144
+ * @test
145
+ */
146
+ public function test_time_ago_one_month()
147
+ {
148
+ $march_30_2011 = 1301461200;
149
+ $april_30_2011 = 1304139600;
150
+ $output = Date::time_ago($march_30_2011, $april_30_2011);
151
+
152
+ $this->assertEquals('1 month ago', $output);
153
+ }
154
+
155
+ /**
156
+ * Test for Date::time_ago()
157
+ *
158
+ * @test
159
+ */
160
+ public function test_time_ago_two_months()
161
+ {
162
+ $march_30_2011 = 1301461200;
163
+ $may_30_2011 = 1306731600;
164
+
165
+ $output = Date::time_ago($march_30_2011, $may_30_2011);
166
+
167
+ $this->assertEquals('2 months ago', $output);
168
+ }
169
+ }
170
+
benchmark/NYU_CTF_Bench/development/2013/CSAW-Finals/web/historypeats/csaw/fuel/core/tests/db.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Part of the Fuel framework.
4
+ *
5
+ * @package Fuel
6
+ * @version 1.6
7
+ * @author Fuel Development Team
8
+ * @license MIT License
9
+ * @copyright 2010 - 2013 Fuel Development Team
10
+ * @link http://fuelphp.com
11
+ */
12
+
13
+ namespace Fuel\Core;
14
+
15
+ /**
16
+ * Db class tests
17
+ *
18
+ * @group Core
19
+ * @group Db
20
+ */
21
+ class Test_Db extends TestCase
22
+ {
23
+ public function test_foo() {}
24
+ }
benchmark/NYU_CTF_Bench/development/2013/CSAW-Finals/web/historypeats/csaw/fuel/core/tests/dbutil.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Part of the Fuel framework.
4
+ *
5
+ * @package Fuel
6
+ * @version 1.6
7
+ * @author Fuel Development Team
8
+ * @license MIT License
9
+ * @copyright 2010 - 2013 Fuel Development Team
10
+ * @link http://fuelphp.com
11
+ */
12
+
13
+ namespace Fuel\Core;
14
+
15
+ /**
16
+ * Dbutil class tests
17
+ *
18
+ * @group Core
19
+ * @group Dbutil
20
+ */
21
+ class Test_Dbutil extends TestCase
22
+ {
23
+ public function test_foo() {}
24
+ }
benchmark/NYU_CTF_Bench/development/2013/CSAW-Finals/web/historypeats/csaw/fuel/core/tests/debug.php ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Part of the Fuel framework.
4
+ *
5
+ * @package Fuel
6
+ * @version 1.7
7
+ * @author Fuel Development Team
8
+ * @license MIT License
9
+ * @copyright 2010 - 2013 Fuel Development Team
10
+ * @link http://fuelphp.com
11
+ */
12
+
13
+ namespace Fuel\Core;
14
+
15
+ /**
16
+ * Debug class tests
17
+ *
18
+ * @group Core
19
+ * @group Debug
20
+ */
21
+ class Test_Debug extends TestCase
22
+ {
23
+ public function test_debug_dump_normally()
24
+ {
25
+ // Set to browser mode.
26
+ \Fuel::$is_cli = false;
27
+
28
+ $expected = ' <script type="text/javascript">function fuel_debug_toggle(a){if(document.getElementById){if(document.getElementById(a).style.display=="none"){document.getElementById(a).style.display="block"}else{document.getElementById(a).style.display="none"}}else{if(document.layers){if(document.id.display=="none"){document.id.display="block"}else{document.id.display="none"}}else{if(document.all.id.style.display=="none"){document.all.id.style.display="block"}else{document.all.id.style.display="none"}}}};</script><div class="fuelphp-dump" style="font-size: 13px;background: #EEE !important; border:1px solid #666; color: #000 !important; padding:10px;"><h1 style="border-bottom: 1px solid #CCC; padding: 0 0 5px 0; margin: 0 0 5px 0; font: bold 120% sans-serif;">COREPATH/tests/debug.php @ line: 31</h1><pre style="overflow:auto;font-size:100%;"><strong>Variable #1:</strong>'."\n".'<i></i> <strong></strong> (Integer): 1'."\n\n\n".'<strong>Variable #2:</strong>'."\n".'<i></i> <strong></strong> (Integer): 2'."\n\n\n".'<strong>Variable #3:</strong>'."\n".'<i></i> <strong></strong> (Integer): 3'."\n\n\n".'</pre></div>';
29
+
30
+ ob_start();
31
+ \Debug::dump(1, 2, 3);
32
+ $output = ob_get_contents();
33
+ ob_end_clean();
34
+
35
+ $this->assertEquals($expected, $output);
36
+ }
37
+
38
+ public function test_debug_dump_by_call_user_func_array()
39
+ {
40
+ // Set to browser mode.
41
+ \Fuel::$is_cli = false;
42
+
43
+ $expected = '<div class="fuelphp-dump" style="font-size: 13px;background: #EEE !important; border:1px solid #666; color: #000 !important; padding:10px;"><h1 style="border-bottom: 1px solid #CCC; padding: 0 0 5px 0; margin: 0 0 5px 0; font: bold 120% sans-serif;">COREPATH/tests/debug.php @ line: 46</h1><pre style="overflow:auto;font-size:100%;"><strong>Variable #1:</strong>'."\n".'<i></i> <strong></strong> (Integer): 1'."\n\n\n".'<strong>Variable #2:</strong>'."\n".'<i></i> <strong></strong> (Integer): 2'."\n\n\n".'<strong>Variable #3:</strong>'."\n".'<i></i> <strong></strong> (Integer): 3'."\n\n\n".'</pre></div>';
44
+
45
+ ob_start();
46
+ call_user_func_array('\\Debug::dump', array(1, 2, 3));
47
+ $output = ob_get_contents();
48
+ ob_end_clean();
49
+
50
+ $this->assertEquals($expected, $output);
51
+ }
52
+
53
+ public function test_debug_dump_by_call_fuel_func_array()
54
+ {
55
+ // Set to browser mode.
56
+ \Fuel::$is_cli = false;
57
+
58
+ $expected = '<div class="fuelphp-dump" style="font-size: 13px;background: #EEE !important; border:1px solid #666; color: #000 !important; padding:10px;"><h1 style="border-bottom: 1px solid #CCC; padding: 0 0 5px 0; margin: 0 0 5px 0; font: bold 120% sans-serif;">COREPATH/base.php @ line: 462</h1><pre style="overflow:auto;font-size:100%;"><strong>Variable #1:</strong>'."\n".'<i></i> <strong></strong> (Integer): 1'."\n\n\n".'<strong>Variable #2:</strong>'."\n".'<i></i> <strong></strong> (Integer): 2'."\n\n\n".'<strong>Variable #3:</strong>'."\n".'<i></i> <strong></strong> (Integer): 3'."\n\n\n".'</pre></div>';
59
+
60
+ ob_start();
61
+ call_fuel_func_array('\\Debug::dump', array(1, 2, 3));
62
+ $output = ob_get_contents();
63
+ ob_end_clean();
64
+
65
+ $this->assertEquals($expected, $output);
66
+ }
67
+ }
68
+
benchmark/NYU_CTF_Bench/development/2013/CSAW-Finals/web/historypeats/csaw/fuel/core/tests/email.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Part of the Fuel framework.
4
+ *
5
+ * @package Fuel
6
+ * @version 1.7
7
+ * @author Fuel Development Team
8
+ * @license MIT License
9
+ * @copyright 2010 - 2013 Fuel Development Team
10
+ * @link http://fuelphp.com
11
+ */
12
+
13
+ namespace Fuel\Core;
14
+
15
+ /**
16
+ * Email class tests
17
+ *
18
+ * @group Core
19
+ * @group Email
20
+ */
21
+ class Test_Email extends TestCase
22
+ {
23
+ public function test_foo() {}
24
+ }
benchmark/NYU_CTF_Bench/development/2013/CSAW-Finals/web/historypeats/csaw/fuel/core/tests/error.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Part of the Fuel framework.
4
+ *
5
+ * @package Fuel
6
+ * @version 1.7
7
+ * @author Fuel Development Team
8
+ * @license MIT License
9
+ * @copyright 2010 - 2013 Fuel Development Team
10
+ * @link http://fuelphp.com
11
+ */
12
+
13
+ namespace Fuel\Core;
14
+
15
+ /**
16
+ * Error class tests
17
+ *
18
+ * @group Core
19
+ * @group Error
20
+ */
21
+ class Test_Error extends TestCase
22
+ {
23
+ public function test_foo() {}
24
+ }
25
+ // TestCase {
26
+ // public function test_foo() {}
27
+ // }