简体   繁体   中英

Phalcon Unit Test listener event

I write a listener to hook event trigger by \\Phalcon\\Mvc\\Application. And my code is below

use Phalcon\Mvc\Application;
use Phalcon\Events\Manager as EventManager;
use Listener\Application as ApplicationListener;

// Create application instance
$application = new Application();
$application->setEventsManager(new EventManager());

// Attach listener to handle events
$application->getEventsManager()
            ->attach("application", new ApplicationListener(), 1000);

And below this is my class Listener\\Application

namespace Listener;

use Phalcon\Mvc\Dispatcher\Exception as DispatchException;

class Application
{
    public function boot($event, $application)
    {
        /* Do something */
    }
}

I want to write PHP Unit test for this listener (boot method). Can anyone help me to write example for this situation.

Thanks and best regards,

查看Phalcon随附的Event Manager测试

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM