Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

miguellima's avatar

How to test pagination results?

Hello everyone,

I'm doing some tests.

And know I want to test pagination results of the users page does not contain users with role "admin". Only containing users with role "user".

For example:

  • I want to test page1
  • then page2
  • ...

Is there a any way to do this?

Thanks in advance

0 likes
3 replies
guybrush_threepwood's avatar
Level 33

Hi @miguellima

Wouldn't it be easier to configure a different database (in memory SQLite with the DatabaseMigrations trait or MySQL with the DatabaseTransactions trait) and just insert the records you expect to see?

You could insert just one "admin role" and one "user role" and then check that you can see the "user" but can't see the "admin" on the first page only.

Please or to participate in this conversation.