public function FileCopierFactoryTest::testFactory in Automatic Updates 8.2
Tests creating a file copier using our specialized factory class.
@dataProvider providerFactory
Parameters
string|null $configured_copier: The copier to use, as configured in automatic_updates.settings. Can be 'rsync', 'php', or NULL.
File
- package_manager/
tests/ src/ Kernel/ FileCopierFactoryTest.php, line 42
Class
Namespace
Drupal\Tests\package_manager\KernelCode
public function testFactory(?string $configured_copier) : void {
$factory = $this->container
->get('package_manager.file_copier.factory');
switch ($configured_copier) {
case 'rsync':
$expected_copier = $this->container
->get('package_manager.file_copier.rsync');
break;
case 'php':
$expected_copier = $this->container
->get('package_manager.file_copier.php');
break;
default:
$expected_copier = $factory
->create();
break;
}
$this
->config('package_manager.settings')
->set('file_copier', $configured_copier)
->save();
$this
->assertSame($expected_copier, $factory
->create());
}