Because we are replacing/porting a huge amount of *Peer classes to use
dbFinder power, we are creating unit tests to compare the results (to
make sure we didn't make mistakes during the 'port').

Now for that i am using a snippet (found here :
http://www.symfony-project.org/snippets/snippet/215) to tell the test
environment to load initialise propel & autoload my classes. Untill
there everything is fine.

Now when debugging a wrong test, i tried to use the $dbfinder-
>getLatestQuery().

This throws the exception :

[RuntimeException]
sfPropelFinder::getLatestQuery() only works when debug mode is enabled

So apparently you need to make sure propel is being run in 'debug'
mode. After looking around i found propel is using a wrapper to store
the executed queries, that class goes by the name of
sfDebugConnection.

Now the question, how can i tell propel (when being loaded) or the
environment to make sure propel debugging is enabled ?

This is the code i am using in the beginning of the unit-test script
(environment : dev, sf_debug = true). Note that the ->getLatestQuery
method is using in frontend_dev.php where my environment is dev too.
Any thoughts ?


if ([EMAIL PROTECTED]('SF_APP')) { // Only load constants in not done before
(group tests)
    define('SF_APP', 'frontend');
    define('SF_ENVIRONMENT', 'dev');
    define('SF_DEBUG', TRUE);
}

if ([EMAIL PROTECTED]('SF_ROOT_DIR')) { // Only load constants in not done
before (group tests)
    include(dirname(__FILE__).'/../bootstrap/unit.php');
}

sfCore::initSimpleAutoload(array(SF_ROOT_DIR.'/lib/model' // DB model
classes
                                ,SF_ROOT_DIR . '/apps/' . SF_APP .  "/
lib" // Symfony itself
                                ,$sf_symfony_lib_dir // Symfony itself
                                ,dirname(__FILE__).'/../../lib' //
Location class to be tested
                                ,dirname(__FILE__).'/../../apps/
stageselect/lib' // Location myapp application
                                ,SF_ROOT_DIR.'/plugins')); // Location
plugins

set_include_path($sf_symfony_lib_dir . '/vendor' . PATH_SEPARATOR .
SF_ROOT_DIR . PATH_SEPARATOR . get_include_path());

/*
 * Start database connection and Symfony core
 */
sfCore::bootstrap($sf_symfony_lib_dir, $sf_symfony_data_dir);
sfContext::getInstance();

Propel::setConfiguration(sfPropelDatabase::getConfiguration());
Propel::initialize();

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
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