/**
  * @test
  */
 public function getRegisteredStreamWrappersReturnsRegisteredStreamWrappers()
 {
     $mockStreamWrapper1ClassName = get_class($this->mockStreamWrapper);
     $mockStreamWrapper2 = $this->getMock(\TYPO3\Flow\Resource\Streams\StreamWrapperInterface::class);
     $mockStreamWrapper2ClassName = get_class($mockStreamWrapper2);
     \TYPO3\Flow\Resource\Streams\StreamWrapperAdapter::registerStreamWrapper('mockScheme1', $mockStreamWrapper1ClassName);
     \TYPO3\Flow\Resource\Streams\StreamWrapperAdapter::registerStreamWrapper('mockScheme2', $mockStreamWrapper2ClassName);
     $registeredStreamWrappers = \TYPO3\Flow\Resource\Streams\StreamWrapperAdapter::getRegisteredStreamWrappers();
     $this->assertSame($mockStreamWrapper1ClassName, $registeredStreamWrappers['mockScheme1']);
     $this->assertSame($mockStreamWrapper2ClassName, $registeredStreamWrappers['mockScheme2']);
 }
 /**
  * This test indeed messes with some of the static stuff concerning our
  * StreamWrapperAdapter setup. But since the dummy stream wrapper is removed again,
  * this does not do any harm. And registering the "real" wrappers a second
  * time doesn't do harm, either.
  *
  * What is an issue is the static object manager being set to a mocked one,
  * be careful...
  *
  * @test
  */
 public function initializeRegistersFoundStreamWrappers()
 {
     $wrapperClassName = 'MockWrapper' . md5(uniqid(mt_rand(), TRUE));
     $wrapperSchemeName = $wrapperClassName . 'scheme';
     eval('class ' . $wrapperClassName . ' extends \\TYPO3\\Flow\\Resource\\Streams\\ResourceStreamWrapper { static public function getScheme() { return \'' . $wrapperSchemeName . '\'; } }');
     $mockStreamWrapperAdapter = new $wrapperClassName();
     $mockReflectionService = $this->getMock('TYPO3\\Flow\\Reflection\\ReflectionService');
     $mockReflectionService->expects($this->once())->method('getAllImplementationClassNamesForInterface')->with('TYPO3\\Flow\\Resource\\Streams\\StreamWrapperInterface')->will($this->returnValue(array(get_class($mockStreamWrapperAdapter))));
     $mockObjectManager = $this->getMock('TYPO3\\Flow\\Object\\ObjectManagerInterface');
     $mockObjectManager->expects($this->any())->method('get')->with('TYPO3\\Flow\\Reflection\\ReflectionService')->will($this->returnValue($mockReflectionService));
     $resourceManager = new \TYPO3\Flow\Resource\ResourceManager();
     $this->inject($resourceManager, 'objectManager', $mockObjectManager);
     $resourceManager->initialize();
     $this->assertContains(get_class($mockStreamWrapperAdapter), \TYPO3\Flow\Resource\Streams\StreamWrapperAdapter::getRegisteredStreamWrappers());
     $this->assertArrayHasKey($wrapperSchemeName, \TYPO3\Flow\Resource\Streams\StreamWrapperAdapter::getRegisteredStreamWrappers());
     $this->assertContains($wrapperSchemeName, stream_get_wrappers());
     stream_wrapper_unregister($wrapperSchemeName);
 }