stevegrunwell / phpunit-markup-assertions

Assertions for PHPUnit to verify the presence or state of elements within markup

Home Page:https://stevegrunwell.com/blog/phpunit-markup-assertions/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Assertion: assertSelectorCount()

stevegrunwell opened this issue · comments

Assert the number of elements that match the given selector.

Example:

public function testPostList()
{
  factory(Post::class, 10)->create();

  $response = $this->get('/posts');

  $this->assertSelectorCount(10, 'li.post-item', $response->getBody());
}