Open
Description
assertStringStartsWith after assertNotEmpty fails with error "Parameter #1 $prefix of method PHPUnit\Framework\Assert::assertStringStartsWith() expects non-empty-string', while the string cannot be empty due to the assertNotEmpty
call.
<?php
use PHPUnit\Framework\TestCase;
class FooTest extends TestCase {
public function testFoo(): void
{
$string = ([
'',
'bar',
])[rand(0, 1)];
$this->assertNotEmpty($string);
$this->assertStringStartsWith($string, 'baz');
}
}
Metadata
Metadata
Assignees
Labels
No labels