Hi,

I'm working a plugin for symfony and I run into a problem with autoload
in plugin unit test. I've developed a test using mock object's propel model
using the following snippet code to start test.


define('SF_ROOT_DIR',    realpath(dirname(__FILE__).'/../../../../') );
define('SF_APP',         'frontend');
define('SF_ENVIRONMENT', 'test');
define('SF_DEBUG',       true);

include( SF_ROOT_DIR.'/config/config.php' );
require_once($sf_symfony_lib_dir.'/util/sfCore.class.php');
sfCore::bootstrap($sf_symfony_lib_dir, $sf_symfony_data_dir);
require_once($sf_symfony_lib_dir.'/vendor/lime/lime.php');

require(dirname(__FILE__).'/../MockType.class.php');
require(dirname(__FILE__).'/../MockTypePeer.class.php');


I've developed test that call
sfContext::getInstance()->retrieveObjects('MockType') method
and this method use sfCore::getClassPath as you can see:

  static public function retrieveObjects($class, $peerMethod = null)
  {
    if (!$classPath = sfCore::getClassPath($class.'Peer'))
    {
      throw new sfException(sprintf('Unable to find path for class
"%s".', $class.'Peer'));
    }
    ....

But it doesn't see if it this class has already exist. So the unit test throw
this exception:

Uncaught exception 'sfException' with message 'Unable to find path for
class "MockTypePeer".' in
/usr/share/php/symfony/addon/propel/database/sfPropelDataRetriever.class.php:25

The sfCore::getClassPath use autoload struct, and sfCore don't have
method to put
Mock objects path in this struct.

  static public function getClassPath($class)
  {
    return isset(self::$classes[$class]) ? self::$classes[$class] : null;
  }

Is there any workaround for this issue?

I think if  sfContext::getInstance()->retrieveObjects method make a exist class
test before call getClassPath will resolve it, won't it?

I'm using symfony 1.0.7

-- 
Marco Catunda

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to