I've written a class to load some fixtures in DB each time a functional test is executed. These fixtures are created calling a service which after creating some data, dispatches an event so that other data is created from listeners. The problem is that the listeners are not executed when loading the fixtures.
Do I need to mock all events dispatches to make the listeners to be executed? I mean, dispatching manually the desired events from the fixtures load method? Why aren't listeners executed?
abstract class APITest extends WebTestCase
{
protected $app;
public function createApplication()
{
$app = require __DIR__ . '/../../app.php';
require __DIR__ . '/../../controllers.php';
require __DIR__ . '/../../routing.php';
$app['debug'] = true;
unset($app['exception_handler']);
$app['session.test'] = true;
return $app;
}
public function setUp()
{
parent::setUp();
/* @var $app Application */
$app = $this->app;
$fixtures = new TestingFixtures($app);
$fixtures->load();
}
...
}
Aucun commentaire:
Enregistrer un commentaire