3 namespace MediaWiki\Auth
;
5 use InvalidArgumentException
;
9 * @covers MediaWiki\Auth\ConfirmLinkAuthenticationRequest
11 class ConfirmLinkAuthenticationRequestTest
extends AuthenticationRequestTestCase
{
13 protected function getInstance( array $args = [] ) {
14 return new ConfirmLinkAuthenticationRequest( $this->getLinkRequests() );
18 * @expectedException InvalidArgumentException
19 * @expectedExceptionMessage $linkRequests must not be empty
21 public function testConstructorException() {
22 new ConfirmLinkAuthenticationRequest( [] );
26 * Get requests for testing
27 * @return AuthenticationRequest[]
29 private function getLinkRequests() {
32 $mb = $this->getMockBuilder( AuthenticationRequest
::class )
33 ->setMethods( [ 'getUniqueId' ] );
34 for ( $i = 1; $i <= 3; $i++
) {
35 $req = $mb->getMockForAbstractClass();
36 $req->expects( $this->any() )->method( 'getUniqueId' )
37 ->will( $this->returnValue( "Request$i" ) );
38 $reqs[$req->getUniqueId()] = $req;
44 public function provideLoadFromSubmission() {
45 $reqs = $this->getLinkRequests();
51 [ 'linkRequests' => $reqs ],
55 [ 'confirmedLinkIDs' => [ 'Request1', 'Request3' ] ],
56 [ 'confirmedLinkIDs' => [ 'Request1', 'Request3' ], 'linkRequests' => $reqs ],
61 public function testGetUniqueId() {
62 $req = new ConfirmLinkAuthenticationRequest( $this->getLinkRequests() );
64 get_class( $req ) . ':Request1|Request2|Request3',