-
-
Notifications
You must be signed in to change notification settings - Fork 154
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
[DX][Internal] Init ApiTestCase #972
base: 1.13
Are you sure you want to change the base?
Conversation
loic425
commented
Jan 15, 2025
Q | A |
---|---|
Bug fix? | no |
New feature? | no |
BC breaks? | no |
Deprecations? | no |
Related tickets | |
License | MIT |
59212f9
to
19bf967
Compare
7500a98
to
0c6d68d
Compare
0c6d68d
to
984eb9a
Compare
tests/ApiTestCase.php
Outdated
protected Matcher $matcher; | ||
|
||
#[Before] | ||
protected function _createClient(): void |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
tests/Application/src/Tests/Controller/SubscriptionJsonApiTest.php
Outdated
Show resolved
Hide resolved
9056331
to
818060b
Compare
818060b
to
bc900f2
Compare
} | ||
|
||
#[Before] | ||
protected static function _createMatcher(): Matcher |
There was a problem hiding this comment.
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.
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); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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.