PHPUnit assert that string has length

Viewed 19

Is there a method to assert that a string has a specific length in a PHPUnit TestCase or do I have to test it manually using strlen? assertCount does not work because it expects a iterable.

// This is how I currently do it
$this->assertEquals(10, strlen($str));

// This is how id like to do it
$this->assertLength(10, $str);
0 Answers
Related