Open amenk opened 11 years ago
Probably issue is in Magento core, but strange, since I easily created tests before with the same action dispatch that was checking execution of observer and it was working without problems, including fixtures, the only problem I was facing it is core Mage::register() calls in controllers so in setUp I cleared them up to make it testable.
I guess all the issues are somehow in Magento core as Mage 1 it is just not so well testable, isn't it :-) ? Did you check actual execution or just the assertEventDispatches() ? Is that test you made in the testsuite?
This actually seems to be fixed in the latest EcomDev_PHPUnit - i was not noticing this because the version number in the config.xml stayed the same.
@IvanChepurnyi Is it possible to updated the version number in config.xml on new pushes to master? Or is the master just not considered stable?
I have a module that registers a frontend event "controller_action_predispatch_wishlist_index_send"
Steps to reproduce:
If I directly dispatch the "right" action, i.e. the action that fires the event, it will be fired:
Steps to reproduce:
I debugged this a little and there seems to be some kind of caching problem. After the first dispatch, the event cache is already initialized. Now during the second call, events that have not fired before, are just ignored.
Correction:
I made a small test module to reproduce this: https://github.com/amenk/N98_EcomDevPHPUnitIssue
Running both tests
phpunit.phar --debug --filter N98_EcomDevPHPUnitIssue_Test_Controller_TestController PHPUnit 3.7.13 by Sebastian Bergmann.
Configuration read from tests/integration/phpunit.xml
Starting test 'N98_EcomDevPHPUnitIssue_Test_Controller_TestController::aAction'. . Starting test 'N98_EcomDevPHPUnitIssue_Test_Controller_TestController::bAction'. F
Time: 5 seconds, Memory: 55.50Mb
There was 1 failure:
1) N98_EcomDevPHPUnitIssue_Test_Controller_TestController::bAction event was not really fired Failed asserting that null is true.
app/code/local/N98/EcomDevPHPUnitIssue/Test/Controller/TestController.php:30 phpunit.phar:524
FAILURES! Tests: 2, Assertions: 4, Failures: 1.
Running only bAction
phpunit.phar --debug --filter N98_EcomDevPHPUnitIssue_Test_Controller_TestController::bAction PHPUnit 3.7.13 by Sebastian Bergmann.
Configuration read from tests/integration/phpunit.xml
Starting test 'N98_EcomDevPHPUnitIssue_Test_Controller_TestController::bAction'. .
Time: 4 seconds, Memory: 36.50Mb
OK (1 test, 4 assertions)