protected function setUp() { $this->messageReceiver = new StupidWorkflowProcessorMock(); $this->commandBus = new CommandBus(); $this->commandBus->utilize(new SingleTargetMessageRouter($this->messageReceiver)); $this->commandBus->utilize(new WorkflowProcessorInvokeStrategy()); $this->eventBus = new EventBus(); $this->eventBus->utilize(new SingleTargetMessageRouter($this->messageReceiver)); $this->eventBus->utilize(new WorkflowProcessorInvokeStrategy()); $locationTranslator = new LocationTranslator(['temp' => sys_get_temp_dir(), 'testdata' => $this->getTestDataPath()]); $this->fileGateway = new FileGateway(Bootstrap::getServiceManager()->get('prooph.link.fileconnector.file_type_adapter_manager'), Bootstrap::getServiceManager()->get('prooph.link.fileconnector.filename_renderer'), $locationTranslator); $workflowEngine = new RegistryWorkflowEngine(); $workflowEngine->registerCommandBus($this->commandBus, [NodeName::defaultName()->toString(), 'file-connector']); $workflowEngine->registerEventBus($this->eventBus, [NodeName::defaultName()->toString(), 'file-connector']); $this->fileGateway->useWorkflowEngine($workflowEngine); $this->tempPath = sys_get_temp_dir() . DIRECTORY_SEPARATOR; }
protected function setUp() { $this->mixinManager = Bootstrap::getServiceManager()->get('prooph.link.fileconnector.filename_mixin_manager'); }
/** * @test */ public function it_creates_a_mixin_manager_by_requesting_it_from_the_service_locator() { $mixinManager = Bootstrap::getServiceManager()->get('prooph.link.fileconnector.filename_mixin_manager'); $this->assertInstanceOf('Prooph\\Link\\FileConnector\\Service\\FileNameRenderer\\MixinManager', $mixinManager); }
/** * @test */ public function it_creates_a_file_type_adapter_manager_from_application_config_when_requesting_it_from_service_locator() { $fileTypeAdapters = Bootstrap::getServiceManager()->get('prooph.link.fileconnector.file_type_adapter_manager'); $this->assertInstanceOf('Prooph\\Link\\FileConnector\\Service\\FileTypeAdapter\\FileTypeAdapterManager', $fileTypeAdapters); }
} protected static function initAutoloader() { $vendorPath = static::findParentPath('vendor'); if (is_readable($vendorPath . '/autoload.php')) { $loader = (include $vendorPath . '/autoload.php'); } else { $zf2Path = getenv('ZF2_PATH') ?: (defined('ZF2_PATH') ? ZF2_PATH : (is_dir($vendorPath . '/ZF2/library') ? $vendorPath . '/ZF2/library' : false)); if (!$zf2Path) { throw new RuntimeException('Unable to load ZF2. Run `php composer.phar install` or define a ZF2_PATH environment variable.'); } include $zf2Path . '/Zend/Loader/AutoloaderFactory.php'; } AutoloaderFactory::factory(array('Zend\\Loader\\StandardAutoloader' => array('autoregister_zf' => true, 'namespaces' => array(__NAMESPACE__ => __DIR__ . '/' . __NAMESPACE__, 'ProcessingTest' => __DIR__ . '/../../../vendor/prooph/processing/tests')))); } protected static function findParentPath($path) { $dir = __DIR__; $previousDir = '.'; while (!is_dir($dir . '/' . $path)) { $dir = dirname($dir); if ($previousDir === $dir) { return false; } $previousDir = $dir; } return $dir . '/' . $path; } } Bootstrap::init();
/** * @test */ public function it_provides_a_file_gateway_when_a_service_alias_matches_the_pattern() { $fileGateway = Bootstrap::getServiceManager()->get('filegateway:::csv-file-reader'); $this->assertInstanceOf('Prooph\\Link\\FileConnector\\Service\\FileGateway', $fileGateway); }
protected function setUp() { $this->fileTypeAdapters = Bootstrap::getServiceManager()->get('prooph.link.fileconnector.file_type_adapter_manager'); }
protected function setUp() { $this->fileNameRenderer = Bootstrap::getServiceManager()->get('prooph.link.fileconnector.filename_renderer'); }