Skip to content
Snippets Groups Projects
Commit abba34d8 authored by Travis Carden's avatar Travis Carden Committed by Adam G-H
Browse files

Issue #3386533: Eliminate conditional logic in...

Issue #3386533: Eliminate conditional logic in \Drupal\Tests\package_manager\Kernel\FileSyncerFactoryTest::testFactory()
parent b7101e97
No related branches found
No related tags found
No related merge requests found
...@@ -32,9 +32,18 @@ class FileSyncerFactoryTest extends KernelTestBase { ...@@ -32,9 +32,18 @@ class FileSyncerFactoryTest extends KernelTestBase {
*/ */
public function providerFactory(): array { public function providerFactory(): array {
return [ return [
'rsync file syncer' => ['rsync'], 'rsync file syncer' => [
'php file syncer' => ['php'], 'configured syncer' => 'rsync',
'no preference' => [NULL], 'expected syncer' => RsyncFileSyncerInterface::class,
],
'php file syncer' => [
'configured syncer' => 'php',
'expected syncer' => PhpFileSyncerInterface::class,
],
'no preference' => [
'configured syncer' => NULL,
'expected syncer' => FileSyncerInterface::class,
],
]; ];
} }
...@@ -44,24 +53,12 @@ class FileSyncerFactoryTest extends KernelTestBase { ...@@ -44,24 +53,12 @@ class FileSyncerFactoryTest extends KernelTestBase {
* @param string|null $configured_syncer * @param string|null $configured_syncer
* The syncer to use, as configured in automatic_updates.settings. Can be * The syncer to use, as configured in automatic_updates.settings. Can be
* 'rsync', 'php', or NULL. * 'rsync', 'php', or NULL.
* @param string $expected_syncer
* The expected syncer class.
* *
* @dataProvider providerFactory * @dataProvider providerFactory
*/ */
public function testFactory(?string $configured_syncer): void { public function testFactory(?string $configured_syncer, string $expected_syncer): void {
switch ($configured_syncer) {
case 'rsync':
$expected_syncer = RsyncFileSyncerInterface::class;
break;
case 'php':
$expected_syncer = PhpFileSyncerInterface::class;
break;
default:
$expected_syncer = FileSyncerInterface::class;
break;
}
$this->config('package_manager.settings') $this->config('package_manager.settings')
->set('file_syncer', $configured_syncer) ->set('file_syncer', $configured_syncer)
->save(); ->save();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment