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

Document new Symfony assertions #202

Open
ThomasLandauer opened this issue Nov 14, 2024 · 1 comment
Open

Document new Symfony assertions #202

ThomasLandauer opened this issue Nov 14, 2024 · 1 comment

Comments

@ThomasLandauer
Copy link
Member

The new assertions introduced in https://github.com/Codeception/module-symfony/releases/tag/3.5.0 should be added to the docs.
Did you copy them one by one, or did you find a way to call them directly (i.e. future Symfony assertions will automatically work too)?
Are these the ones we're talking about? https://symfony.com/doc/current/testing.html#testing-the-response-assertions

@TavoNiievez
Copy link
Member

TavoNiievez commented Nov 14, 2024

Hi @ThomasLandauer , the vast majority of the added assertions call directly to Constraints defined in Symfony. For example:

public function assertBrowserCookieValueSame(string $name, string $expectedValue, bool $raw = false, string $path = '/', ?string $domain = null, string $message = ''): void
{
$this->assertThatForClient(new BrowserHasCookie($name, $path, $domain), $message);

while there are others that were translated to integrate with the module's service container. For example,

public function assertHttpClientRequest(string $expectedUrl, string $expectedMethod = 'GET', string|array|null $expectedBody = null, array $expectedHeaders = [], string $httpClientId = 'http_client'): void
{
$httpClientCollector = $this->grabHttpClientCollector(__FUNCTION__);

While, I added comment blocks for each assertion, the code examples are pending for someone to send a PR and add them.

I have updated the https://github.com/codeception/symfony-module-tests test project in all its branches to add tests to verify that these assertions work well. so the work around having that guidance available should be simple.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants