Development

#3329 (sfBrowser re-initialising context, causing event listeners to double-up)

You must first sign up to be able to contribute.

Ticket #3329 (closed defect: fixed)

Opened 2 years ago

Last modified 2 years ago

sfBrowser re-initialising context, causing event listeners to double-up

Reported by: notjosh Assigned to: fabien
Priority: minor Milestone: 1.1.0 beta4
Component: other Version: 1.1.0 DEV
Keywords: Cc:
Qualification: Unreviewed

Description

I'm currently using sfBrowser with PHPUnit instead of lime, which in general isn't a problem.

It looks like lime spawns a new PHP instance for each test suite, so the contexts don't overlap too badly, and doesn't get completely out of hand (though, it still writes duplicate/triplicate/etc log entries, but the process dies and resets the context, effectively)

Whereas, if I'm running, say, 20 f-tests with a couple of call()'s each, then suddenly, every application.log even writes 40 lines to the log file. Running a small portion of my test suite took a _long_ time, and I had 50mb of logs.

Is there a way to reinitialise the context to a known original state, instead of just calling ->initalize() again, which seems to cause these issues? Or do you need to modify the dispatcher somehow to check that the same object/method isn't listening repeatedly to the same event? Hm.

Simple steps to reproduce.

tail -f /path/to/logs/frontend_text.log

And then execute some functional tests..

./symfony test:functional frontend moduleActions

Where the contents of the f-test is something like..

<?php

require_once(dirname(__FILE__).'/../../bootstrap/functional.php');

// create a new test browser
$browser = new sfTestBrowser();
$browser->
  get('/module/index')->
  isStatusCode(200);
$browser->
  get('/module/index')->
  isStatusCode(200);
$browser->
  get('/module/index')->
  isStatusCode(200);
$browser->
  get('/module/index')->
  isStatusCode(200);
$browser->
  get('/module/index')->
  isStatusCode(200);
$browser->
  get('/module/index')->
  isStatusCode(200);

...

You'll see in the log that there are duplicates.

Change History

04/14/08 19:24:00 changed by fabien

  • milestone changed from 1.1.0 to 1.1.0 beta4.

04/15/08 02:20:38 changed by fabien

  • status changed from new to closed.
  • resolution set to fixed.

(In [8465]) fixed stuff so that you can have 2 different configuration in one single script (WIP, closes #3329)

The Sensio Labs Network

Since 1998, Sensio Labs has been promoting the Open-Source software movement by providing quality web application development, training, consulting.
Sensio Labs also supports several large Open-Source projects.