-
Notifications
You must be signed in to change notification settings - Fork 189
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
Add the option '--if-not-exists' in the command 'ongr:es:index:create' #535
Conversation
->addOption('no-mapping', 'nm', InputOption::VALUE_NONE, 'Do not include mapping') | ||
->addOption( | ||
'if-not-exists', | ||
'ine', |
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 that Symfony does not support multi-letter input option shortcuts. I see that we have the same with other options
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.
http://www.gnu.org/software/libc/manual/html_node/Argument-Syntax.html
With this standard, it could understand wrong the options.
$input->getOption('manager') | ||
) | ||
); | ||
return; |
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'm not sure 100% but probably better would be change to: return 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.
You are correct. As Doctrine's code about this processing, it will be
return $error ? 1 : 0;
whatever success or error.
Hence, here, we agree that 0 will be for fail and 1 for success. Is it OK? @saimaz
* | ||
* @dataProvider getTestExecuteData | ||
*/ | ||
public function testExecuteWithIndexExistence($managerName, $arguments, $options) |
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.
You should not use different test case data provider and try to behave inside test case to match expectations. To test --if-not-exists
please write separate test case, the data provider is not necessary.
…'if-not-exists' in 'ongr:es:index:create' command
Thanks for your points, @saimaz . With this patch, I removed
About the data provider, I think this test case still needs it because at present the test case does not try to catch the Elasticsearch exception of 'Index already exists', it tries to assert the returns from command execution. |
|
||
// Try to create index in prior | ||
if (!$manager->indexExists()) { | ||
$manager->createIndex(); |
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.
Index is automatically created when you call $this->getManager()
.
…sts' in create index command.
…'if-not-exists' in 'ongr:es:index:create' command
…sts' in create index command.
… of testcases to avoid impacting on each other.
Closes #423 |
I will create new PR with better form for this issue. |
I fixed the issue #423 . Please review again. Thanks.