9 $config = new \HashConfig( [
10 'EnableEmail' =>
true,
11 'EmailAuthentication' =>
true,
15 $provider->setConfig( $config );
16 $providerPriv = \TestingAccessWrapper::newFromObject( $provider );
17 $this->assertTrue( $providerPriv->sendConfirmationEmail );
20 'sendConfirmationEmail' =>
false,
22 $provider->setConfig( $config );
23 $providerPriv = \TestingAccessWrapper::newFromObject( $provider );
24 $this->assertFalse( $providerPriv->sendConfirmationEmail );
60 $creator = $this->getMock(
'User' );
61 $userWithoutEmail = $this->getMock(
'User' );
62 $userWithoutEmail->expects( $this->any() )->method(
'getEmail' )->willReturn(
'' );
63 $userWithoutEmail->expects( $this->never() )->method(
'sendConfirmationMail' );
64 $userWithEmailError = $this->getMock(
'User' );
65 $userWithEmailError->expects( $this->any() )->method(
'getEmail' )->willReturn(
'foo@bar.baz' );
66 $userWithEmailError->expects( $this->any() )->method(
'sendConfirmationMail' )
67 ->willReturn( \Status::newFatal(
'fail' ) );
68 $userExpectsConfirmation = $this->getMock(
'User' );
69 $userExpectsConfirmation->expects( $this->any() )->method(
'getEmail' )
70 ->willReturn(
'foo@bar.baz' );
71 $userExpectsConfirmation->expects( $this->once() )->method(
'sendConfirmationMail' )
72 ->willReturn( \Status::newGood() );
73 $userNotExpectsConfirmation = $this->getMock(
'User' );
74 $userNotExpectsConfirmation->expects( $this->any() )->method(
'getEmail' )
75 ->willReturn(
'foo@bar.baz' );
76 $userNotExpectsConfirmation->expects( $this->never() )->method(
'sendConfirmationMail' );
79 'sendConfirmationEmail' =>
false,
81 $provider->setManager( $authManager );
82 $provider->beginSecondaryAccountCreation( $userNotExpectsConfirmation, $creator, [] );
85 'sendConfirmationEmail' =>
true,
87 $provider->setManager( $authManager );
88 $provider->beginSecondaryAccountCreation( $userWithoutEmail, $creator, [] );
89 $provider->beginSecondaryAccountCreation( $userExpectsConfirmation, $creator, [] );
92 $logger = $this->getMockForAbstractClass( LoggerInterface::class );
93 $logger->expects( $this->once() )->method(
'warning' );
94 $provider->setLogger( $logger );
95 $provider->beginSecondaryAccountCreation( $userWithEmailError, $creator, [] );
98 $authManager->setAuthenticationSessionData(
'no-email',
true );
99 $provider->setManager( $authManager );
100 $provider->beginSecondaryAccountCreation( $userNotExpectsConfirmation, $creator, [] );