Browse Source

Evolution #618: Tests: base indé: Configuration pour que les tests puissent tourner sur une base de donnée indépendante.

Sevajol Bastien 11 years ago
parent
commit
a1b856b73f
2 changed files with 42 additions and 1 deletions
  1. 12 1
      app/config/config_test.yml
  2. 30 0
      web/app_test.php

+ 12 - 1
app/config/config_test.yml View File

@@ -14,5 +14,16 @@ web_profiler:
14 14
 swiftmailer:
15 15
     disable_delivery: true
16 16
 
17
+# Doctrine Configuration
18
+doctrine:
19
+    dbal:
20
+        driver:   %database_driver%
21
+        host:     %database_host%
22
+        port:     %database_port%
23
+        dbname:   muzich_test
24
+        user:     %database_user%
25
+        password: %database_password%
26
+        charset:  utf8
27
+
17 28
 parameters:
18
-    env: test
29
+    env: test

+ 30 - 0
web/app_test.php View File

@@ -0,0 +1,30 @@
1
+<?php
2
+
3
+use Symfony\Component\HttpFoundation\Request;
4
+
5
+// If you don't want to setup permissions the proper way, just uncomment the following PHP line
6
+// read http://symfony.com/doc/current/book/installation.html#configuration-and-setup for more information
7
+//umask(0000);
8
+
9
+// This check prevents access to debug front controllers that are deployed by accident to production servers.
10
+// Feel free to remove this, extend it, or make something more sophisticated.
11
+if (isset($_SERVER['HTTP_CLIENT_IP'])
12
+    || isset($_SERVER['HTTP_X_FORWARDED_FOR'])
13
+    || !in_array(@$_SERVER['REMOTE_ADDR'], array(
14
+        '127.0.0.1',
15
+        '::1',
16
+    ))
17
+) {
18
+    header('HTTP/1.0 403 Forbidden');
19
+    exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.');
20
+}
21
+
22
+$loader = require_once __DIR__.'/../app/bootstrap.php.cache';
23
+require_once __DIR__.'/../app/AppKernel.php';
24
+
25
+$kernel = new AppKernel('test', true);
26
+$kernel->loadClassCache();
27
+$request = Request::createFromGlobals();
28
+$response = $kernel->handle($request);
29
+$response->send();
30
+$kernel->terminate($request, $response);