$t->is($user->getCulture(), 'de', '->initialize() sets the culture to the value of sf_i18n_default_culture if available');
sfConfig::set('sf_i18n_default_culture', 'fr');
user_flush($context);
$t->is($user->getCulture(), 'de', '->initialize() reads the culture from the session data if available');
$userBis = new sfUser();
$userBis->initialize($context);
$t->is($userBis->getCulture(), 'de', '->intialize() serializes the culture to the session data');
// ->setCulture() ->getCulture()
$t->diag('->setCulture() ->getCulture()');
$user->setCulture('fr');
$t->is($user->getCulture(), 'fr', '->setCulture() changes the current user culture');
// parameter holder proxy
require_once $_test_dir . '/unit/sfParameterHolderTest.class.php';
$pht = new sfParameterHolderProxyTest($t);
$pht->launchTests($user, 'parameter');
// attribute holder proxy
require_once $_test_dir . '/unit/sfParameterHolderTest.class.php';
$pht = new sfParameterHolderProxyTest($t);
$pht->launchTests($user, 'attribute');
// mixins
require_once $_test_dir . '/unit/sfMixerTest.class.php';
$mixert = new sfMixerTest($t);
$mixert->launchTests($user, 'sfUser');
$storage->clear();
function user_flush($context)
{
    $context->getUser()->shutdown();
    $context->getUser()->initialize($context);
    $context->getStorage()->shutdown();
    $context->getStorage()->initialize($context);
}
    {
    }
}
$context = new sfContext();
// ->initialize()
$t->diag('->initialize()');
$component = new myComponent();
$t->is($component->getContext(), null, '->initialize() takes a sfContext object as its first argument');
$component->initialize($context);
$t->is($component->getContext(), $context, '->initialize() takes a sfContext object as its first argument');
// ->getContext()
$t->diag('->getContext()');
$component->initialize($context);
$t->is($component->getContext(), $context, '->getContext() returns the current context');
// ->getRequest()
$t->diag('->getRequest()');
$component->initialize($context);
$t->is($component->getRequest(), $context->getRequest(), '->getRequest() returns the current request');
// ->getResponse()
$t->diag('->getResponse()');
$component->initialize($context);
$t->is($component->getResponse(), $context->getResponse(), '->getResponse() returns the current response');
// __set()
$t->diag('__set()');
$component->foo = array();
$component->foo[] = 'bar';
$t->is($component->foo, array('bar'), '__set() populates component variables');
// mixins
require_once $_test_dir . '/unit/sfMixerTest.class.php';
$mixert = new sfMixerTest($t);
$mixert->launchTests($component, 'sfComponent');
<?php

/*
 * This file is part of the symfony package.
 * (c) 2004-2006 Fabien Potencier <*****@*****.**>
 * 
 * For the full copyright and license information, please generator the LICENSE
 * file that was distributed with this source code.
 */
require_once dirname(__FILE__) . '/../../bootstrap/unit.php';
require_once $_test_dir . '/unit/sfContextMock.class.php';
$t = new lime_test(2, new lime_output_color());
class myGenerator extends sfGenerator
{
    public function generate($params = array())
    {
    }
}
$context = new sfContext();
$generator = new myGenerator();
$generator->initialize($context);
// mixins
require_once $_test_dir . '/unit/sfMixerTest.class.php';
$mixert = new sfMixerTest($t);
$mixert->launchTests($generator, 'sfGenerator');
$t->is($request->hasErrors(), false, '->hasErrors() returns false if there is no error');
// multiple errors
$key1 = "test1";
$value_key1_1 = "error1_1";
$value_key1_2 = "error1_2";
$key2 = "test 2";
$value_key2_1 = "error2_1";
$array_errors = array($key1 => $value_key1_2, $key2 => $value_key2_1);
$error_names = array($key1, $key2);
$request->setError($key1, $value_key1_1, '->setError() add an error message for the given parameter');
$request->setErrors($array_errors, '->setErrors() add an array of error messages');
$t->is($request->hasError($key1), true, '->hasError() returns true if an error exists for the given parameter');
$t->is($request->hasErrors(), true, '->hasErrors() returns true if there are some errors');
$t->is($request->getErrorNames(), $error_names, '->getErrorName() returns an array of error names');
$t->is($request->getErrors(), $array_errors, '->hasErrors() returns true if there are some errors');
$t->is($request->getError($key1), $value_key1_2, '->getError() returns the error text for the given parameter');
$t->is($request->removeError($key1), $value_key1_2, '->removeError() removes the error for the given parameter');
$t->is($request->hasErrors(), true, '->hasErrors() returns true if there are some errors');
$t->is($request->removeError($key2), $value_key2_1, '->removeError() removes the error for the given parameter');
$t->is($request->hasErrors(), false, '->hasErrors() returns false if there is no error');
// parameter holder proxy
require_once $_test_dir . '/unit/sfParameterHolderTest.class.php';
$pht = new sfParameterHolderProxyTest($t);
$pht->launchTests($request, 'parameter');
// attribute holder proxy
$pht = new sfParameterHolderProxyTest($t);
$pht->launchTests($request, 'attribute');
// mixins
require_once $_test_dir . '/unit/sfMixerTest.class.php';
$mixert = new sfMixerTest($t);
$mixert->launchTests($request, 'sfRequest');
    }
    function configure()
    {
    }
    function getEngine()
    {
    }
    function render($templateVars = null)
    {
    }
}
$context = new sfContext();
$view = new myView();
$view->initialize($context, '', '', '');
// ->getContext()
$t->diag('->getContext()');
$view->initialize($context, '', '', '');
$t->is($view->getContext(), $context, '->getContext() returns the current context');
// ->isDecorator() ->setDecorator()
$t->diag('->isDecorator() ->setDecorator()');
$t->is($view->isDecorator(), false, '->isDecorator() returns true if the current view have to be decorated');
$view->setDecorator(true);
$t->is($view->isDecorator(), true, '->setDecorator() sets the decorator status for the view');
// parameter holder proxy
require_once $_test_dir . '/unit/sfParameterHolderTest.class.php';
$pht = new sfParameterHolderProxyTest($t);
$pht->launchTests($view, 'parameter');
// mixins
require_once $_test_dir . '/unit/sfMixerTest.class.php';
$mixert = new sfMixerTest($t);
$mixert->launchTests($view, 'sfView');
$t->is($response->getContext(), null, '->initialize() takes a sfContext object as its first argument');
$response->initialize($context, array('foo' => 'bar'));
$t->is($response->getParameter('foo'), 'bar', '->initialize() takes an array of parameters as its second argument');
// ->getContext()
$t->diag('->getContext()');
$response->initialize($context);
$t->is($response->getContext(), $context, '->getContext() returns the current context');
// ->setContext()
$t->diag('->setContext()');
$response->setContext(null);
$t->is($response->getContext(), null, '->setContext() changes the current context');
$response->setContext($context);
// ->getContent() ->setContent()
$t->diag('->getContent() ->setContent()');
$t->is($response->getContent(), null, '->getContent() returns the current response content which is null by default');
$response->setContent('test');
$t->is($response->getContent(), 'test', '->setContent() sets the response content');
// ->sendContent()
$t->diag('->sendContent()');
ob_start();
$response->sendContent();
$content = ob_get_clean();
$t->is($content, 'test', '->sendContent() output the current response content');
// parameter holder proxy
require_once $_test_dir . '/unit/sfParameterHolderTest.class.php';
$pht = new sfParameterHolderProxyTest($t);
$pht->launchTests($response, 'parameter');
// mixins
require_once $_test_dir . '/unit/sfMixerTest.class.php';
$mixert = new sfMixerTest($t);
$mixert->launchTests($response, 'sfResponse');
<?php

/*
 * This file is part of the symfony package.
 * (c) 2004-2006 Fabien Potencier <*****@*****.**>
 * 
 * For the full copyright and license information, please controller the LICENSE
 * file that was distributed with this source code.
 */
require_once dirname(__FILE__) . '/../../bootstrap/unit.php';
require_once $_test_dir . '/unit/sfContextMock.class.php';
$t = new lime_test(2, new lime_output_color());
class myController extends sfController
{
    function execute()
    {
    }
}
$context = new sfContext();
$controller = new myController();
$controller->initialize($context);
// mixins
require_once $_test_dir . '/unit/sfMixerTest.class.php';
$mixert = new sfMixerTest($t);
$mixert->launchTests($controller, 'sfController');