aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/Wallabag/ApiBundle/Controller/UserRestControllerTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Wallabag/ApiBundle/Controller/UserRestControllerTest.php')
-rw-r--r--tests/Wallabag/ApiBundle/Controller/UserRestControllerTest.php54
1 files changed, 27 insertions, 27 deletions
diff --git a/tests/Wallabag/ApiBundle/Controller/UserRestControllerTest.php b/tests/Wallabag/ApiBundle/Controller/UserRestControllerTest.php
index 4e65f130..51fac2bd 100644
--- a/tests/Wallabag/ApiBundle/Controller/UserRestControllerTest.php
+++ b/tests/Wallabag/ApiBundle/Controller/UserRestControllerTest.php
@@ -9,7 +9,7 @@ class UserRestControllerTest extends WallabagApiTestCase
9 public function testGetUser() 9 public function testGetUser()
10 { 10 {
11 $this->client->request('GET', '/api/user.json'); 11 $this->client->request('GET', '/api/user.json');
12 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 12 $this->assertSame(200, $this->client->getResponse()->getStatusCode());
13 13
14 $content = json_decode($this->client->getResponse()->getContent(), true); 14 $content = json_decode($this->client->getResponse()->getContent(), true);
15 15
@@ -20,27 +20,27 @@ class UserRestControllerTest extends WallabagApiTestCase
20 $this->assertArrayHasKey('created_at', $content); 20 $this->assertArrayHasKey('created_at', $content);
21 $this->assertArrayHasKey('updated_at', $content); 21 $this->assertArrayHasKey('updated_at', $content);
22 22
23 $this->assertEquals('bigboss@wallabag.org', $content['email']); 23 $this->assertSame('bigboss@wallabag.org', $content['email']);
24 $this->assertEquals('Big boss', $content['name']); 24 $this->assertSame('Big boss', $content['name']);
25 $this->assertEquals('admin', $content['username']); 25 $this->assertSame('admin', $content['username']);
26 26
27 $this->assertEquals('application/json', $this->client->getResponse()->headers->get('Content-Type')); 27 $this->assertSame('application/json', $this->client->getResponse()->headers->get('Content-Type'));
28 } 28 }
29 29
30 public function testGetUserWithoutAuthentication() 30 public function testGetUserWithoutAuthentication()
31 { 31 {
32 $client = static::createClient(); 32 $client = static::createClient();
33 $client->request('GET', '/api/user.json'); 33 $client->request('GET', '/api/user.json');
34 $this->assertEquals(401, $client->getResponse()->getStatusCode()); 34 $this->assertSame(401, $client->getResponse()->getStatusCode());
35 35
36 $content = json_decode($client->getResponse()->getContent(), true); 36 $content = json_decode($client->getResponse()->getContent(), true);
37 37
38 $this->assertArrayHasKey('error', $content); 38 $this->assertArrayHasKey('error', $content);
39 $this->assertArrayHasKey('error_description', $content); 39 $this->assertArrayHasKey('error_description', $content);
40 40
41 $this->assertEquals('access_denied', $content['error']); 41 $this->assertSame('access_denied', $content['error']);
42 42
43 $this->assertEquals('application/json', $client->getResponse()->headers->get('Content-Type')); 43 $this->assertSame('application/json', $client->getResponse()->headers->get('Content-Type'));
44 } 44 }
45 45
46 public function testCreateNewUser() 46 public function testCreateNewUser()
@@ -52,7 +52,7 @@ class UserRestControllerTest extends WallabagApiTestCase
52 'email' => 'wallabag@google.com', 52 'email' => 'wallabag@google.com',
53 ]); 53 ]);
54 54
55 $this->assertEquals(201, $this->client->getResponse()->getStatusCode()); 55 $this->assertSame(201, $this->client->getResponse()->getStatusCode());
56 56
57 $content = json_decode($this->client->getResponse()->getContent(), true); 57 $content = json_decode($this->client->getResponse()->getContent(), true);
58 58
@@ -63,15 +63,15 @@ class UserRestControllerTest extends WallabagApiTestCase
63 $this->assertArrayHasKey('updated_at', $content); 63 $this->assertArrayHasKey('updated_at', $content);
64 $this->assertArrayHasKey('default_client', $content); 64 $this->assertArrayHasKey('default_client', $content);
65 65
66 $this->assertEquals('wallabag@google.com', $content['email']); 66 $this->assertSame('wallabag@google.com', $content['email']);
67 $this->assertEquals('google', $content['username']); 67 $this->assertSame('google', $content['username']);
68 68
69 $this->assertArrayHasKey('client_secret', $content['default_client']); 69 $this->assertArrayHasKey('client_secret', $content['default_client']);
70 $this->assertArrayHasKey('client_id', $content['default_client']); 70 $this->assertArrayHasKey('client_id', $content['default_client']);
71 71
72 $this->assertEquals('Default client', $content['default_client']['name']); 72 $this->assertSame('Default client', $content['default_client']['name']);
73 73
74 $this->assertEquals('application/json', $this->client->getResponse()->headers->get('Content-Type')); 74 $this->assertSame('application/json', $this->client->getResponse()->headers->get('Content-Type'));
75 75
76 $this->client->getContainer()->get('craue_config')->set('api_user_registration', 0); 76 $this->client->getContainer()->get('craue_config')->set('api_user_registration', 0);
77 } 77 }
@@ -88,7 +88,7 @@ class UserRestControllerTest extends WallabagApiTestCase
88 'client_name' => 'My client name !!', 88 'client_name' => 'My client name !!',
89 ]); 89 ]);
90 90
91 $this->assertEquals(201, $client->getResponse()->getStatusCode()); 91 $this->assertSame(201, $client->getResponse()->getStatusCode());
92 92
93 $content = json_decode($client->getResponse()->getContent(), true); 93 $content = json_decode($client->getResponse()->getContent(), true);
94 94
@@ -99,15 +99,15 @@ class UserRestControllerTest extends WallabagApiTestCase
99 $this->assertArrayHasKey('updated_at', $content); 99 $this->assertArrayHasKey('updated_at', $content);
100 $this->assertArrayHasKey('default_client', $content); 100 $this->assertArrayHasKey('default_client', $content);
101 101
102 $this->assertEquals('wallabag@google.com', $content['email']); 102 $this->assertSame('wallabag@google.com', $content['email']);
103 $this->assertEquals('google', $content['username']); 103 $this->assertSame('google', $content['username']);
104 104
105 $this->assertArrayHasKey('client_secret', $content['default_client']); 105 $this->assertArrayHasKey('client_secret', $content['default_client']);
106 $this->assertArrayHasKey('client_id', $content['default_client']); 106 $this->assertArrayHasKey('client_id', $content['default_client']);
107 107
108 $this->assertEquals('My client name !!', $content['default_client']['name']); 108 $this->assertSame('My client name !!', $content['default_client']['name']);
109 109
110 $this->assertEquals('application/json', $client->getResponse()->headers->get('Content-Type')); 110 $this->assertSame('application/json', $client->getResponse()->headers->get('Content-Type'));
111 111
112 $client->getContainer()->get('craue_config')->set('api_user_registration', 0); 112 $client->getContainer()->get('craue_config')->set('api_user_registration', 0);
113 } 113 }
@@ -122,7 +122,7 @@ class UserRestControllerTest extends WallabagApiTestCase
122 'email' => 'bigboss@wallabag.org', 122 'email' => 'bigboss@wallabag.org',
123 ]); 123 ]);
124 124
125 $this->assertEquals(400, $client->getResponse()->getStatusCode()); 125 $this->assertSame(400, $client->getResponse()->getStatusCode());
126 126
127 $content = json_decode($client->getResponse()->getContent(), true); 127 $content = json_decode($client->getResponse()->getContent(), true);
128 128
@@ -133,10 +133,10 @@ class UserRestControllerTest extends WallabagApiTestCase
133 // $this->assertEquals('fos_user.username.already_used', $content['error']['username'][0]); 133 // $this->assertEquals('fos_user.username.already_used', $content['error']['username'][0]);
134 // $this->assertEquals('fos_user.email.already_used', $content['error']['email'][0]); 134 // $this->assertEquals('fos_user.email.already_used', $content['error']['email'][0]);
135 // This shouldn't be translated ... 135 // This shouldn't be translated ...
136 $this->assertEquals('This value is already used.', $content['error']['username'][0]); 136 $this->assertSame('This value is already used.', $content['error']['username'][0]);
137 $this->assertEquals('This value is already used.', $content['error']['email'][0]); 137 $this->assertSame('This value is already used.', $content['error']['email'][0]);
138 138
139 $this->assertEquals('application/json', $client->getResponse()->headers->get('Content-Type')); 139 $this->assertSame('application/json', $client->getResponse()->headers->get('Content-Type'));
140 140
141 $client->getContainer()->get('craue_config')->set('api_user_registration', 0); 141 $client->getContainer()->get('craue_config')->set('api_user_registration', 0);
142 } 142 }
@@ -151,16 +151,16 @@ class UserRestControllerTest extends WallabagApiTestCase
151 'email' => 'facebook@wallabag.org', 151 'email' => 'facebook@wallabag.org',
152 ]); 152 ]);
153 153
154 $this->assertEquals(400, $client->getResponse()->getStatusCode()); 154 $this->assertSame(400, $client->getResponse()->getStatusCode());
155 155
156 $content = json_decode($client->getResponse()->getContent(), true); 156 $content = json_decode($client->getResponse()->getContent(), true);
157 157
158 $this->assertArrayHasKey('error', $content); 158 $this->assertArrayHasKey('error', $content);
159 $this->assertArrayHasKey('password', $content['error']); 159 $this->assertArrayHasKey('password', $content['error']);
160 160
161 $this->assertEquals('validator.password_too_short', $content['error']['password'][0]); 161 $this->assertSame('validator.password_too_short', $content['error']['password'][0]);
162 162
163 $this->assertEquals('application/json', $client->getResponse()->headers->get('Content-Type')); 163 $this->assertSame('application/json', $client->getResponse()->headers->get('Content-Type'));
164 164
165 $client->getContainer()->get('craue_config')->set('api_user_registration', 0); 165 $client->getContainer()->get('craue_config')->set('api_user_registration', 0);
166 } 166 }
@@ -174,12 +174,12 @@ class UserRestControllerTest extends WallabagApiTestCase
174 'email' => 'facebook@wallabag.org', 174 'email' => 'facebook@wallabag.org',
175 ]); 175 ]);
176 176
177 $this->assertEquals(403, $client->getResponse()->getStatusCode()); 177 $this->assertSame(403, $client->getResponse()->getStatusCode());
178 178
179 $content = json_decode($client->getResponse()->getContent(), true); 179 $content = json_decode($client->getResponse()->getContent(), true);
180 180
181 $this->assertArrayHasKey('error', $content); 181 $this->assertArrayHasKey('error', $content);
182 182
183 $this->assertEquals('application/json', $client->getResponse()->headers->get('Content-Type')); 183 $this->assertSame('application/json', $client->getResponse()->headers->get('Content-Type'));
184 } 184 }
185} 185}