At the end of the last lesson, we had a working test suite, with tests ensuring the correct response codes were returned from Drupal's front and administration pages.
So, how do we move on from here?
## Testing as an authenticated user
In the current tests, we're testing the responses as an anonymous user.
So, how do we test as an authenticated user?
For example, how do we test the administration pages to see if they work for a user who's logged in?
This is the same test as before, only with a different expected status code. This time, we want a `200` status code, but as we're still anonymous, this test will fail.
### Creating a user
Before we move on, an important thing to note is that these tests don't test against the data in your database.
A fresh installation from a `testing` profile is done for each test method, meaning each test is run against an empty Drupal site. This is why you didn't need to install Drupal in the first lesson and why it only needed to be running.
So, if you have existing users in your database, they won't be there to use.
This prevents contamination between tests, but you need to create the required data and environment for each test.
This is commonly known as the **Arrange** step of the test.
To create a user, use `$this->drupalCreateUser()` and `$this->drupalLogin()` to log in as that user.
Now, we're no longer anonymous, though this test will still fail. Not all authenticated users can access the administration area.
To do this, a user needs two specific permissions - `access administration pages` and `administer site configuration`.
As we're testing against a temporary Drupal installation, we don't have access to any custom roles, so **we must add the permissions directly to the user instead of to a user role**.
To do this, when creating the user, include an array of permissions to add to it:
If we need any additional modules, we can add those too.
## Debugging
Here's a tip for today: if you're getting an unexpected status code or another error that you want to debug, you'll need to output the page content to see the error.
To do that, add this to your test, and it will output the page content: