Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 1070870

Browse files
updated tests to inject pageobject, minor fixes
1 parent 1f7c01e commit 1070870

File tree

4 files changed

+17
-25
lines changed

4 files changed

+17
-25
lines changed

‎tests/_bootstrap.php‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
<?php
2-
// This is global bootstrap for autoloading
2+
// This should be added to Laravel5 module itself
3+
ini_set('xdebug.max_nesting_level', 500);

‎tests/_support/Page/Functional/PostsPage.php‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,6 @@ public function __construct(FunctionalTester $I)
2525
$this->tester = $I;
2626
}
2727

28-
/**
29-
* @return PostsPage
30-
*/
31-
public static function of(FunctionalTester $I)
32-
{
33-
return new static($I);
34-
}
35-
3628
public function createPost($fields = [])
3729
{
3830
$I = $this->tester;

‎tests/functional/AuthCest.php‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,11 @@
55

66
class AuthCest
77
{
8-
98
private $userAttributes;
109

11-
public function __construct()
10+
public function _before()
1211
{
13-
$this->userAttributes= [
12+
$this->userAttributes= [
1413
'email' => 'john@doe.com',
1514
'password' => Hash::make('password'),
1615
'created_at' => new DateTime(),

‎tests/functional/PostCrudCest.php‎

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,39 +18,39 @@ public function __construct()
1818
}
1919

2020
// tests
21-
public function createPost(FunctionalTester $I)
21+
public function createPost(FunctionalTester $I, PostsPage$postsPage)
2222
{
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);
2525
$I->see('Hello world', '.table');
2626
}
2727

28-
public function createPostValidationFails(FunctionalTester $I)
28+
public function createPostValidationFails(FunctionalTester $I, PostsPage$postsPage)
2929
{
30-
PostsPage::of($I)->createPost();
31-
$I->seeCurrentUrlEquals(PostsPage::route('/create'));
30+
$postsPage->createPost();
31+
$I->seeCurrentUrlEquals($postsPage->route('/create'));
3232
$I->see('The body field is required.', '.error');
3333
$I->see('The title field is required.', '.error');
3434
}
3535

36-
public function editPost(FunctionalTester $I)
36+
public function editPost(FunctionalTester $I, PostsPage$postsPage)
3737
{
3838
$randTitle = "Edited at " . microtime();
3939
$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"));
4242
$I->see('Show Post', 'h1');
4343
$I->see($randTitle);
4444
$I->dontSee('Hello Universe');
4545
}
4646

47-
public function deletePost(FunctionalTester $I)
47+
public function deletePost(FunctionalTester $I, PostsPage$postsPage)
4848
{
4949
$id = $I->haveRecord('posts', $this->postAttributes);
50-
$I->amOnPage(PostsPage::$url);
50+
$I->amOnPage($postsPage::$url);
5151
$I->see('Hello Universe');
52-
PostsPage::of($I)->deletePost($id);
53-
$I->seeCurrentUrlEquals(PostsPage::$url);
52+
$postsPage->deletePost($id);
53+
$I->seeCurrentUrlEquals($postsPage::$url);
5454
$I->dontSee('Hello Universe');
5555
}
5656
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /