-
Notifications
You must be signed in to change notification settings - Fork 106
function addCustomControlMappings() #114
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #114 +/- ##
============================================
+ Coverage 96.86% 96.86% +<.01%
- Complexity 338 340 +2
============================================
Files 23 23
Lines 1051 1054 +3
============================================
+ Hits 1018 1021 +3
Misses 33 33
Continue to review full report at Codecov.
|
I finally worked out this whole phpunit thing. I'm just not undertanding why the last test fails. |
test/CliMenuTest.php
Outdated
$first = true; | ||
$this->terminal->expects($this->any()) | ||
->method('read') | ||
->will( |
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.
Here you can just use ->willReturn('c', 'x')
. c
will be returned on the first call to read
and x
on the next :)
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.
No ! You've got to be kidding me. What will it return on subsequent calls ? 'x' ?
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 just returns null after anything you don't specify.
$this->expectExceptionMessage('Cannot rebind this input'); | ||
|
||
$menu = new CliMenu('PHP School FTW', []); | ||
$menu->addCustomControlMappings([ |
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.
It took me a little while to figure this - you actually only send one element to the method, the second c
key overwrites the first ! So it's actually not possible to call this method once and cause a rebind exception, you'd have to call it twice.
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.
Hahaha, of course ! Thank you !
Just to allow doing
instead of