Skip to content
This repository was archived by the owner on Jul 9, 2019. It is now read-only.

Conversation

@Raphy
Copy link

@Raphy Raphy commented Mar 18, 2016

No description provided.

*/
class PasswordGrantExtensionTest extends \PHPUnit_Framework_TestCase
{
public function testConfigureRequestParameters()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

phpdoc


$actualDefinedOptions = $optionsResolver->getRequiredOptions();
$expectedDefinedOptions = ['password', 'username'];
$this->assertEquals($expectedDefinedOptions, $actualDefinedOptions, '', $delta = 0.0, 10, true); // Not caring about keys
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mais il faut aussi tester que les options optionnelles existent toujours.

$userPasswordEncoderMock = $this->prophesize(UserPasswordEncoderInterface::class);
$userPasswordEncoderMock->isPasswordValid(Argument::type(UserInterface::class), 'password_test')->willReturn(true)->shouldBeCalled();
/** @var UserPasswordEncoderInterface $userPasswordEncoder */
$userPasswordEncoder = $userPasswordEncoderMock->reveal();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fait le dans le constructeur

/** @var LoginAttempt $loginAttempt */
$loginAttempt = $loginAttemptMock->reveal();

$actualAccount = $passwordGrantExtension->grant($application, $loginAttempt);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$actualAccount = $passwordGrantExtension->grant(
    $application->reveal(), 
    $loginAttempt->reveal()
);

@jamyouss
Copy link
Contributor

@Raphy please squash your commits !

$this->assertEquals($expectedRequiredOptions, $actualRequiredOptions, '', $delta = 0.0, 10, true); // Not caring about keys

// Testing the optional options
$actualOptionalOptions = array_diff($optionsResolver->getDefinedOptions(), $actualRequiredOptions);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pourquoi faire la distinction ? Ce que tu veux tester ici, c'est que les options définies le sont toujours, une option obligatoire est requise donc tu peux la tester.

@Nyxis
Copy link
Contributor

Nyxis commented Apr 8, 2016

Oui squash les commits ;) 📦

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants