Skip to content

Commit 36282ad

Browse files
Merge branch '7.0' into 7.1
* 7.0: Allow service locators to be ordered by priority. [Filesystem][Mime] Fix transient tests Test convert CompletionInput into string
2 parents b0a438b + c9c8239 commit 36282ad

File tree

9 files changed

+28
-14
lines changed

9 files changed

+28
-14
lines changed

src/Symfony/Component/Console/Completion/CompletionInput.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public static function fromString(string $inputStr, int $currentIndex): self
5353
* Create an input based on an COMP_WORDS token list.
5454
*
5555
* @param string[] $tokens the set of split tokens (e.g. COMP_WORDS or argv)
56-
* @param $currentIndex the index of the cursor (e.g. COMP_CWORD)
56+
* @param int $currentIndex the index of the cursor (e.g. COMP_CWORD)
5757
*/
5858
public static function fromTokens(array $tokens, int $currentIndex): self
5959
{

src/Symfony/Component/Console/Tests/Completion/CompletionInputTest.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,4 +132,19 @@ public static function provideFromStringData()
132132
yield ['bin/console cache:clear "multi word string"', ['bin/console', 'cache:clear', '"multi word string"']];
133133
yield ['bin/console cache:clear \'multi word string\'', ['bin/console', 'cache:clear', '\'multi word string\'']];
134134
}
135+
136+
public function testToString()
137+
{
138+
$input = CompletionInput::fromTokens(['foo', 'bar', 'baz'], 0);
139+
$this->assertSame('foo| bar baz', (string) $input);
140+
141+
$input = CompletionInput::fromTokens(['foo', 'bar', 'baz'], 1);
142+
$this->assertSame('foo bar| baz', (string) $input);
143+
144+
$input = CompletionInput::fromTokens(['foo', 'bar', 'baz'], 2);
145+
$this->assertSame('foo bar baz|', (string) $input);
146+
147+
$input = CompletionInput::fromTokens(['foo', 'bar', 'baz'], 11);
148+
$this->assertSame('foo bar baz |', (string) $input);
149+
}
135150
}

src/Symfony/Component/DependencyInjection/Compiler/ServiceLocatorTagPass.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ public static function map(array $services): array
131131

132132
$services[$k] = new ServiceClosureArgument($v);
133133
}
134-
ksort($services);
135134

136135
return $services;
137136
}

src/Symfony/Component/DependencyInjection/Tests/Compiler/IntegrationTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,7 @@ public function testTaggedLocatorWithDefaultPriorityMethodConfiguredViaAttribute
619619
// We need to check priority of instances in the factories
620620
$factories = (new \ReflectionClass($locator))->getProperty('factories');
621621

622-
self::assertSame([BarTagClass::class, FooTagClass::class], array_keys($factories->getValue($locator)));
622+
self::assertSame([FooTagClass::class, BarTagClass::class], array_keys($factories->getValue($locator)));
623623
}
624624

625625
public function testTaggedLocatorWithDefaultIndexMethodAndWithDefaultPriorityMethodConfiguredViaAttribute()
@@ -648,7 +648,7 @@ public function testTaggedLocatorWithDefaultIndexMethodAndWithDefaultPriorityMet
648648
// We need to check priority of instances in the factories
649649
$factories = (new \ReflectionClass($locator))->getProperty('factories');
650650

651-
self::assertSame(['bar_tag_class', 'foo_tag_class'], array_keys($factories->getValue($locator)));
651+
self::assertSame(['foo_tag_class', 'bar_tag_class'], array_keys($factories->getValue($locator)));
652652
self::assertSame($container->get(BarTagClass::class), $locator->get('bar_tag_class'));
653653
self::assertSame($container->get(FooTagClass::class), $locator->get('foo_tag_class'));
654654
}

src/Symfony/Component/DependencyInjection/Tests/Compiler/RegisterServiceSubscribersPassTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ public static function getSubscribedServices(): array
452452
'autowired' => new ServiceClosureArgument(new TypedReference('service.id', 'stdClass', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, 'autowired', [new Autowire(service: 'service.id')])),
453453
'autowired.nullable' => new ServiceClosureArgument(new TypedReference('service.id', 'stdClass', ContainerInterface::IGNORE_ON_INVALID_REFERENCE, 'autowired.nullable', [new Autowire(service: 'service.id')])),
454454
'autowired.parameter' => new ServiceClosureArgument('foobar'),
455-
'autowire.decorated' => new ServiceClosureArgument(new Reference('.service_locator.4qmCWv..inner', ContainerInterface::NULL_ON_INVALID_REFERENCE)),
455+
'autowire.decorated' => new ServiceClosureArgument(new Reference('.service_locator.PIYLhDv.inner', ContainerInterface::NULL_ON_INVALID_REFERENCE)),
456456
'target' => new ServiceClosureArgument(new TypedReference('stdClass', 'stdClass', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, 'target', [new Target('someTarget')])),
457457
];
458458
$this->assertEquals($expected, $container->getDefinition((string) $locator->getFactory()[0])->getArgument(0));

src/Symfony/Component/DependencyInjection/Tests/Compiler/ServiceLocatorTagPassTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ public function testDefinitionOrderIsTheSame()
214214
$locator = $container->getDefinition($locator);
215215
$factories = $locator->getArguments()[0];
216216

217-
static::assertSame(['service-1', 'service-2'], array_keys($factories));
217+
static::assertSame(['service-2', 'service-1'], array_keys($factories));
218218
}
219219

220220
public function testBindingsAreProcessed()

src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_subscriber.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,14 @@ protected static function getTestServiceSubscriberService($container)
6565
protected static function getFooServiceService($container)
6666
{
6767
return $container->services['foo_service'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber((new \Symfony\Component\DependencyInjection\Argument\ServiceLocator($container->getService ??= $container->getService(...), [
68-
'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition' => ['privates', 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition', 'getCustomDefinitionService', false],
6968
'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\TestServiceSubscriber' => ['services', 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\TestServiceSubscriber', 'getTestServiceSubscriberService', false],
69+
'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition' => ['privates', 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition', 'getCustomDefinitionService', false],
7070
'bar' => ['services', 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\TestServiceSubscriber', 'getTestServiceSubscriberService', false],
7171
'baz' => ['privates', 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition', 'getCustomDefinitionService', false],
7272
'late_alias' => ['services', 'late_alias', 'getLateAliasService', false],
7373
], [
74-
'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition' => 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition',
7574
'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\TestServiceSubscriber' => 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\TestServiceSubscriber',
75+
'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition' => 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition',
7676
'bar' => 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition',
7777
'baz' => 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition',
7878
'late_alias' => 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\TestDefinition1',

src/Symfony/Component/Filesystem/Tests/FilesystemTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,17 +171,17 @@ public function testCopyForOriginUrlsAndExistingLocalFileDefaultsToCopy()
171171
}
172172

173173
$finder = new PhpExecutableFinder();
174-
$process = new Process(array_merge([$finder->find(false)], $finder->findArguments(), ['-dopcache.enable=0', '-dvariables_order=EGPCS', '-S', 'localhost:8057']));
174+
$process = new Process(array_merge([$finder->find(false)], $finder->findArguments(), ['-dopcache.enable=0', '-dvariables_order=EGPCS', '-S', 'localhost:8857']));
175175
$process->setWorkingDirectory(__DIR__.'/Fixtures/web');
176176

177177
$process->start();
178178

179179
do {
180180
usleep(50000);
181-
} while (!@fopen('http://localhost:8057', 'r'));
181+
} while (!@fopen('http://localhost:8857', 'r'));
182182

183183
try {
184-
$sourceFilePath = 'http://localhost:8057/logo_symfony_header.png';
184+
$sourceFilePath = 'http://localhost:8857/logo_symfony_header.png';
185185
$targetFilePath = $this->workspace.\DIRECTORY_SEPARATOR.'copy_target_file';
186186
file_put_contents($targetFilePath, 'TARGET FILE');
187187
$this->filesystem->copy($sourceFilePath, $targetFilePath, false);

src/Symfony/Component/Mime/Tests/Part/DataPartTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,15 +143,15 @@ public function testFromPathWithUrl()
143143
}
144144

145145
$finder = new PhpExecutableFinder();
146-
$process = new Process(array_merge([$finder->find(false)], $finder->findArguments(), ['-dopcache.enable=0', '-dvariables_order=EGPCS', '-S', 'localhost:8057']));
146+
$process = new Process(array_merge([$finder->find(false)], $finder->findArguments(), ['-dopcache.enable=0', '-dvariables_order=EGPCS', '-S', 'localhost:8856']));
147147
$process->setWorkingDirectory(__DIR__.'/../Fixtures/web');
148148
$process->start();
149149

150150
try {
151151
do {
152152
usleep(50000);
153-
} while (!@fopen('http://localhost:8057', 'r'));
154-
$p = DataPart::fromPath($file = 'http://localhost:8057/logo_symfony_header.png');
153+
} while (!@fopen('http://localhost:8856', 'r'));
154+
$p = DataPart::fromPath($file = 'http://localhost:8856/logo_symfony_header.png');
155155
$content = file_get_contents($file);
156156
$this->assertEquals($content, $p->getBody());
157157
$maxLineLength = 76;

0 commit comments

Comments
 (0)