Definition at line 8 of file AuthenticationTest.php.
◆ getCredentialsDataProvider()
getCredentialsDataProvider |
( |
| ) |
|
- Returns
- array
Definition at line 28 of file AuthenticationTest.php.
31 $password =
'password';
32 $header =
'Basic bG9naW46cGFzc3dvcmQ=';
34 $anotherLogin =
'another_login';
35 $anotherPassword =
'another_password';
36 $anotherHeader =
'Basic YW5vdGhlcl9sb2dpbjphbm90aGVyX3Bhc3N3b3Jk';
40 [[
'REDIRECT_HTTP_AUTHORIZATION' => $header], $login, $password],
41 [[
'HTTP_AUTHORIZATION' => $header], $login, $password],
42 [[
'Authorization' => $header], $login, $password],
45 'REDIRECT_HTTP_AUTHORIZATION' => $header,
46 'PHP_AUTH_USER' => $anotherLogin,
47 'PHP_AUTH_PW' => $anotherPassword,
54 'REDIRECT_HTTP_AUTHORIZATION' => $header,
55 'PHP_AUTH_USER' => $anotherLogin,
56 'PHP_AUTH_PW' => $anotherPassword,
62 [
'REDIRECT_HTTP_AUTHORIZATION' => $header,
'HTTP_AUTHORIZATION' => $anotherHeader],
◆ testGetCredentials()
testGetCredentials |
( |
|
$server, |
|
|
|
$expectedLogin, |
|
|
|
$expectedPass |
|
) |
| |
- Parameters
-
array | $server | |
string | $expectedLogin | |
string | $expectedPass | @dataProvider getCredentialsDataProvider |
Definition at line 16 of file AuthenticationTest.php.
19 $request->expects($this->once())->method(
'getServerValue')->will($this->returnValue($server));
21 $authentication = new \Magento\Framework\HTTP\Authentication(
$request,
$response);
22 $this->assertSame([$expectedLogin, $expectedPass], $authentication->getCredentials());
◆ testSetAuthenticationFailed()
testSetAuthenticationFailed |
( |
| ) |
|
Definition at line 69 of file AuthenticationTest.php.
71 $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
77 \
Magento\Framework\HTTP\Authentication::class,
84 $authentication->setAuthenticationFailed($realm);
87 $this->assertTrue($headers->has(
'WWW-Authenticate'));
88 $header = $headers->get(
'WWW-Authenticate');
89 $this->assertEquals(
'Basic realm="' . $realm .
'"', $header->current()->getFieldValue());
90 $this->assertContains(
'401',
$response->getBody());
The documentation for this class was generated from the following file: