[symfony-users] Re: IS there any manual to correct unit test system for integrating with sfGuard auth symfony?

2010-08-20 Thread Massimiliano Arione
On 19 Ago, 16:41, Christopher Schnell 
wrote:
> You are talking about functional tests, but the original post was about unit 
> tests.

Indeed, topic is about unit testing, but the subject doesn't make
sense with that.
There's no "frontend" in unit tests, nor authentication.
So we can assume we're talking about functional tests

cheers
Massimiliano

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

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
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


AW: [symfony-users] Re: IS there any manual to correct unit test system for integrating with sfGuard auth symfony?

2010-08-19 Thread Christopher Schnell
You are talking about functional tests, but the original post was about unit 
tests.

Regards,
Christopher.

> -Ursprüngliche Nachricht-
> Von: symfony-users@googlegroups.com [mailto:symfony-
> us...@googlegroups.com] Im Auftrag von Massimiliano Arione
> Gesendet: Donnerstag, 19. August 2010 16:06
> An: symfony users
> Betreff: [symfony-users] Re: IS there any manual to correct unit test
> system for integrating with sfGuard auth symfony?
> 
> On 19 Ago, 05:14, Maxim Oleinik  wrote:
> > protected function authenticateUser(sfGuardUser $user)
> > {
> >     // Init session
> >     $context = $this->browser->getContext(true);
> >
> >     $context->getUser()->signIn($user);
> >     $context->getUser()->shutdown();
> >     $context->getStorage()->shutdown();
> >
> > }
> 
> Ugly!
> 
> try this one:
> 
>   public function login($username = 'foo', $password = 'bar')
>   {
> return $this->click('sign in', array('signin' => array(
>   'username' => $username,
>   'password' => $password,
> )))->with('response')->isRedirected()->followRedirect();
>   }
> 
> of course, replace 'foo' and 'bar' with your preferred default
> credentials
> 
> cheers
> Massimiliano
> 
> --
> If you want to report a vulnerability issue on symfony, please send it
> to security at symfony-project.com
> 
> 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
> symfony-users+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/symfony-users?hl=en

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

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
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


[symfony-users] Re: IS there any manual to correct unit test system for integrating with sfGuard auth symfony?

2010-08-19 Thread Massimiliano Arione
On 19 Ago, 05:14, Maxim Oleinik  wrote:
> protected function authenticateUser(sfGuardUser $user)
> {
>     // Init session
>     $context = $this->browser->getContext(true);
>
>     $context->getUser()->signIn($user);
>     $context->getUser()->shutdown();
>     $context->getStorage()->shutdown();
>
> }

Ugly!

try this one:

  public function login($username = 'foo', $password = 'bar')
  {
return $this->click('sign in', array('signin' => array(
  'username' => $username,
  'password' => $password,
)))->with('response')->isRedirected()->followRedirect();
  }

of course, replace 'foo' and 'bar' with your preferred default
credentials

cheers
Massimiliano

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

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
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


[symfony-users] Re: IS there any manual to correct unit test system for integrating with sfGuard auth symfony?

2010-08-18 Thread Maxim Oleinik
protected function authenticateUser(sfGuardUser $user)
{
// Init session
$context = $this->browser->getContext(true);

$context->getUser()->signIn($user);
$context->getUser()->shutdown();
$context->getStorage()->shutdown();
}

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

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
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


[symfony-users] Re: IS there any manual to correct unit test system for integrating with sfGuard auth symfony?

2010-08-17 Thread Massimiliano Arione
On 17 Ago, 05:32, RusAlex  wrote:
> I've installed sfGuard plugin and now most of old tests didn't work
> well. They need to be authenticated to the frontend system. Is there
> any official decision ?

Just create your own test class, like explained in
http://www.symfony-project.org/jobeet/1_4/Propel/en/09#chapter_09_test_data
You can then easily create a login() method that does the login for
you, by submitting the login form

cheers
Massimiliano

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

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
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en