Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[10.x] Add assertViewEmpty to TestView #49558

Merged
merged 2 commits into from
Jan 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/Illuminate/Testing/TestView.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,16 @@ public function assertViewMissing($key)
return $this;
}

/**
* Assert that the view's rendered content is empty.
*/
public function assertViewEmpty()
{
PHPUnit::assertEmpty($this->rendered);

return true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this return $this not return true?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So you can chain it i mean?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah - my bad. I actually fixed this in a second commit but clearly forgot to push it to the branch. I've made a PR to fix the return value.

}

/**
* Assert that the given string is contained within the view.
*
Expand Down