Phalcon单元测试监听器事件

时间:2014-02-19 09:25:50

标签: php unit-testing events listener phalcon

我通过\ Phalcon \ Mvc \ Application编写一个监听器来挂钩事件触发器。我的代码在下面

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);

以下是我的班级听众\应用

namespace Listener;

use Phalcon\Mvc\Dispatcher\Exception as DispatchException;

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

我想为这个监听器编写PHP单元测试(启动方法)。任何人都可以帮我写一下这种情况的例子。

谢谢和最诚挚的问候,

1 个答案:

答案 0 :(得分:1)

查看Phalcon附带的Event Manager test