Skip to content
This repository was archived by the owner on Jul 8, 2024. It is now read-only.

Commit c0933d2

Browse files
committed
remove deprecated features
1 parent e863c2e commit c0933d2

6 files changed

Lines changed: 23 additions & 85 deletions

File tree

src/Bowerphp/Command/Helper/DialogHelper.php

Lines changed: 0 additions & 38 deletions
This file was deleted.

src/Bowerphp/Command/Helper/QuestionHelper.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111

1212
namespace Bowerphp\Command\Helper;
1313

14-
use Symfony\Component\Console\Helper\QuestionHelper as BaseDialogHelper;
14+
use Symfony\Component\Console\Helper\QuestionHelper as BaseQuestionHelper;
1515
use Symfony\Component\Console\Question\Question;
1616

1717
/**
1818
* Copied by Composer https://github.com/composer/composer
1919
*/
20-
class QuestionHelper extends BaseDialogHelper
20+
class QuestionHelper extends BaseQuestionHelper
2121
{
2222
/**
2323
* Build text for asking a question. For example:

src/Bowerphp/Command/InitCommand.php

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -50,29 +50,15 @@ protected function execute(InputInterface $input, OutputInterface $output)
5050

5151
// @codeCoverageIgnoreStart
5252
if ($input->isInteractive()) {
53-
if (class_exists('Symfony\Component\Console\Helper\DialogHelper')) {
54-
$dialog = $this->getHelperSet()->get('dialog');
55-
$params['name'] = $dialog->ask(
56-
$output,
57-
$dialog->getQuestion('Please specify a name for project', $params['name']),
58-
$params['name']
59-
);
60-
$params['author'] = $dialog->ask(
61-
$output,
62-
$dialog->getQuestion('Please specify an author', $params['author']),
63-
$params['author']
64-
);
65-
} else {
66-
$dialog = $this->getHelperSet()->get('question');
53+
$dialog = $this->getHelperSet()->get('question');
6754

68-
$params['name'] = $dialog->ask(
69-
$input, $output, $dialog->getQuestion('Please specify a name for project', $params['name'])
70-
);
55+
$params['name'] = $dialog->ask(
56+
$input, $output, $dialog->getQuestion('Please specify a name for project', $params['name'])
57+
);
7158

72-
$params['author'] = $dialog->ask(
73-
$input, $output, $dialog->getQuestion('Please specify an author', $params['author'])
74-
);
75-
}
59+
$params['author'] = $dialog->ask(
60+
$input, $output, $dialog->getQuestion('Please specify an author', $params['author'])
61+
);
7662
}
7763
// @codeCoverageIgnoreEnd
7864
$bowerphp = $this->getBowerphp($output);

src/Bowerphp/Console/Application.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,7 @@ protected function getDefaultInputDefinition()
120120
protected function getDefaultHelperSet()
121121
{
122122
$helperSet = parent::getDefaultHelperSet();
123-
if (class_exists('Symfony\Component\Console\Helper\DialogHelper')) {
124-
$helperSet->set(new \Bowerphp\Command\Helper\DialogHelper());
125-
} else {
126-
$helperSet->set(new \Bowerphp\Command\Helper\QuestionHelper());
127-
}
123+
$helperSet->set(new \Bowerphp\Command\Helper\QuestionHelper());
128124

129125
return $helperSet;
130126
}

tests/Bowerphp/Test/Command/Helper/DialogHelperTest.php

Lines changed: 0 additions & 19 deletions
This file was deleted.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
namespace Bowerphp\Test\Command\Helper;
4+
5+
class QuestionHelperTest extends \PHPUnit_Framework_TestCase
6+
{
7+
public function testGetQuestion()
8+
{
9+
$helper = new \Bowerphp\Command\Helper\QuestionHelper();
10+
$this->assertEquals('<info>This is a question</info> [<comment>default reply</comment>]: ', $helper->getQuestion('This is a question', 'default reply')->getQuestion());
11+
$this->assertEquals('<info>Another question</info>- ', $helper->getQuestion('Another question', null, '-')->getQuestion());
12+
}
13+
}

0 commit comments

Comments
 (0)