当前位置: 首页>>代码示例>>PHP>>正文


PHP Utility\Environment类代码示例

本文整理汇总了PHP中TYPO3\Flow\Utility\Environment的典型用法代码示例。如果您正苦于以下问题:PHP Environment类的具体用法?PHP Environment怎么用?PHP Environment使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Environment类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setUp

 /**
  * Creates the mocked filesystem used in the tests
  */
 public function setUp()
 {
     vfsStream::setup('Foo');
     $this->mockEnvironment = $this->getMock('TYPO3\\Flow\\Utility\\Environment', array(), array(), '', FALSE);
     $this->mockEnvironment->expects($this->any())->method('getPathToTemporaryDirectory')->will($this->returnValue('vfs://Foo/'));
     $this->mockEnvironment->expects($this->any())->method('getMaximumPathLength')->will($this->returnValue(1024));
 }
开发者ID:sokunthearith,项目名称:Intern-Project-Week-2,代码行数:10,代码来源:CacheFactoryTest.php

示例2: setCacheThrowsExceptionOnNonWritableDirectory

 /**
  * @test
  * @expectedException \TYPO3\Flow\Cache\Exception
  */
 public function setCacheThrowsExceptionOnNonWritableDirectory()
 {
     $this->mockEnvironment = $this->getMockBuilder(\TYPO3\Flow\Utility\Environment::class)->disableOriginalConstructor()->getMock();
     $this->mockEnvironment->expects($this->any())->method('getMaximumPathLength')->will($this->returnValue(1024));
     $this->mockEnvironment->expects($this->any())->method('getPathToTemporaryDirectory')->will($this->returnValue('vfs://non/existing/directory'));
     $this->getSimpleFileBackend();
 }
开发者ID:kszyma,项目名称:flow-development-collection,代码行数:11,代码来源:SimpleFileBackendTest.php

示例3: setUp

 public function setUp()
 {
     $this->mockDirectory = vfsStream::setup('WritableFileSystemStorageTest');
     $this->writableFileSystemStorage = $this->getAccessibleMock(WritableFileSystemStorage::class, null, ['testStorage', ['path' => 'vfs://WritableFileSystemStorageTest/']]);
     $this->mockEnvironment = $this->getMockBuilder(Environment::class)->disableOriginalConstructor()->getMock();
     $this->mockEnvironment->expects($this->any())->method('getPathToTemporaryDirectory')->will($this->returnValue('vfs://WritableFileSystemStorageTest/'));
     $this->inject($this->writableFileSystemStorage, 'environment', $this->mockEnvironment);
 }
开发者ID:kszyma,项目名称:flow-development-collection,代码行数:8,代码来源:WritableFileSystemStorageTest.php

示例4: setUp

 /**
  * Creates the mocked filesystem used in the tests
  */
 public function setUp()
 {
     vfsStream::setup('Foo');
     $this->mockEnvironment = $this->getMock(\TYPO3\Flow\Utility\Environment::class, array(), array(), '', FALSE);
     $this->mockEnvironment->expects($this->any())->method('getPathToTemporaryDirectory')->will($this->returnValue('vfs://Foo/'));
     $this->mockEnvironment->expects($this->any())->method('getMaximumPathLength')->will($this->returnValue(1024));
     $this->mockCacheManager = $this->getMock(\TYPO3\Flow\Cache\CacheManager::class, array('registerCache'), array(), '', FALSE);
     $this->mockCacheManager->expects($this->any())->method('isCachePersistent')->will($this->returnValue(FALSE));
 }
开发者ID:nlx-sascha,项目名称:flow-development-collection,代码行数:12,代码来源:CacheFactoryTest.php

示例5: setUp

 /**
  * Creates the mocked filesystem used in the tests
  */
 public function setUp()
 {
     vfsStream::setup('Foo');
     $this->mockEnvironment = $this->getMockBuilder(\TYPO3\Flow\Utility\Environment::class)->disableOriginalConstructor()->getMock();
     $this->mockEnvironment->expects($this->any())->method('getPathToTemporaryDirectory')->will($this->returnValue('vfs://Foo/'));
     $this->mockEnvironment->expects($this->any())->method('getMaximumPathLength')->will($this->returnValue(1024));
     $this->mockCacheManager = $this->getMockBuilder(\TYPO3\Flow\Cache\CacheManager::class)->disableOriginalConstructor()->setMethods(array('registerCache', 'isCachePersistent'))->getMock();
     $this->mockCacheManager->expects($this->any())->method('isCachePersistent')->will($this->returnValue(false));
 }
开发者ID:cerlestes,项目名称:flow-development-collection,代码行数:12,代码来源:CacheFactoryTest.php

示例6: setUp

 public function setUp()
 {
     vfsStream::setup('Foo');
     $this->cacheManager = new \TYPO3\Flow\Cache\CacheManager();
     $this->mockEnvironment = $this->getMockBuilder(\TYPO3\Flow\Utility\Environment::class)->disableOriginalConstructor()->getMock();
     $this->mockEnvironment->expects($this->any())->method('getPathToTemporaryDirectory')->will($this->returnValue('vfs://Foo/'));
     $this->cacheManager->injectEnvironment($this->mockEnvironment);
     $this->mockSystemLogger = $this->getMock(\TYPO3\Flow\Log\SystemLoggerInterface::class);
     $this->cacheManager->injectSystemLogger($this->mockSystemLogger);
     $this->mockConfigurationManager = $this->getMockBuilder(\TYPO3\Flow\Configuration\ConfigurationManager::class)->disableOriginalConstructor()->getMock();
     $this->cacheManager->injectConfigurationManager($this->mockConfigurationManager);
 }
开发者ID:nlx-sascha,项目名称:flow-development-collection,代码行数:12,代码来源:CacheManagerTest.php

示例7: setCacheThrowsExceptionIfCachePathLengthExceedsMaximumPathLength

 /**
  * @test
  * @expectedException \TYPO3\Flow\Cache\Exception
  */
 public function setCacheThrowsExceptionIfCachePathLengthExceedsMaximumPathLength()
 {
     $this->mockEnvironment = $this->getMockBuilder('TYPO3\\Flow\\Utility\\Environment')->disableOriginalConstructor()->getMock();
     $this->mockEnvironment->expects($this->any())->method('getMaximumPathLength')->will($this->returnValue(5));
     $this->mockEnvironment->expects($this->any())->method('getPathToTemporaryDirectory')->will($this->returnValue('vfs://Temporary/Directory/'));
     $this->getSimpleFileBackend();
 }
开发者ID:sengkimlong,项目名称:Flow3-Authentification,代码行数:11,代码来源:SimpleFileBackendTest.php

示例8: create

 /**
  * Factory method which creates an EntityManager.
  *
  * @return \Doctrine\ORM\EntityManager
  */
 public function create()
 {
     $config = new \Doctrine\ORM\Configuration();
     $config->setClassMetadataFactoryName('TYPO3\\Flow\\Persistence\\Doctrine\\Mapping\\ClassMetadataFactory');
     $cache = new \TYPO3\Flow\Persistence\Doctrine\CacheAdapter();
     // must use ObjectManager in compile phase...
     $cache->setCache($this->objectManager->get('TYPO3\\Flow\\Cache\\CacheManager')->getCache('Flow_Persistence_Doctrine'));
     $config->setMetadataCacheImpl($cache);
     $config->setQueryCacheImpl($cache);
     $resultCache = new \TYPO3\Flow\Persistence\Doctrine\CacheAdapter();
     // must use ObjectManager in compile phase...
     $resultCache->setCache($this->objectManager->get('TYPO3\\Flow\\Cache\\CacheManager')->getCache('Flow_Persistence_Doctrine_Results'));
     $config->setResultCacheImpl($resultCache);
     if (class_exists($this->settings['doctrine']['sqlLogger'])) {
         $config->setSQLLogger(new $this->settings['doctrine']['sqlLogger']());
     }
     $eventManager = $this->buildEventManager();
     $flowAnnotationDriver = $this->objectManager->get('TYPO3\\Flow\\Persistence\\Doctrine\\Mapping\\Driver\\FlowAnnotationDriver');
     $config->setMetadataDriverImpl($flowAnnotationDriver);
     $proxyDirectory = \TYPO3\Flow\Utility\Files::concatenatePaths(array($this->environment->getPathToTemporaryDirectory(), 'Doctrine/Proxies'));
     \TYPO3\Flow\Utility\Files::createDirectoryRecursively($proxyDirectory);
     $config->setProxyDir($proxyDirectory);
     $config->setProxyNamespace('TYPO3\\Flow\\Persistence\\Doctrine\\Proxies');
     $config->setAutoGenerateProxyClasses(FALSE);
     $entityManager = \Doctrine\ORM\EntityManager::create($this->settings['backendOptions'], $config, $eventManager);
     $flowAnnotationDriver->setEntityManager($entityManager);
     \Doctrine\DBAL\Types\Type::addType('objectarray', 'TYPO3\\Flow\\Persistence\\Doctrine\\DataTypes\\ObjectArray');
     if (isset($this->settings['doctrine']['filters']) && is_array($this->settings['doctrine']['filters'])) {
         foreach ($this->settings['doctrine']['filters'] as $filterName => $filterClass) {
             $config->addFilter($filterName, $filterClass);
             $entityManager->getFilters()->enable($filterName);
         }
     }
     return $entityManager;
 }
开发者ID:animaltool,项目名称:webinterface,代码行数:40,代码来源:EntityManagerFactory.php

示例9: cacheDomainForActiveRequest

 /**
  * @Flow\Around("method(TYPO3\Neos\Domain\Repository\DomainRepository->findOneByActiveRequest())")
  * @param \TYPO3\Flow\Aop\JoinPointInterface $joinPoint The current join point
  * @return mixed
  */
 public function cacheDomainForActiveRequest(JoinPointInterface $joinPoint)
 {
     if ($this->domainForActiveRequest === FALSE || $this->environment->getContext()->isTesting()) {
         $domain = $joinPoint->getAdviceChain()->proceed($joinPoint);
         $this->domainForActiveRequest = $domain;
     }
     return $this->domainForActiveRequest;
 }
开发者ID:radmiraal,项目名称:neos-development-collection,代码行数:13,代码来源:SiteRepositoryCachingAspect.php

示例10: initializeAction

 /**
  * Initializes the controller
  */
 protected function initializeAction()
 {
     $context = $this->env->getContext();
     if ($context == 'Development') {
         $this->context = 'DEV';
     } else {
         $this->context = 'PRD';
     }
 }
开发者ID:randomresult,项目名称:WMDB.Forger,代码行数:12,代码来源:StandardController.php

示例11: initializeObject

 /**
  * Initializes the manager
  *
  * @return void
  */
 public function initializeObject()
 {
     $this->lockPathAndFilename = $this->environment->getPathToTemporaryDirectory() . 'Flow.lock';
     if (file_exists($this->lockPathAndFilename)) {
         if (filemtime($this->lockPathAndFilename) < time() - self::LOCKFILE_MAXIMUM_AGE) {
             unlink($this->lockPathAndFilename);
         } else {
             $this->siteLocked = TRUE;
         }
     }
 }
开发者ID:sokunthearith,项目名称:Intern-Project-Week-2,代码行数:16,代码来源:LockManager.php

示例12: handle

 /**
  * Handle an exception depending on the context with an HTML message or XML comment
  *
  * @param array $typoScriptPath path causing the exception
  * @param \Exception $exception exception to handle
  * @param integer $referenceCode
  * @return string
  */
 protected function handle($typoScriptPath, \Exception $exception, $referenceCode)
 {
     $context = $this->environment->getContext();
     if ($context->isDevelopment()) {
         $handler = new HtmlMessageHandler();
     } else {
         $handler = new XmlCommentHandler();
     }
     $handler->setRuntime($this->getRuntime());
     return $handler->handleRenderingException($typoScriptPath, $exception);
 }
开发者ID:radmiraal,项目名称:neos-development-collection,代码行数:19,代码来源:ContextDependentHandler.php

示例13: initializeAction

 /**
  * Initializes the controller
  */
 protected function initializeAction()
 {
     $context = $this->env->getContext();
     if ($context == 'Development') {
         $this->context = 'DEV';
     } else {
         $this->context = 'PRD';
     }
     $this->connection = new Es\ElasticSearchConnection();
     $this->connection->init();
 }
开发者ID:randomresult,项目名称:WMDB.Forger,代码行数:14,代码来源:ManagementController.php

示例14: initializeAction

 /**
  * Initializes the controller
  */
 protected function initializeAction()
 {
     date_default_timezone_set('UTC');
     $context = $this->env->getContext();
     if ($context == 'Development') {
         $this->context = 'DEV';
     } else {
         $this->context = 'PRD';
     }
     $this->connection = new Es\ElasticSearchConnection();
     $this->connection->init();
     $this->sprintConfig = $this->ConfigurationManager->getConfiguration('Sprints');
 }
开发者ID:randomresult,项目名称:WMDB.Forger,代码行数:16,代码来源:SprintController.php

示例15: initializeAction

 protected function initializeAction()
 {
     date_default_timezone_set('UTC');
     $this->connection = new Es\ElasticSearchConnection();
     $this->connection->init();
     $context = $this->env->getContext();
     if ($context == 'Development') {
         $this->context = 'DEV';
     } else {
         $this->context = 'PRD';
     }
     if (isset($_GET['page'])) {
         $this->currentPage = intval($_GET['page']);
     }
 }
开发者ID:randomresult,项目名称:WMDB.Forger,代码行数:15,代码来源:GerritController.php


注:本文中的TYPO3\Flow\Utility\Environment类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。