3 * This file is part of vfsStream.
5 * For the full copyright and license information, please view the LICENSE
6 * file that was distributed with this source code.
8 * @package org\bovigo\vfs
10 namespace org\bovigo\vfs;
13 * Test for org\bovigo\vfs\vfsStreamWrapper.
15 class vfsStreamWrapperUnregisterTestCase extends \PHPUnit_Framework_TestCase
19 * Unregistering a registered URL wrapper.
23 public function unregisterRegisteredUrlWrapper()
25 vfsStreamWrapper::register();
26 vfsStreamWrapper::unregister();
27 $this->assertNotContains(vfsStream::SCHEME, stream_get_wrappers());
31 * Unregistering a third party wrapper for vfs:// fails.
34 * @expectedException org\bovigo\vfs\vfsStreamException
35 * @runInSeparateProcess
37 public function unregisterThirdPartyVfsScheme()
39 // Unregister possible registered URL wrapper.
40 vfsStreamWrapper::unregister();
42 $mock = $this->getMock('org\\bovigo\\vfs\\vfsStreamWrapper');
43 stream_wrapper_register(vfsStream::SCHEME, get_class($mock));
45 vfsStreamWrapper::unregister();
49 * Unregistering when not in registered state will fail.
52 * @expectedException org\bovigo\vfs\vfsStreamException
53 * @runInSeparateProcess
55 public function unregisterWhenNotInRegisteredState()
57 vfsStreamWrapper::register();
58 stream_wrapper_unregister(vfsStream::SCHEME);
59 vfsStreamWrapper::unregister();
63 * Unregistering while not registers won't fail.
67 public function unregisterWhenNotRegistered()
69 // Unregister possible registered URL wrapper.
70 vfsStreamWrapper::unregister();
72 $this->assertNotContains(vfsStream::SCHEME, stream_get_wrappers());
73 vfsStreamWrapper::unregister();