Author Topic

Bertrand Dunogier

Saturday 14 November 2009 12:25:22 pm

Comment55786

"

One question I have is: what is the recommended way to introduce specific ini settings in the unit tests?

Eg. test this when ini x.y.z is set to A, then test it when it is set to B.

"

Does anyone know how you can split the quote ? e.g. answer between lines... I haven't found a way on chrome or firefox yet.

I have the perfect answer to the INI question ! :)
Check this file: http://pubsvn.ez.no/nextgen/trunk/tests/toolkit/ezpinihelper.php

It's a helper class I've used to test some features where I needed forced values for INI settings (setting up the cluster environnement for instance). It is very simple:

// Set DatabaseSettings.DatabaseName to 'myotherdb' in site.ini
ezpINIHelper::setINISetting( 'site.ini', 'DatabaseSettings', 'DatabaseName', 'myotherdb' );

// bla bla bla, test stuff with DB

// Restore the previous settings
ezpINIHelper::restoreINISettings()

Bertrand Dunogier
eZ Systems Engineering, Lyon
http://twitter.com/bdunogier
http://gplus.to/BertrandDunogier