/**
  * Sets up this test case
  *
  */
 protected function setUp()
 {
     ComposerUtility::flushCaches();
     vfsStream::setup('Test');
     $this->mockBootstrap = $this->getMockBuilder(Bootstrap::class)->disableOriginalConstructor()->getMock();
     $this->mockBootstrap->expects($this->any())->method('getSignalSlotDispatcher')->will($this->returnValue($this->createMock(\TYPO3\Flow\SignalSlot\Dispatcher::class)));
     $this->mockApplicationContext = $this->getMockBuilder(ApplicationContext::class)->disableOriginalConstructor()->getMock();
     $this->mockBootstrap->expects($this->any())->method('getContext')->will($this->returnValue($this->mockApplicationContext));
     $mockObjectManager = $this->createMock(\TYPO3\Flow\Object\ObjectManagerInterface::class);
     $this->mockBootstrap->expects($this->any())->method('getObjectManager')->will($this->returnValue($mockObjectManager));
     $mockReflectionService = $this->createMock(\TYPO3\Flow\Reflection\ReflectionService::class);
     $mockReflectionService->expects($this->any())->method('getClassNameByObject')->will($this->returnCallback(function ($object) {
         if ($object instanceof \Doctrine\ORM\Proxy\Proxy) {
             return get_parent_class($object);
         }
         return get_class($object);
     }));
     $mockObjectManager->expects($this->any())->method('get')->with(\TYPO3\Flow\Reflection\ReflectionService::class)->will($this->returnValue($mockReflectionService));
     mkdir('vfs://Test/Packages/Application', 0700, true);
     mkdir('vfs://Test/Configuration');
     $this->packageManager = new PackageManager('vfs://Test/Configuration/PackageStates.php');
     $composerNameToPackageKeyMap = array('typo3/flow' => 'TYPO3.Flow');
     $this->inject($this->packageManager, 'composerNameToPackageKeyMap', $composerNameToPackageKeyMap);
     $this->inject($this->packageManager, 'packagesBasePath', 'vfs://Test/Packages/');
     $this->mockDispatcher = $this->getMockBuilder(Dispatcher::class)->disableOriginalConstructor()->getMock();
     $this->inject($this->packageManager, 'dispatcher', $this->mockDispatcher);
     $this->packageManager->initialize($this->mockBootstrap);
 }
 public function setUp()
 {
     $this->fileSystemTarget = new FileSystemTarget('test');
     $this->mockBootstrap = $this->getMockBuilder(Bootstrap::class)->disableOriginalConstructor()->getMock();
     $this->mockRequestHandler = $this->getMockBuilder(HttpRequestHandlerInterface::class)->getMock();
     $this->mockHttpRequest = $this->getMockBuilder(Request::class)->disableOriginalConstructor()->getMock();
     $this->mockHttpRequest->expects($this->any())->method('getBaseUri')->will($this->returnValue(new Uri('http://detected/base/uri/')));
     $this->mockRequestHandler->expects($this->any())->method('getHttpRequest')->will($this->returnValue($this->mockHttpRequest));
     $this->mockBootstrap->expects($this->any())->method('getActiveRequestHandler')->will($this->returnValue($this->mockRequestHandler));
     $this->inject($this->fileSystemTarget, 'bootstrap', $this->mockBootstrap);
 }
Exemplo n.º 3
0
 /**
  * @return void
  */
 public function setUp()
 {
     parent::setup();
     vfsStream::setup('Foo');
     $this->httpRequest = Request::create(new Uri('http://localhost'));
     $this->httpResponse = new Response();
     $mockRequestHandler = $this->getMock('TYPO3\\Flow\\Http\\RequestHandler', array(), array(), '', FALSE, FALSE);
     $mockRequestHandler->expects($this->any())->method('getHttpRequest')->will($this->returnValue($this->httpRequest));
     $mockRequestHandler->expects($this->any())->method('getHttpResponse')->will($this->returnValue($this->httpResponse));
     $this->mockBootstrap = $this->getMock('TYPO3\\Flow\\Core\\Bootstrap', array(), array(), '', FALSE, FALSE);
     $this->mockBootstrap->expects($this->any())->method('getActiveRequestHandler')->will($this->returnValue($mockRequestHandler));
     $this->mockSecurityContext = $this->getMock('TYPO3\\Flow\\Security\\Context', array(), array(), '', FALSE, FALSE);
     $this->mockObjectManager = $this->getMock('TYPO3\\Flow\\Object\\ObjectManagerInterface', array(), array(), '', FALSE, FALSE);
     $this->mockObjectManager->expects($this->any())->method('get')->with('TYPO3\\Flow\\Security\\Context')->will($this->returnValue($this->mockSecurityContext));
 }
 /**
  * @return void
  */
 public function setUp()
 {
     parent::setup();
     vfsStream::setup('Foo');
     $this->httpRequest = Request::create(new Uri('http://localhost'));
     $this->httpResponse = new Response();
     $mockRequestHandler = $this->createMock(\TYPO3\Flow\Http\RequestHandler::class, array(), array(), '', false, false);
     $mockRequestHandler->expects($this->any())->method('getHttpRequest')->will($this->returnValue($this->httpRequest));
     $mockRequestHandler->expects($this->any())->method('getHttpResponse')->will($this->returnValue($this->httpResponse));
     $this->mockBootstrap = $this->createMock(\TYPO3\Flow\Core\Bootstrap::class, array(), array(), '', false, false);
     $this->mockBootstrap->expects($this->any())->method('getActiveRequestHandler')->will($this->returnValue($mockRequestHandler));
     $this->mockSecurityContext = $this->createMock(\TYPO3\Flow\Security\Context::class, array(), array(), '', false, false);
     $this->mockObjectManager = $this->createMock(\TYPO3\Flow\Object\ObjectManagerInterface::class, array(), array(), '', false, false);
     $this->mockObjectManager->expects($this->any())->method('get')->with(\TYPO3\Flow\Security\Context::class)->will($this->returnValue($this->mockSecurityContext));
 }