Skip to content

Use non-static PHPUnit assert methods #20405

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

Merged
merged 1 commit into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions components/clock.rst
Original file line number Diff line number Diff line change
Expand Up @@ -143,18 +143,18 @@ is expired or not, by modifying the clock's time::
$validUntil = new DateTimeImmutable('2022-11-16 15:25:00');

// $validUntil is in the future, so it is not expired
static::assertFalse($expirationChecker->isExpired($validUntil));
$this->assertFalse($expirationChecker->isExpired($validUntil));

// Clock sleeps for 10 minutes, so now is '2022-11-16 15:30:00'
$clock->sleep(600); // Instantly changes time as if we waited for 10 minutes (600 seconds)

// modify the clock, accepts all formats supported by DateTimeImmutable::modify()
static::assertTrue($expirationChecker->isExpired($validUntil));
$this->assertTrue($expirationChecker->isExpired($validUntil));

$clock->modify('2022-11-16 15:00:00');

// $validUntil is in the future again, so it is no longer expired
static::assertFalse($expirationChecker->isExpired($validUntil));
$this->assertFalse($expirationChecker->isExpired($validUntil));
}
}

Expand Down
12 changes: 6 additions & 6 deletions http_client.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2225,15 +2225,15 @@ test it in a real application::
$responseData = $service->createArticle($requestData);

// Assert
self::assertSame('POST', $mockResponse->getRequestMethod());
self::assertSame('https://example.com/api/article', $mockResponse->getRequestUrl());
self::assertContains(
$this->assertSame('POST', $mockResponse->getRequestMethod());
$this->assertSame('https://example.com/api/article', $mockResponse->getRequestUrl());
$this->assertContains(
'Content-Type: application/json',
$mockResponse->getRequestOptions()['headers']
);
self::assertSame($expectedRequestData, $mockResponse->getRequestOptions()['body']);
$this->assertSame($expectedRequestData, $mockResponse->getRequestOptions()['body']);

self::assertSame($responseData, $expectedResponseData);
$this->assertSame($responseData, $expectedResponseData);
}
}

Expand Down Expand Up @@ -2266,7 +2266,7 @@ test. Then, save that information as a ``.har`` file somewhere in your applicati
$responseData = $service->createArticle($requestData);

// Assert
self::assertSame($responseData, 'the expected response');
$this->assertSame($responseData, 'the expected response');
}
}

Expand Down
Loading