本文整理汇总了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));
}
示例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();
}
示例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);
}
示例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));
}
示例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));
}
示例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);
}
示例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();
}
示例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;
}
示例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;
}
示例10: initializeAction
/**
* Initializes the controller
*/
protected function initializeAction()
{
$context = $this->env->getContext();
if ($context == 'Development') {
$this->context = 'DEV';
} else {
$this->context = 'PRD';
}
}
示例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;
}
}
}
示例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);
}
示例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();
}
示例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');
}
示例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']);
}
}