Zend Framework, HelperBroker PHPUnit Test

This is a very specific question, and I have search queries for a potential solution, but nothing points me in the right direction. I wrote Zend_Controller_Action_Helper to help me process some forms in my application. Now it works fine in the application, but it throws it to break my tests. If I comment on the lines that add an assistant to the broker, everything works fine, but this view wins the object. The error I get is this

Fatal error: Class 'PHPUnit_Framework_Error_Notice' not found in /Users/chris/NetBeansProjects/myProject/library/ProcessForm.php on line 25

What I don't understand is the reason that it throws this error on line 25, which specifically

public function processForm($aParam)

So, I have to paste the code to show you some applications. I am adding this Helper to the bootstrap of my application, for example ...

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
    protected function _initHelpers()
    {
        // If I comment out these lines it all works
        require_once 'ProcessForm.php';
        Zend_Controller_Action_HelperBroker::addHelper(
            new ProcessForm()
        );
    }
}

My PHPUnit boot file is as follows

require_once 'Zend/Application.php';
require_once 'Zend/Test/PHPUnit/ControllerTestCase.php';

abstract class ControllerTestCase extends Zend_Test_PHPUnit_ControllerTestCase
{

    protected $application;

    public function setUp()
    {
        $this->bootstrap = array($this, 'appBootstrap');
        parent::setUp();
        $this->getFrontController()->setParam('bootstrap', $this->application->getBootstrap());
    }

    public function appBootstrap()
    {
        $this->application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini');
        $this->application->bootstrap();
    }


}

class ProcessForm extends Zend_Controller_Action_Helper_Abstract
{
    /**
     * @var Zend_Loader_PluginLoader
     */
    public $pluginLoader;

    /**
     * Constructor: initialize plugin loader
     *
     * @return void
     */
    public function __construct()
    {
        $this->pluginLoader = new Zend_Loader_PluginLoader();
    }

    public function processForm($aParam)
    {
    }

    public function direct($aParam)
    {
        return $this->processForm($aParam);
    }
}
+3
1

, , ( , php 5.3), - , . .

class ProcessForm extends Zend_Controller_Action_Helper_Abstract
{
    /**
    * @var Zend_Loader_PluginLoader
    */
    public $pluginLoader;

    /**
    * Constructor: initialize plugin loader
    *
    * @return void
    */
    public function __construct()
    {
        $this->pluginLoader = new Zend_Loader_PluginLoader();
    }

    public function doThis($aParam)
    {
    }

    public function direct($aParam)
    {
        return $this->doThis($aParam);
    }
}

, php 5.3 __construct myClass, , .

+1

Source: https://habr.com/ru/post/1770705/


All Articles