Cache validation result.

Rebased version of #303/#290
I don't think you need to store `$invalid` and `$valid` from `$user->is_valid()` as its overkill and confusing. I think you should set `$valid = $user->is_valid()` and then do the following assertions:

```php
$this->assert_true($valid);
$this->assert_equals($valid, $user->is_invalid());
```