-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Refactoring tests #6854
Refactoring tests #6854
Conversation
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.
Awesome, LGTM 👍
Since @guilhermeblanco is rebasing |
I've improved more tests, using:
|
9f5fd37
to
e7d61c2
Compare
@@ -174,7 +174,7 @@ problems using the following approach: | |||
// do stuff with the data in the row, $row[0] is always the object | |||
|
|||
// detach all entities from Doctrine, so that Garbage-Collection can kick in immediately | |||
$this->em->clear(); | |||
$this->_em->clear(); |
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 change is incorrect.
I’m trying to rebase, but I guess I lost my work 😭 |
I’m gonna try this, thanks for the tip |
Should we refactory |
Don't think so: `assertEmpty()` is too lax
…On 4 Dec 2017 08:43, "Gabriel Caruso" ***@***.***> wrote:
Should we refactory assertEquals('', $foo)/assertSame('', $foo) with
assertEmpty($foo), and assertEquals([], $bar)/assertSame([], $bar) with
assertEmpty($bar)?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#6854 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAJakBgfjEl4rbQy42VqCTI32lLcoHTpks5s86KNgaJpZM4QtVJ_>
.
|
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.
Develop has already been rebased so this can be merged now.
@carusogabriel Thanks! |
Any time @Majkl578 👨💻 |
Took a quick look at back porting this one and well, lets just say it's potentially going to be a big job. 94 out of 96 files have conflicts, a 95th is a deleted/modified conflict. One of the biggest things I've noticed is there are conflicts on a lot of lines where $this->assert* has been changed to self::assert* (technically, the correct way to call the asserts) however this wasn't done in this PR. My guess is that we're missing a PR somewhere that did all the changes from $this-> to self:: and that finding and merging that one first might reduce the number of conflicts in this PR or at the very least make it possible to see what's going on in the diffs. It is of cause possible that that PR will also have a huge number of conflicts, so it might be prudent to redo the work to change $this-> to self:: as it can be automated by php cs fixer. Alternatively, if it's the project's choice to use $this-> to call the asserts php cs fixer could be run it in the opposite direction against the changes in this PR to make it closer to the current codebase before a merge is attempted. |
I think redoing the change would be best, because you would not catch all occurrences anyway. We use phpcs in this project, maybe we can find a rule to add to our coding standard? |
This is the rule class for php cs fixer https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/3.0/src/Fixer/PhpUnit/PhpUnitTestCaseStaticMethodCallsFixer.php but I can't find an equivalent in php codesniffer. We'd also need to decide which style to support (options being Assert::assertX, static::assertX, self::assertX and $this->assertX with the latter two being the usual choices) |
🤔 I wonder why it is a phpunit-specific rule. My personal preference would be to run it once and make a PR, and pick |
In case anyone else comes across this ticket as a TODO, I have started work on it; however there are still ~60 conflicted files to go through so it's going to take a while :) |
Simple version of #6853, just using
assertNull
,assertFileExists
,assertTrue
andassertFalse
. Also, indevelop
branch.