187150ef724e2a7f43506cf65ed60f51410146f3
[yaffs-website] / vendor / behat / mink-browserkit-driver / tests / app.php
1 <?php
2
3 namespace app;
4
5 $app = new \Silex\Application();
6 $app->register(new \Silex\Provider\SessionServiceProvider());
7
8 $def = realpath(__DIR__.'/../vendor/behat/mink/driver-testsuite/web-fixtures');
9 require_once $def . '/utils.php';
10
11 $ovr = realpath(__DIR__.'/web-fixtures');
12 $cbk = function ($file) use ($app, $def, $ovr) {
13     $file = str_replace('.file', '.php', $file);
14     $path = file_exists($ovr.'/'.$file) ? $ovr.'/'.$file : $def.'/'.$file;
15     $resp = null;
16
17     ob_start();
18     include($path);
19     $content = ob_get_clean();
20
21     if ($resp) {
22         if ('' === $resp->getContent()) {
23             $resp->setContent($content);
24         }
25
26         return $resp;
27     }
28
29     return $content;
30 };
31
32 $app->get('/{file}', $cbk)->assert('file', '.*');
33 $app->post('/{file}', $cbk)->assert('file', '.*');
34
35 $app['debug'] = true;
36 $app['exception_handler']->disable();
37 $app['session.test'] = true;
38
39 return $app;