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

Use adventage of newer PHPUnit sytax #11422

Merged
merged 1 commit into from Nov 13, 2017
Merged

Conversation

keradus
Copy link
Contributor

@keradus keradus commented Nov 11, 2017

Brought to you by PHP CS Fixer

@keradus keradus force-pushed the fix_phpunit branch 2 times, most recently from 09b4762 to 2bc2a80 Compare November 11, 2017 15:55
@codecov-io
Copy link

codecov-io commented Nov 11, 2017

Codecov Report

Merging #11422 into master will increase coverage by 0.01%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #11422      +/-   ##
============================================
+ Coverage     93.11%   93.12%   +0.01%     
  Complexity    13008    13008              
============================================
  Files           436      436              
  Lines         33697    33697              
============================================
+ Hits          31377    31382       +5     
+ Misses         2320     2315       -5
Impacted Files Coverage Δ Complexity Δ
src/Cache/Engine/FileEngine.php 90.16% <0%> (+1.09%) 73% <0%> (ø) ⬇️
src/Cache/CacheRegistry.php 100% <0%> (+4%) 11% <0%> (ø) ⬇️
src/Cache/CacheEngine.php 93.61% <0%> (+4.25%) 19% <0%> (ø) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9303632...c936250. Read the comment docs.

@markstory markstory added this to the 3.5.6 milestone Nov 12, 2017
* @return void
*/
public function testAuthenticateFailReChallenge()
{
$this->expectException(\Cake\Network\Exception\UnauthorizedException::class);
$this->expectExceptionCode(401);
Copy link
Member

Choose a reason for hiding this comment

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

Why is this notation an improvement? The annotation style is not deprecated and this type of change has the opportunity to create merge conflicts with the 3.next branch.

Copy link
Contributor Author

@keradus keradus Nov 12, 2017

Choose a reason for hiding this comment

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

it is best practice and suggested way of expecting expectations since almost 2 years:
https://thephp.cc/news/2016/02/questioning-phpunit-best-practices
(TLDR: code over annotation for better detection&refactoring, method call could be put directly before code that is expected to raise exception, not to whole codeblock, so better control of what is raising the exception)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

while merging into 3.next, you could keep 3.next version of code on each conflict and we could re-apply auto-changes in separated PR for 3.next. that's easy ;)

Copy link
Member

Choose a reason for hiding this comment

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

method call could be put directly before code that is expected to raise exception

Thats when I would start putting it in code, and that needs to be done manually.

Copy link
Contributor Author

@keradus keradus Nov 12, 2017

Choose a reason for hiding this comment

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

that part of the benefit need to be achieved manually, yes. yet, keep in mind that a lot of test methods are already single-liners, so it's already achieved for them.
also, having real class usage in code instead of text (annotation) is still benefit.

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe this could be done in/for the 3.next branch instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I sent this PR to default branch, if I shall change target branch, let me know ;)

Copy link
Member

Choose a reason for hiding this comment

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

I will get this merged into master/3.next over the next few days. Any conflicts will be a one time cost.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i'm not fully get it. it's already targeting master. shall I change PR target branch to sth ? (then I could solve the conflicts saving your time!)

Copy link
Member

Choose a reason for hiding this comment

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

What you have now is fine. I can take care of any conflicts that come up when I merge master -> 3.next.

@@ -418,7 +418,7 @@ public function testPathDoesNotExist()
]);

Cache::read('Test', 'file_test');
$this->assertTrue(file_exists($dir), 'Dir should exist.');
$this->assertFileExists($dir, 'Dir should exist.');
Copy link
Member

Choose a reason for hiding this comment

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

I would extract these changes as separate PR as they are without discussion.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

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

Successfully merging this pull request may close these issues.

None yet

5 participants