I want to assert that a variable is a (non-blank) string in phpunit, but I don't want to assert that the string has to match any exact string.
For example, I want to pull a username, and ensure that I successfully got some non-blank username, but I don't care exactly which username I got.
I can pretty easily assert that it's a non-empty variable, or that it is a string exactly matching some string, or assert that the var is a string without phpunit's help:
Failed asserting that false is true.
You can add your own messages to all PHPUnit assertions, something like this should work for you:-
$this->assertTrue(is_string($username), "Got a " . gettype($username) . " instead of a string");
Otherwise, you could use
$this->assertInternalType('string', $username, "Got a " . gettype($username) . " instead of a string");