diff options
-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); |