/** * 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(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(ObjectManagerInterface::class); $this->mockBootstrap->expects($this->any())->method('getObjectManager')->will($this->returnValue($mockObjectManager)); $mockReflectionService = $this->createMock(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(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 = ['neos/flow' => 'Neos.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->createMock(HttpRequestHandlerInterface::class); $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); }
/** * @return void */ public function setUp() { parent::setup(); vfsStream::setup('Foo'); $this->httpRequest = Http\Request::create(new Http\Uri('http://localhost')); $this->httpResponse = new Http\Response(); $mockRequestHandler = $this->createMock(Http\RequestHandler::class); $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(Bootstrap::class); $this->mockBootstrap->expects($this->any())->method('getActiveRequestHandler')->will($this->returnValue($mockRequestHandler)); $this->mockSecurityContext = $this->createMock(Context::class); $this->mockObjectManager = $this->createMock(ObjectManagerInterface::class); $this->mockObjectManager->expects($this->any())->method('get')->with(Context::class)->will($this->returnValue($this->mockSecurityContext)); }