diff options
author | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2015-02-11 06:31:16 +0100 |
---|---|---|
committer | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2015-02-11 06:31:16 +0100 |
commit | 2725de8efb7fd3af9b1d5b12a137d21e4adc5b10 (patch) | |
tree | 05a462725281de967ddb851ecaaf92fd162fc3a5 /src/Wallabag/CoreBundle/Tests | |
parent | 91f78f26f2594db3f21c712f3ec30e4d06283dff (diff) | |
download | wallabag-2725de8efb7fd3af9b1d5b12a137d21e4adc5b10.tar.gz wallabag-2725de8efb7fd3af9b1d5b12a137d21e4adc5b10.tar.zst wallabag-2725de8efb7fd3af9b1d5b12a137d21e4adc5b10.zip |
cs
Diffstat (limited to 'src/Wallabag/CoreBundle/Tests')
-rw-r--r-- | src/Wallabag/CoreBundle/Tests/Controller/WallabagRestControllerTest.php | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/Wallabag/CoreBundle/Tests/Controller/WallabagRestControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/WallabagRestControllerTest.php index ff3c9432..274a816f 100644 --- a/src/Wallabag/CoreBundle/Tests/Controller/WallabagRestControllerTest.php +++ b/src/Wallabag/CoreBundle/Tests/Controller/WallabagRestControllerTest.php | |||
@@ -3,7 +3,6 @@ | |||
3 | namespace Wallabag\CoreBundle\Tests\Controller; | 3 | namespace Wallabag\CoreBundle\Tests\Controller; |
4 | 4 | ||
5 | use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; | 5 | use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; |
6 | use Symfony\Component\Security\Core\Encoder\MessageDigestPasswordEncoder; | ||
7 | 6 | ||
8 | class WallabagRestControllerTest extends WebTestCase | 7 | class WallabagRestControllerTest extends WebTestCase |
9 | { | 8 | { |
@@ -31,13 +30,13 @@ class WallabagRestControllerTest extends WebTestCase | |||
31 | $nonce = substr(md5(uniqid('nonce_', true)), 0, 16); | 30 | $nonce = substr(md5(uniqid('nonce_', true)), 0, 16); |
32 | 31 | ||
33 | $now = new \DateTime('now', new \DateTimeZone('UTC')); | 32 | $now = new \DateTime('now', new \DateTimeZone('UTC')); |
34 | $created = (string)$now->format( 'Y-m-d\TH:i:s\Z' ); | 33 | $created = (string) $now->format('Y-m-d\TH:i:s\Z'); |
35 | $digest = base64_encode(sha1(base64_decode($nonce).$created.$encryptedPassword, true)); | 34 | $digest = base64_encode(sha1(base64_decode($nonce).$created.$encryptedPassword, true)); |
36 | 35 | ||
37 | $headers = array( | 36 | $headers = array( |
38 | 'PHP_AUTH_USER' => 'username', | 37 | 'PHP_AUTH_USER' => 'username', |
39 | 'HTTP_AUTHORIZATION' => 'Authorization profile="UsernameToken"', | 38 | 'HTTP_AUTHORIZATION' => 'Authorization profile="UsernameToken"', |
40 | 'HTTP_x-wsse' => 'X-WSSE: UsernameToken Username="'.$username.'", PasswordDigest="'.$digest.'", Nonce="'.$nonce.'", Created="'.$created.'"' | 39 | 'HTTP_x-wsse' => 'X-WSSE: UsernameToken Username="'.$username.'", PasswordDigest="'.$digest.'", Nonce="'.$nonce.'", Created="'.$created.'"', |
41 | ); | 40 | ); |
42 | 41 | ||
43 | $client->request('GET', '/api/entries', array(), array(), $headers); | 42 | $client->request('GET', '/api/entries', array(), array(), $headers); |