10000 fixed CS · symfony/symfony@d66b03c · GitHub
[go: up one dir, main page]

Skip to content

Commit d66b03c

Browse files
committed
fixed CS
1 parent 694697d commit d66b03c

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

tests/Symfony/Tests/Component/Security/Http/Firewall/DigestDataTest.php

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,6 @@
1515

1616
class DigestDataTest extends \PHPUnit_Framework_TestCase
1717
{
18-
public function setUp()
19-
{
20-
class_exists('Symfony\Component\Security\Http\Firewall\DigestAuthenticationListener', true);
21-
}
22-
2318
public function testGetResponse()
2419
{
2520
$digestAuth = new DigestData(
@@ -85,6 +80,28 @@ public function testCalculateServerDigestWithQuote()
8580
$this->calculateServerDigest('\"user\"', 'Welcome, \"robot\"!', 'pass,word=password', 'ThisIsAKey', '00000001', 'MDIwODkz', 'auth', 'GET', '/path/info?p1=5&p2=5');
8681
}
8782

83+
public function testIsNonceExpired()
84+
{
85+
$time = microtime(true) + 10;
86+
$key = 'ThisIsAKey';
87+
$nonce = base64_encode($time . ':' . md5($time . ':' . $key));
88+
89+
$digestAuth = new DigestData(
90+
'username="user", realm="Welcome, robot!", nonce="' . $nonce . '", ' .
91+
'uri="/path/info?p1=5&p2=5", cnonce="MDIwODkz", nc=00000001, qop="auth", ' .
92+
'response="b52938fc9e6d7c01be7702ece9031b42"'
93+
);
94+
95+
$digestAuth->validateAndDecode($key, 'Welcome, robot!');
96+
97+
$this->assertFalse($digestAuth->isNonceExpired());
98+
}
99+
100+
protected function setUp()
101+
{
102+
class_exists('Symfony\Component\Security\Http\Firewall\DigestAuthenticationListener', true);
103+
}
104+
88105
private function calculateServerDigest($username, $realm, $password, $key, $nc, $cnonce, $qop, $method, $uri)
89106
{
90107
$time = microtime(true);
@@ -102,21 +119,4 @@ private function calculateServerDigest($username, $realm, $password, $key, $nc,
102119

103120
$this->assertEquals($digestAuth->getResponse(), $digestAuth->calculateServerDigest($password, $method));
104121
}
105-
106-
public function testIsNonceExpired()
107-
{
108-
$time = microtime(true) + 10;
109-
$key = 'ThisIsAKey';
110-
$nonce = base64_encode($time . ':' . md5($time . ':' . $key));
111-
112-
$digestAuth = new DigestData(
113-
'username="user", realm="Welcome, robot!", nonce="' . $nonce . '", ' .
114-
'uri="/path/info?p1=5&p2=5", cnonce="MDIwODkz", nc=00000001, qop="auth", ' .
115-
'response="b52938fc9e6d7c01be7702ece9031b42"'
116-
);
117-
118-
$digestAuth->validateAndDecode($key, 'Welcome, robot!');
119-
120-
$this->assertFalse($digestAuth->isNonceExpired());
121-
}
122-
}
122+
}

0 commit comments

Comments
 (0)
0