class EmailNotificationSecondaryAuthenticationProviderTest extends \PHPUnit_Framework_TestCase {
public function testConstructor() {
class EmailNotificationSecondaryAuthenticationProviderTest extends \PHPUnit_Framework_TestCase {
public function testConstructor() {
$this->assertTrue( $providerPriv->sendConfirmationEmail );
$provider = new EmailNotificationSecondaryAuthenticationProvider( [
'sendConfirmationEmail' => false,
] );
$provider->setConfig( $config );
$this->assertTrue( $providerPriv->sendConfirmationEmail );
$provider = new EmailNotificationSecondaryAuthenticationProvider( [
'sendConfirmationEmail' => false,
] );
$provider->setConfig( $config );
public function testBeginSecondaryAccountCreation() {
$authManager = new AuthManager( new \FauxRequest(), new \HashConfig() );
public function testBeginSecondaryAccountCreation() {
$authManager = new AuthManager( new \FauxRequest(), new \HashConfig() );
- $creator = $this->getMock( 'User' );
- $userWithoutEmail = $this->getMock( 'User' );
+ $creator = $this->getMockBuilder( 'User' )->getMock();
+ $userWithoutEmail = $this->getMockBuilder( 'User' )->getMock();
$userWithoutEmail->expects( $this->any() )->method( 'getEmail' )->willReturn( '' );
$userWithoutEmail->expects( $this->any() )->method( 'getInstanceForUpdate' )->willReturnSelf();
$userWithoutEmail->expects( $this->never() )->method( 'sendConfirmationMail' );
$userWithoutEmail->expects( $this->any() )->method( 'getEmail' )->willReturn( '' );
$userWithoutEmail->expects( $this->any() )->method( 'getInstanceForUpdate' )->willReturnSelf();
$userWithoutEmail->expects( $this->never() )->method( 'sendConfirmationMail' );
$userWithEmailError->expects( $this->any() )->method( 'getEmail' )->willReturn( 'foo@bar.baz' );
$userWithEmailError->expects( $this->any() )->method( 'getInstanceForUpdate' )->willReturnSelf();
$userWithEmailError->expects( $this->any() )->method( 'sendConfirmationMail' )
->willReturn( \Status::newFatal( 'fail' ) );
$userWithEmailError->expects( $this->any() )->method( 'getEmail' )->willReturn( 'foo@bar.baz' );
$userWithEmailError->expects( $this->any() )->method( 'getInstanceForUpdate' )->willReturnSelf();
$userWithEmailError->expects( $this->any() )->method( 'sendConfirmationMail' )
->willReturn( \Status::newFatal( 'fail' ) );
$userExpectsConfirmation->expects( $this->any() )->method( 'getEmail' )
->willReturn( 'foo@bar.baz' );
$userExpectsConfirmation->expects( $this->any() )->method( 'getInstanceForUpdate' )
->willReturnSelf();
$userExpectsConfirmation->expects( $this->once() )->method( 'sendConfirmationMail' )
->willReturn( \Status::newGood() );
$userExpectsConfirmation->expects( $this->any() )->method( 'getEmail' )
->willReturn( 'foo@bar.baz' );
$userExpectsConfirmation->expects( $this->any() )->method( 'getInstanceForUpdate' )
->willReturnSelf();
$userExpectsConfirmation->expects( $this->once() )->method( 'sendConfirmationMail' )
->willReturn( \Status::newGood() );
$userNotExpectsConfirmation->expects( $this->any() )->method( 'getEmail' )
->willReturn( 'foo@bar.baz' );
$userNotExpectsConfirmation->expects( $this->any() )->method( 'getInstanceForUpdate' )
$userNotExpectsConfirmation->expects( $this->any() )->method( 'getEmail' )
->willReturn( 'foo@bar.baz' );
$userNotExpectsConfirmation->expects( $this->any() )->method( 'getInstanceForUpdate' )