-
-
Notifications
You must be signed in to change notification settings - Fork 384
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
Align project settings with the other repositories #537
Conversation
4a886b9
to
1fa9490
Compare
* @param InputInterface $input | ||
* @param OutputInterface $output | ||
* @return mixed | ||
*/ | ||
protected function askConfirmation($question, InputInterface $input, OutputInterface $output) | ||
protected function askConfirmation(string $question, InputInterface $input, OutputInterface $output) |
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.
Technically, this is a BC break - people might have overridden this method to add their own logic.
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.
Indeed, will remove the type declaration.
ef96412
to
10963f8
Compare
->write($sql, $direction); | ||
} | ||
|
||
protected function createSqlFileWriter(string $path): SqlFileWriter |
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.
private
plz
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 can't... and it really hurts me.
We were using mockery a big nasty black magic to overload the instantiation of that class. I didn't wan't to do a huge design change to make it work properly with only PHPUnit mocks.
Suggestion?
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.
Got a link to the test? :-\
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.
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.
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.
And allow us to remove this: https://github.com/doctrine/migrations/pull/537/files#diff-5a519f363afe6bb6f788510621f527f0L53
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.
@lcobucci urgh. I am really reluctant to introduce a new protected
method that will be abused till eternity :S
A huge test change would be more acceptable than this, IMO...
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.
Ok, I'll go down the rabbit hole on this one. However it would probably not be only a test change.
->write($sqlQueries, $direction); | ||
} | ||
|
||
protected function createSqlFileWriter(string $path): SqlFileWriter |
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.
Unless designed for inheritance, private
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.
Same reason as #537 (comment)
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.
Thanks for the PR.
Great update.
composer.json
Outdated
"doctrine/coding-standard": "dev-master", | ||
"mockery/mockery": "^0.9.4", | ||
"johnkary/phpunit-speedtrap": "~1.0@dev", |
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.
@lcobucci Why are you removing speedtrap ?
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.
Because the stable version doesn't support PHPUnit 6. Also I don't see much value on it right now, the only reason we had slow tests on the suite was the fact we were using mockery overload instance feature and that require tests to run in isolated processes, which has been removed.
I can add it back though 😄
if (!$this->getHelperSet()->has('question')) { | ||
return $this->getHelper('dialog')->askConfirmation($output, '<question>' . $question . '</question>', false); | ||
} | ||
|
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.
There are tests that are tied to this BC feature that you can remove too.
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.
Our coverage report said we weren't covering this flow, can you point out the test to me?
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.
migrations/tests/Doctrine/DBAL/Migrations/Tests/Tools/Console/Command/AbstractCommandTest.php
Lines 309 to 336 in b82d683
public function testAskConfirmation() | |
{ | |
$input = $this->getMockBuilder(ArrayInput::class) | |
->setConstructorArgs([[]]) | |
->setMethods(['getOption']) | |
->getMock(); | |
/** | |
* This test is testing a deprecated method. | |
* PHPunit convert those deprecations errors into tests failures. | |
* You can either use \PHPUnit_Framework_Error_Deprecated::$enabled = false; | |
* or use the @ operator to suppress the error. | |
* The advantage of the later is that it also remove the error message from the phpunit output. | |
*/ | |
if (class_exists("Symfony\\Component\\Console\\Helper\\DialogHelper")) | |
{ | |
@$helper = new DialogHelper(); | |
@$this->assertTrue($this->invokeAbstractCommandConfirmation($input, $helper)); | |
@$this->assertFalse($this->invokeAbstractCommandConfirmation($input, $helper, "n")); | |
} | |
if (class_exists("Symfony\\Component\\Console\\Helper\\QuestionHelper")) { | |
$helper = new QuestionHelper(); | |
$this->assertTrue($this->invokeAbstractCommandConfirmation($input, $helper)); | |
$this->assertFalse($this->invokeAbstractCommandConfirmation($input, $helper, "n")); | |
} | |
} |
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.
Done 😉
.travis.yml
Outdated
@@ -42,5 +42,4 @@ before_install: | |||
- if [[ ! $GITHUB_TOKEN ]]; then echo "no github token"; fi | |||
|
|||
after_script: | |||
- if [[ $TRAVIS_PHP_VERSION = '5.6' ]]; then php vendor/bin/coveralls -v ; fi |
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 am still using it. Is it a problem to keep it ?
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's not a big problem to keep it, I just saw on https://coveralls.io/github/doctrine/migrations that the last build was March 2015 so I assumed it was useless here as well
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.
Are you sure we're using for doctrine/migrations? Do you want me to put it back?
- 7.1 | ||
- nigthly |
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 would like to keep nightly in there with allowed failures.
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.
For some weird reason Travis was failing to run php nightly (version simply wasn't available) and the pipeline didn't work even though that one as allowed to fail. I will check it again.
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.
That error seems unrelated, looks like you force-pushed the branch before Travis was able to grab the commit. :P
the pipeline didn't work even though that one as allowed to fail
Maybe there's a difference betwen errored
and failed
state.
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 added it back, but I had a different error before. Let's see if it happens again.
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.
Now it works... I'm probably getting crazier 😜
fast_finish: true | ||
include: | ||
- php: 5.6 | ||
env: deps=low |
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.
We also need to keep a 7.1 run with deps low in the matrix.
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.
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.
ok
10963f8
to
d036a11
Compare
d036a11
to
96c507f
Compare
@Ocramius @mikeSimonson I think this is good to go, please take a look 😉 |
charset="UTF-8" yui="true" highlight="true" lowUpperBound="5" | ||
highLowerBound="70" /> | ||
<log type="coverage-clover" target="build/logs/clover.xml"/> | ||
</logging> |
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.
Is there any reason to remove those two configurations ?
They are quite handy to work locally.
The rest of the PR is GTG for me.
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.
@mikeSimonson you can always create your customized phpunit.xml
locally: it overrides the .dist
file and allows you to have custom settings.
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.
Exactly 😁
} | ||
|
||
/** | ||
* TODO: move SqlFileWriter's behaviour to this class - and kill it with fire (on the next major release) |
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.
TODO? :-P
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.
Can you spawn an issue for this TODO?
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 was just waiting to get it merged to open the issueS 😜
$result = $writer->write($queriesByVersion, $direction); | ||
|
||
// SqlFileWriter#write() returns `bool|int` but all clients expect it to be `bool` only | ||
return $result !== false && $result > 0; |
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.
Isn't a (bool)
cast sufficient?
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 is, silly me...
*/ | ||
public function write(string $path, string $direction, array $queriesByVersion) : bool | ||
{ | ||
$writer = new SqlFileWriter( |
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.
What about the injected writer?
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 don't get what you mean, this is the implementation of the injected writer. I just don't wanted to implement everything here at this moment, it feels way too far from the scope of the PR.
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.
Ah, missed that you are actually using $this->outputWriter
🤦♂️
Since we're actually not using it anymore.
Fixing a small issue that was preventing us to have at least the level 3.
Droping Mockery and making the test suite way faster.
Since we're now requiring >=3.3.
Since we're requiring 2.6 now.
So that we can remove hard dependencies from the code.
By relying on the configured query writer
96c507f
to
972783a
Compare
🚢 |
Requiring PHP 7.1+, dropping HHVM and simplifying some stuff on the test suite.