public function FlysystemPluginManagerTest::test in Flysystem 3.0.x
Same name and namespace in other branches
- 8 tests/src/Unit/Plugin/FlysystemPluginManagerTest.php \Drupal\Tests\flysystem\Unit\Plugin\FlysystemPluginManagerTest::test()
- 3.x tests/src/Unit/Plugin/FlysystemPluginManagerTest.php \Drupal\Tests\flysystem\Unit\Plugin\FlysystemPluginManagerTest::test()
- 2.0.x tests/src/Unit/Plugin/FlysystemPluginManagerTest.php \Drupal\Tests\flysystem\Unit\Plugin\FlysystemPluginManagerTest::test()
@covers \Drupal\flysystem\Plugin\FlysystemPluginManager
File
- tests/
src/ Unit/ Plugin/ FlysystemPluginManagerTest.php, line 19
Class
- FlysystemPluginManagerTest
- @coversDefaultClass \Drupal\flysystem\Plugin\FlysystemPluginManager @group flysystem
Namespace
Drupal\Tests\flysystem\Unit\PluginCode
public function test() {
$namespaces = new \ArrayObject();
$cache_backend = new MemoryBackend('bin');
$module_handle = $this
->createMock(ModuleHandlerInterface::class);
$manager = new FlysystemPluginManager($namespaces, $cache_backend, $module_handle);
$this
->assertSame('missing', $manager
->getFallbackPluginId('beep'));
$this
->assertIsArray($manager
->getDefinitions());
// Test alterDefinitions().
$method = new \ReflectionMethod($manager, 'alterDefinitions');
$method
->setAccessible(TRUE);
$definitions = [
'test1' => [
'extensions' => [],
],
'test2' => [
'extensions' => [
'pdo',
],
],
'test3' => [
'extensions' => [
'missing_extension',
],
],
];
$method
->invokeArgs($manager, [
&$definitions,
]);
$this
->assertSame(2, count($definitions));
$this
->assertArrayHasKey('test1', $definitions);
$this
->assertArrayHasKey('test2', $definitions);
$this
->assertArrayNotHasKey('test3', $definitions);
}