Codeception / module-phalcon4

Phalcon 4 module for Codeception
https://codeception.com/docs/modules/Phalcon4
MIT License
3 stars 8 forks source link

Replacing service in DI from functional test not working #3

Closed denkurbatov closed 4 years ago

denkurbatov commented 4 years ago

Expected and Actual Behavior

I'm trying replace service in DI when write functional test. I'm need it for mock services in DI.

Simple example:

In services.php file:

$di->set('myService', Elements::class);

In IndexCept.php:

$I->addServiceToContainer('myService', NotFoundPlugin::class);

In IndexController.php, indexAction:

var_dump($this->getDI()->get('myService'));
exit;

I expect that var_dump() function return object of NotFoundPlugin class, but get Elements class.

I'm just trying different approaches, like get application instance, get default DI, etc. Still not working. Thank you for any help or suggestions.

Details

sergeyklay commented 4 years ago

/cc @Jeckerson

Jeckerson commented 4 years ago

@sergeyklay Are we still supporting Phalcon v3 here?

Naktibalda commented 4 years ago

Phalcon module only supports Phalcon v3. Maybe v2 too.

I see that a new repository was created for Phalcon4 module at https://github.com/Codeception/module-phalcon4

ruudboon commented 4 years ago

@denkurbatov Do you have the possibility to test with Phalcon 4? It's fixed in v1.0.2

denkurbatov commented 4 years ago

@ruudboon Yes, I will try. But I'm not sure that my old apps ready for Phalcon 4 :) Will let you know, thank you a lot.

denkurbatov commented 4 years ago

@ruudboon I have checked it, and it works as expected with Phalcon 4 and this codeception module. Thank you a lot for a quick fix.

Is it possible to make same fix to module https://github.com/Codeception/module-phalcon as well? I already checked, same fix works also in old module version :) Thank you anyway, even if you don't support old version of Phalcon anymore will do my best for updating old apps to Phalcon 4 :)

ruudboon commented 4 years ago

Let's open a new issue at https://github.com/Codeception/module-phalcon if this is still required for v3