Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Probably an incorrect test case testAuthorityIsPrefixedByDoubleSlashIfPresent in UriTest.php #1

Closed
weierophinney opened this issue Dec 31, 2019 · 1 comment
Labels
Invalid This doesn't seem right

Comments

@weierophinney
Copy link
Member

Two tests are looking identical despite description. Probably withHost in second case should be replaced by something else.

    public function testUriDoesNotAppendColonToHostIfPortIsEmpty()
    {
        $uri = (new Uri())->withHost('google.com');
        $this->assertSame('//google.com', (string) $uri);
    }
    public function testAuthorityIsPrefixedByDoubleSlashIfPresent()
    {
        $uri = (new Uri())->withHost('example.com');
        $this->assertSame('//example.com', (string) $uri);
    }

Originally posted by @Keksov at zendframework/zend-diactoros#381

@Xerkus
Copy link
Member

Xerkus commented May 2, 2023

Tests body looks similar but they are not the same.

If either of expectations breaks both tests will fail but test names describe the expectation which in turn allows to properly interpret failure and to refactor test with same expectation but different code if needed.

@Xerkus Xerkus closed this as not planned Won't fix, can't repro, duplicate, stale May 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

2 participants