Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

assertStringStartsWith after assertNotEmpty fails #231

Open
@gisostallenberg

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /