public function execute($filterChain)
 {
     $t = $this->t;
     $user = $this->user;
     // sfFlashFilter has executed code before its call to filterChain->execute()
     $t->is($user->getAttribute('previous_request', true, 'symfony/flash/remove'), true, '->execute() flags flash variables to be removed after request execution');
     $t->is($user->getAttribute('every_request', true, 'symfony/flash/remove'), true, '->execute() flags flash variables to be removed after request execution');
     $filterChain->execute();
     // action execution
     $component = new myComponent();
     $component->user = $user;
     $component->setFlash('this_request', 'foo', 'symfony/flash');
     $component->setFlash('every_request', 'foo', 'symfony/flash');
 }
Example #2
0
 * For the full copyright and license information, please component 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(8);
class myComponent extends sfComponent
{
    function execute($request)
    {
    }
}
$context = sfContext::getInstance(array('routing' => 'sfNoRouting', 'request' => 'sfWebRequest'));
// ->initialize()
$t->diag('->initialize()');
$component = new myComponent($context, 'module', 'action');
$t->is($component->getContext(), $context, '->initialize() takes a sfContext object as its first argument');
$component->initialize($context, 'module', 'action');
$t->is($component->getContext(), $context, '->initialize() takes a sfContext object as its first argument');
// ->getContext()
$t->diag('->getContext()');
$component->initialize($context, 'module', 'action');
$t->is($component->getContext(), $context, '->getContext() returns the current context');
// ->getRequest()
$t->diag('->getRequest()');
$component->initialize($context, 'module', 'action');
$t->is($component->getRequest(), $context->getRequest(), '->getRequest() returns the current request');
// ->getResponse()
$t->diag('->getResponse()');
$component->initialize($context, 'module', 'action');
$t->is($component->getResponse(), $context->getResponse(), '->getResponse() returns the current response');
 * For the full copyright and license information, please component 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(8, new lime_output_color());
class myComponent extends sfComponent
{
    function execute()
    {
    }
}
$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');