Exemplo n.º 1
0
 public function testCollect()
 {
     $request = new Request();
     $request->query->set('foo', 'bar');
     $response = new Response();
     $collector = new RequestDataCollector();
     $storage = new SQLiteProfilerStorage(sys_get_temp_dir() . '/sf2_profiler.db');
     $storage->purge(true);
     $profiler = new Profiler($storage);
     $profiler->add($collector);
     $profiler->setToken('foobar');
     $profiler->collect($request, $response);
     $profiler = new Profiler($storage);
     $profiler->setToken('foobar');
     $this->assertEquals(array('foo' => 'bar'), $profiler->get('request')->getRequestQuery()->all());
 }
Exemplo n.º 2
0
 public function testCollect()
 {
     $request = new Request();
     $request->query->set('foo', 'bar');
     $response = new Response();
     $collector = new RequestDataCollector();
     $tmp = tempnam(sys_get_temp_dir(), 'sf2_profiler');
     if (file_exists($tmp)) {
         @unlink($tmp);
     }
     $storage = new SqliteProfilerStorage('sqlite:' . $tmp);
     $storage->purge();
     $profiler = new Profiler($storage);
     $profiler->add($collector);
     $profiler->setToken('foobar');
     $profiler->collect($request, $response);
     $profiler = new Profiler($storage);
     $profiler->setToken('foobar');
     $this->assertEquals(array('foo' => 'bar'), $profiler->get('request')->getRequestQuery()->all());
     @unlink($tmp);
 }