@@ -18,39 +18,39 @@ public function __construct()
18
18
}
19
19
20
20
// tests
21
- public function createPost (FunctionalTester $ I )
21
+ public function createPost (FunctionalTester $ I, PostsPage $ postsPage )
22
22
{
23
- PostsPage:: of ( $ I ) ->createPost (['title ' => 'Hello world ' , 'body ' => 'And greetings for all ' ]);
24
- $ I ->seeCurrentUrlEquals (PostsPage ::$ url );
23
+ $ postsPage ->createPost (['title ' => 'Hello world ' , 'body ' => 'And greetings for all ' ]);
24
+ $ I ->seeCurrentUrlEquals ($ postsPage ::$ url );
25
25
$ I ->see ('Hello world ' , '.table ' );
26
26
}
27
27
28
- public function createPostValidationFails (FunctionalTester $ I )
28
+ public function createPostValidationFails (FunctionalTester $ I, PostsPage $ postsPage )
29
29
{
30
- PostsPage:: of ( $ I ) ->createPost ();
31
- $ I ->seeCurrentUrlEquals (PostsPage:: route ('/create ' ));
30
+ $ postsPage ->createPost ();
31
+ $ I ->seeCurrentUrlEquals ($ postsPage -> route ('/create ' ));
32
32
$ I ->see ('The body field is required. ' , '.error ' );
33
33
$ I ->see ('The title field is required. ' , '.error ' );
34
34
}
35
35
36
- public function editPost (FunctionalTester $ I )
36
+ public function editPost (FunctionalTester $ I, PostsPage $ postsPage )
37
37
{
38
38
$ randTitle = "Edited at " . microtime ();
39
39
$ id = $ I ->haveRecord ('posts ' , $ this ->postAttributes );
40
- PostsPage:: of ( $ I ) ->editPost ($ id , ['title ' => 'Edited at ' . $ randTitle ]);
41
- $ I ->seeCurrentUrlEquals (PostsPage:: route ("/ $ id " ));
40
+ $ postsPage ->editPost ($ id , ['title ' => 'Edited at ' . $ randTitle ]);
41
+ $ I ->seeCurrentUrlEquals ($ postsPage -> route ("/ $ id " ));
42
42
$ I ->see ('Show Post ' , 'h1 ' );
43
43
$ I ->see ($ randTitle );
44
44
$ I ->dontSee ('Hello Universe ' );
45
45
}
46
46
47
- public function deletePost (FunctionalTester $ I )
47
+ public function deletePost (FunctionalTester $ I, PostsPage $ postsPage )
48
48
{
49
49
$ id = $ I ->haveRecord ('posts ' , $ this ->postAttributes );
50
- $ I ->amOnPage (PostsPage ::$ url );
50
+ $ I ->amOnPage ($ postsPage ::$ url );
51
51
$ I ->see ('Hello Universe ' );
52
- PostsPage:: of ( $ I ) ->deletePost ($ id );
53
- $ I ->seeCurrentUrlEquals (PostsPage ::$ url );
52
+ $ postsPage ->deletePost ($ id );
53
+ $ I ->seeCurrentUrlEquals ($ postsPage ::$ url );
54
54
$ I ->dontSee ('Hello Universe ' );
55
55
}
56
56
}
0 commit comments