Hi,

So I am using the ZF 1 + Doctrine 2 + bisna.  Everything is fine so far
except for the unit testing.  I've used zf.sh to create the project skel
but when I try to run any tests I get
"Call to a member function getEntityManager() on a non-object"

This is my test

namespace MyApp;

/**
 * Generated by PHPUnit_SkeletonGenerator on 2012-02-20 at 23:02:42.
 */
class DaoTest extends \Zend_Test_PHPUnit_ControllerTestCase
{
    /**
     * @var Dao
     */
    protected $object;

    /**
     * Sets up the fixture, for example, opens a network connection.
     * This method is called before a test is executed.
     */
    protected function setUp()
    {
        $application = new \Zend_Application(APPLICATION_ENV,
APPLICATION_PATH . '/configs/application.ini');
        $bootstrap = $application->getBootstrap();

        $doctrineContainer = $bootstrap->getResource('doctrine');
        $entityManager = $doctrineContainer->getEntityManager();

        $this->object = new Dao(array('em' => $entityManager));
        parent::setUp();
    }
...

The lines above are used in my basecontroller (for which all my controllers
inherit) - which works.  What am I missing to make it load the resource?

public function init() {
        parent::init();
        $this->doctrineContainer =
$this->getInvokeArg('bootstrap')->getResource('doctrine');
        $this->entityManager = $this->doctrineContainer->getEntityManager();

        $this->ajaxRequest = $this->_request->isXmlHttpRequest();
        $this->appOptions = $this->getInvokeArg('bootstrap')->getOptions();

        $this->view->url = APPLICATION_URL;
$this->view->appOptions = $this->appOptions;
    }

In my application.ini I have the resources.doctrine as setup

resources.doctrine.classLoader.loaderClass = "Doctrine\Common\ClassLoader"
resources.doctrine.classLoader.loaderFile  = APPLICATION_PATH
"/../library/Doctrine/Common/ClassLoader.php"....

Reply via email to