bug #31430 Fix tests on master/4.3 (fabpot)

This PR was squashed before being merged into the 4.3-dev branch (closes #31430).

Discussion
----------

Fix tests on master/4.3

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | n/a

<!--
Write a short README entry for your feature/bugfix here (replace this comment block.)
This will help people understand your PR and can be used as a start of the Doc PR.
Additionally:
 - Bug fixes must be submitted against the lowest branch where they apply
   (lowest branches are regularly merged to upper ones so they get the fixes too).
 - Features and deprecations must be submitted against the master branch.
-->

Commits
-------

e6071a15c2 fixed test on Windows
5b7a924c3d fixed tests
49ceb1e662 fixed a test
aac59b167f fixed tests
This commit is contained in:
Fabien Potencier 2019-05-08 22:09:49 +02:00
commit 0462e1124c
3 changed files with 8 additions and 26 deletions

View File

@ -205,7 +205,7 @@ class QuestionHelperTest extends AbstractQuestionHelperTest
}
// Po<TAB>Cr<TAB>P<DOWN ARROW><DOWN ARROW><NEWLINE>
$inputStream = $this->getInputStream("Pa\177\177o\tCr\t\033[A\033[A\033[A\n");
$inputStream = $this->getInputStream("Pa\177\177o\tCr\tP\033[A\033[A\n");
$dialog = new QuestionHelper();
$helperSet = new HelperSet([new FormatterHelper()]);
@ -223,21 +223,10 @@ class QuestionHelperTest extends AbstractQuestionHelperTest
// No effort is made to avoid irrelevant suggestions, as this is handled
// by the autocomplete function.
$callback = function ($input) {
$knownWords = [
'Carrot',
'Creme',
'Curry',
'Parsnip',
'Pie',
'Potato',
'Tart',
];
$knownWords = ['Carrot', 'Creme', 'Curry', 'Parsnip', 'Pie', 'Potato', 'Tart'];
$inputWords = explode(' ', $input);
$lastInputWord = array_pop($inputWords);
$suggestionBase = $inputWords
? implode(' ', $inputWords).' '
: '';
array_pop($inputWords);
$suggestionBase = $inputWords ? implode(' ', $inputWords).' ' : '';
return array_map(
function ($word) use ($suggestionBase) {
@ -249,14 +238,7 @@ class QuestionHelperTest extends AbstractQuestionHelperTest
$question->setAutocompleterCallback($callback);
$this->assertSame(
'Potato Creme Pie',
$dialog->ask(
$this->createStreamableInputInterfaceMock($inputStream),
$this->createOutputInterface(),
$question
)
);
$this->assertSame('Potato Creme Pie', $dialog->ask($this->createStreamableInputInterfaceMock($inputStream), $this->createOutputInterface(), $question));
}
public function testAskWithAutocompleteWithNonSequentialKeys()
@ -736,7 +718,7 @@ class QuestionHelperTest extends AbstractQuestionHelperTest
// F00<BACKSPACE><BACKSPACE>o<TAB>,A<DOWN ARROW>,<SPACE>SecurityBundle<NEWLINE>
// Acme<TAB>,<SPACE>As<TAB><29x BACKSPACE>S<TAB><NEWLINE>
// Ac<TAB>,As<TAB><3x BACKSPACE>d<TAB><NEWLINE>
$inputStream = $this->getInputStream("\nF\t\nA\033[A\033[A\033[A\t,F\t\nF00\177\177o\t,A\033[B\t, SecurityBundle\nAcme\t, As\t\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177S\t\nAc\t,As\t\177\177\177d\t\n");
$inputStream = $this->getInputStream("\nF\t\nA\033[A\033[A\033[A\t,F\t\nF00\177\177o\t,A\033[B\t, SecurityBundle\nSecurityBundle\nAcme\t, As\t\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177S\t\nAc\t,As\t\177\177\177d\t\n");
$dialog = new QuestionHelper();
$helperSet = new HelperSet([new FormatterHelper()]);

View File

@ -226,7 +226,7 @@ TXT
{
$actualDuration = microtime(true) - $startTime;
if (\method_exists([$this, 'assertEqualsWithDelta'])) {
if (method_exists($this, 'assertEqualsWithDelta')) {
$this->assertEqualsWithDelta($expectedDuration, $actualDuration, .5, 'Duration was not within expected range');
} else {
$this->assertEquals($expectedDuration, $actualDuration, 'Duration was not within expected range', .5);

View File

@ -70,7 +70,7 @@ EOF;
$this->assertEquals($expectedCatalogue, $actualCatalogue);
$filename = __DIR__.'/../fixtures/extractor/translation.html.php';
$filename = str_replace(\DIRECTORY_SEPARATOR, '/', __DIR__).'/../fixtures/extractor/translation.html.php';
$this->assertEquals(['sources' => [$filename.':2']], $catalogue->getMetadata('single-quoted key'));
$this->assertEquals(['sources' => [$filename.':43']], $catalogue->getMetadata('other-domain-test-no-params-short-array', 'not_messages'));
}