/** * Returns ths class name of the wrapper implementation for given scheme * * @param string $scheme * the stream scheme. * @return string * the class name of the registered wrapper handler, or false if * there is no registered handler. * * @access public * @static * @since 1.0.0 */ public static function wrapper_class_name($scheme) { $wrappers = WP_Stream_Wrapper_Registry::get_stream_wrappers(); return empty($wrappers[$scheme]) ? false : $wrappers[$scheme]['class']; }
/** * Test getting the stream wrappers array * * Tests WP_Stream_Wrapper_Registry::get_stream_wrappers(). */ public function test_get_stream_wrappers() { // Register the test stream wrapper and check the schema. wp_test_stream_wrapper_register(); $stream_wrappers = WP_Stream_Wrapper_Registry::get_stream_wrappers(); // Assert that the test wrapper is registered $this->assertArrayHasKey('test', $stream_wrappers, 'The test stream wrapper should be registered here.'); // Assert that the test wrapper has the proper schema $this->assertEquals('WP Test Stream Wrapper', $stream_wrappers['test']['name']); $this->assertEquals('WP_Test_Stream_Wrapper', $stream_wrappers['test']['class']); $this->assertEquals('WP Test Stream Wrapper provides a simple extension of the WP_Local_Stream_Wrapper_Base class.', $stream_wrappers['test']['description']); // Unregister test stream wrappers WP_Stream_Wrapper_Registry::unregister_wrapper('test'); }