Skip to content

[DX][Internal] Init ApiTestCase#972

Open
loic425 wants to merge 1 commit intoSylius:1.13from
loic425:api-test-case
Open

[DX][Internal] Init ApiTestCase#972
loic425 wants to merge 1 commit intoSylius:1.13from
loic425:api-test-case

Conversation

@loic425
Copy link
Copy Markdown
Member

@loic425 loic425 commented Jan 15, 2025

Q A
Bug fix? no
New feature? no
BC breaks? no
Deprecations? no
Related tickets
License MIT

@loic425 loic425 marked this pull request as draft January 15, 2025 17:10
@loic425 loic425 force-pushed the api-test-case branch 7 times, most recently from 59212f9 to 19bf967 Compare January 16, 2025 10:59
@loic425 loic425 changed the title Init ApiTestCase [DX][Internal] Init ApiTestCase Jan 16, 2025
@loic425 loic425 added the DX Issues and PRs aimed at improving Developer eXperience. label Jan 16, 2025
@loic425 loic425 force-pushed the api-test-case branch 4 times, most recently from 7500a98 to 0c6d68d Compare January 22, 2025 08:02
@loic425 loic425 marked this pull request as ready for review January 22, 2025 08:04
@loic425 loic425 added the Maintenance Configurations, READMEs, releases, etc. label Jan 22, 2025
protected Matcher $matcher;

#[Before]
protected function _createClient(): void
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does _ function prefix passes CS checks?

Copy link
Copy Markdown
Member Author

@loic425 loic425 Jan 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's a common way in this kind of trait.
https://github.com/zenstruck/foundry/blob/2.x/src/Test/ResetDatabase.php#L29

We are in the test application. For now I do not plan to make a small lib with that kind of traits.

I'd like to remove my PurgeDatabaseTrait to be honest. I have some issues with ResetDatabase (from Foundry package) sometimes, but I plan to remove this PurgeDatabaseTrait at some point.

@loic425 loic425 force-pushed the api-test-case branch 2 times, most recently from 9056331 to 818060b Compare January 22, 2025 15:02
}

#[Before]
protected static function _createMatcher(): Matcher
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this change possible, the same as with createClient/setupClient change.

Suggested change
protected static function _createMatcher(): Matcher
protected static function createMatcher(): Matcher
protected static function setupMatcher(): Matcher

$this->assertResponseCode($response, Response::HTTP_NO_CONTENT);

$this->assertResponseIsSuccessful();
$this->assertResponseStatusCodeSame(Response::HTTP_NO_CONTENT);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test doesn't appear to be checking if PUT action actually changed comic book data.

$this->assertResponseCode($response, Response::HTTP_NO_CONTENT);

$this->assertResponseIsSuccessful();
$this->assertResponseStatusCodeSame(Response::HTTP_NO_CONTENT);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's still actual.

        $deletedComicBook = $this->getContainer()->get('app.repository.comic_book')->find($comicBookId);
        $this->assertNull($deletedComicBook);

$this->assertResponseCode($response, Response::HTTP_NO_CONTENT);

$this->assertResponseIsSuccessful();
$this->assertResponseStatusCodeSame(Response::HTTP_NO_CONTENT);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test doesn't appear to be checking if PUT action actually happened.

{
return $this->matcherFactory->createMatcher(new VoidBacktrace());
$this->assertResponseIsSuccessful();
$this->assertResponseStatusCodeSame(Response::HTTP_NO_CONTENT);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test doesn't appear to be checking if subscription was actually removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DX Issues and PRs aimed at improving Developer eXperience. Maintenance Configurations, READMEs, releases, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants