@@ -43,7 +43,8 @@ public function testAccessDeniedForRegularUsers(string $httpMethod, string $url)
43
43
]);
44
44
45
45
$ client ->request ($ httpMethod , $ url );
46
- $ this ->assertSame (Response::HTTP_FORBIDDEN , $ client ->getResponse ()->getStatusCode ());
46
+
47
+ $ this ->assertResponseStatusCodeSame (Response::HTTP_FORBIDDEN );
47
48
}
48
49
49
50
public function getUrlsForRegularUsers ()
@@ -62,11 +63,10 @@ public function testAdminBackendHomePage()
62
63
]);
63
64
64
65
$ crawler = $ client ->request ('GET ' , '/en/admin/post/ ' );
65
- $ this ->assertSame (Response::HTTP_OK , $ client ->getResponse ()->getStatusCode ());
66
66
67
- $ this ->assertGreaterThanOrEqual (
68
- 1 ,
69
- $ crawler -> filter ( 'body#admin_post_index #main tbody tr ' )-> count () ,
67
+ $ this ->assertResponseIsSuccessful ();
68
+ $ this -> assertSelectorExists (
69
+ 'body#admin_post_index #main tbody tr ' ,
70
70
'The backend homepage displays all the available posts. '
71
71
);
72
72
}
@@ -95,7 +95,7 @@ public function testAdminNewPost()
95
95
]);
96
96
$ client ->submit ($ form );
97
97
98
- $ this ->assertSame ( Response::HTTP_FOUND , $ client -> getResponse ()-> getStatusCode () );
98
+ $ this ->assertResponseRedirects ( ' /en/admin/post/ ' , Response::HTTP_FOUND );
99
99
100
100
$ post = $ client ->getContainer ()->get ('doctrine ' )->getRepository (Post::class)->findOneBy ([
101
101
'title ' => $ postTitle ,
@@ -113,7 +113,7 @@ public function testAdminShowPost()
113
113
]);
114
114
$ client ->request ('GET ' , '/en/admin/post/1 ' );
115
115
116
- $ this ->assertSame (Response:: HTTP_OK , $ client -> getResponse ()-> getStatusCode () );
116
+ $ this ->assertResponseIsSuccessful ( );
117
117
}
118
118
119
119
/**
@@ -136,7 +136,7 @@ public function testAdminEditPost()
136
136
]);
137
137
$ client ->submit ($ form );
138
138
139
- $ this ->assertSame ( Response::HTTP_FOUND , $ client -> getResponse ()-> getStatusCode () );
139
+ $ this ->assertResponseRedirects ( ' /en/admin/post/1/edit ' , Response::HTTP_FOUND );
140
140
141
141
/** @var Post $post */
142
142
$ post = $ client ->getContainer ()->get ('doctrine ' )->getRepository (Post::class)->find (1 );
@@ -158,7 +158,7 @@ public function testAdminDeletePost()
158
158
$ crawler = $ client ->request ('GET ' , '/en/admin/post/1 ' );
159
159
$ client ->submit ($ crawler ->filter ('#delete-form ' )->form ());
160
160
161
- $ this ->assertSame ( Response::HTTP_FOUND , $ client -> getResponse ()-> getStatusCode () );
161
+ $ this ->assertResponseRedirects ( ' /en/admin/post/ ' , Response::HTTP_FOUND );
162
162
163
163
$ post = $ client ->getContainer ()->get ('doctrine ' )->getRepository (Post::class)->find (1 );
164
164
$ this ->assertNull ($ post );
0 commit comments