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


PHP Files::setInstance方法代码示例

本文整理汇总了PHP中Magento\Framework\App\Utility\Files::setInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Files::setInstance方法的具体用法?PHP Files::setInstance怎么用?PHP Files::setInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Magento\Framework\App\Utility\Files的用法示例。


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

示例1: execute

 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     try {
         Files::setInstance(new Files($input->getOption(self::INPUT_KEY_DIRECTORY)));
         $this->buildReport($input->getOption(self::INPUT_KEY_OUTPUT));
         $output->writeln('<info>Report successfully processed.</info>');
     } catch (\Exception $e) {
         $output->writeln(
             '<error>Please check the path you provided. Dependencies report generator failed with error: ' .
             $e->getMessage() . '</error>'
         );
     }
 }
开发者ID:nja78,项目名称:magento2,代码行数:16,代码来源:AbstractDependenciesCommand.php

示例2: execute

 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     try {
         /** @var \Magento\Framework\Component\ComponentRegistrar $componentRegistrar */
         $componentRegistrar = $this->objectManager->get('Magento\\Framework\\Component\\ComponentRegistrar');
         /** @var \Magento\Framework\Component\DirSearch $dirSearch */
         $dirSearch = $this->objectManager->get('Magento\\Framework\\Component\\DirSearch');
         /** @var \Magento\Framework\View\Design\Theme\ThemePackageList $themePackageList */
         $themePackageList = $this->objectManager->get('Magento\\Framework\\View\\Design\\Theme\\ThemePackageList');
         Files::setInstance(new Files($componentRegistrar, $dirSearch, $themePackageList));
         $this->buildReport($input->getOption(self::INPUT_KEY_OUTPUT));
         $output->writeln('<info>Report successfully processed.</info>');
     } catch (\Exception $e) {
         $output->writeln('<error>Please check the path you provided. Dependencies report generator failed with error: ' . $e->getMessage() . '</error>');
     }
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:19,代码来源:AbstractDependenciesCommand.php

示例3:

<?php

/**
 * Copyright © 2015 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
require __DIR__ . '/autoload.php';
\Magento\Framework\App\Utility\Files::setInstance(new \Magento\Framework\App\Utility\Files(BP));
开发者ID:shabbirvividads,项目名称:magento2,代码行数:8,代码来源:bootstrap.php

示例4: md5

    } else {
        $shell = new \Magento\Framework\Shell(new \Magento\Framework\Shell\CommandRenderer());
    }
    $installConfigFile = $settings->getAsConfigFile('TESTS_INSTALL_CONFIG_FILE');
    if (!file_exists($installConfigFile)) {
        $installConfigFile .= '.dist';
    }
    $globalConfigFile = $settings->getAsConfigFile('TESTS_GLOBAL_CONFIG_FILE');
    if (!file_exists($globalConfigFile)) {
        $globalConfigFile .= '.dist';
    }
    $sandboxUniqueId = md5(sha1_file($installConfigFile));
    $installDir = TESTS_TEMP_DIR . "/sandbox-{$settings->get('TESTS_PARALLEL_THREAD', 0)}-{$sandboxUniqueId}";
    $application = new \Magento\TestFramework\Application($shell, $installDir, $installConfigFile, $globalConfigFile, $settings->get('TESTS_GLOBAL_CONFIG_DIR'), $settings->get('TESTS_MAGENTO_MODE'), AutoloaderRegistry::getAutoloader(), true);
    $bootstrap = new \Magento\TestFramework\Bootstrap($settings, new \Magento\TestFramework\Bootstrap\Environment(), new \Magento\TestFramework\Bootstrap\DocBlock("{$testsBaseDir}/testsuite"), new \Magento\TestFramework\Bootstrap\Profiler(new \Magento\Framework\Profiler\Driver\Standard()), $shell, $application, new \Magento\TestFramework\Bootstrap\MemoryFactory($shell));
    $bootstrap->runBootstrap();
    if ($settings->getAsBoolean('TESTS_CLEANUP')) {
        $application->cleanup();
    }
    if (!$application->isInstalled()) {
        $application->install();
    }
    $application->initialize([]);
    \Magento\TestFramework\Helper\Bootstrap::setInstance(new \Magento\TestFramework\Helper\Bootstrap($bootstrap));
    \Magento\Framework\App\Utility\Files::setInstance(new Magento\Framework\App\Utility\Files($magentoBaseDir));
    /* Unset declared global variables to release the PHPUnit from maintaining their values between tests */
    unset($testsBaseDir, $magentoBaseDir, $logWriter, $settings, $shell, $application, $bootstrap);
} catch (\Exception $e) {
    echo $e . PHP_EOL;
    exit(1);
}
开发者ID:nja78,项目名称:magento2,代码行数:31,代码来源:bootstrap.php

示例5: foreach

}
foreach ($files as $file) {
    include $file;
}
/* Bootstrap the application */
$settings = new \Magento\TestFramework\Bootstrap\Settings($testsBaseDir, get_defined_constants());
$shell = new \Magento\Framework\Shell(new \Magento\Framework\Shell\CommandRenderer(), $logger);
$installConfigFile = $settings->getAsConfigFile('TESTS_INSTALL_CONFIG_FILE');
if (!file_exists($installConfigFile)) {
    $installConfigFile = $installConfigFile . '.dist';
}
$globalConfigFile = $settings->getAsConfigFile('TESTS_GLOBAL_CONFIG_FILE');
if (!file_exists($installConfigFile)) {
    $installConfigFile = $installConfigFile . '.dist';
}
$dirList = new \Magento\Framework\App\Filesystem\DirectoryList(BP);
$application = new \Magento\TestFramework\WebApiApplication($shell, $dirList->getPath(DirectoryList::VAR_DIR), $installConfigFile, $globalConfigFile, BP . '/app/etc/', $settings->get('TESTS_MAGENTO_MODE'), AutoloaderRegistry::getAutoloader());
if (defined('TESTS_MAGENTO_INSTALLATION') && TESTS_MAGENTO_INSTALLATION === 'enabled') {
    if (defined('TESTS_CLEANUP') && TESTS_CLEANUP === 'enabled') {
        $application->cleanup();
    }
    $application->install();
}
$bootstrap = new \Magento\TestFramework\Bootstrap($settings, new \Magento\TestFramework\Bootstrap\Environment(), new \Magento\TestFramework\Bootstrap\WebapiDocBlock("{$integrationTestsDir}/testsuite"), new \Magento\TestFramework\Bootstrap\Profiler(new \Magento\Framework\Profiler\Driver\Standard()), $shell, $application, new \Magento\TestFramework\Bootstrap\MemoryFactory($shell));
$bootstrap->runBootstrap();
$application->initialize();
\Magento\TestFramework\Helper\Bootstrap::setInstance(new \Magento\TestFramework\Helper\Bootstrap($bootstrap));
$dirSearch = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\\Framework\\Component\\DirSearch');
$themePackageList = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\\Framework\\View\\Design\\Theme\\ThemePackageList');
\Magento\Framework\App\Utility\Files::setInstance(new \Magento\Framework\App\Utility\Files(new \Magento\Framework\Component\ComponentRegistrar(), $dirSearch, $themePackageList));
unset($bootstrap, $application, $settings, $shell);
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:31,代码来源:bootstrap.php

示例6: fwrite

<?php

/**
 * Copyright © 2015 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
require_once __DIR__ . '/bootstrap.php';
use Magento\Framework\App\Utility\Files;
use Magento\Tools\Dependency\ServiceLocator;
try {
    $console = new \Zend_Console_Getopt(['directory|d=s' => 'Path to base directory for parsing']);
    $console->parse();
    $directory = $console->getOption('directory') ?: BP;
    Files::setInstance(new \Magento\Framework\App\Utility\Files($directory));
    $filesForParse = Files::init()->getComposerFiles('code', false);
    ServiceLocator::getCircularDependenciesReportBuilder()->build(['parse' => ['files_for_parse' => $filesForParse], 'write' => ['report_filename' => 'modules-circular-dependencies.csv']]);
    fwrite(STDOUT, PHP_EOL . 'Report successfully processed.' . PHP_EOL);
} catch (\Zend_Console_Getopt_Exception $e) {
    fwrite(STDERR, $e->getUsageMessage() . PHP_EOL);
    exit(1);
} catch (\Exception $e) {
    fwrite(STDERR, 'Please, check passed path. Dependencies report generator failed: ' . $e->getMessage() . PHP_EOL);
    exit(1);
}
开发者ID:shabbirvividads,项目名称:magento2,代码行数:24,代码来源:modules-circular-dependencies.php

示例7: tearDownAfterClass

 public static function tearDownAfterClass()
 {
     Files::setInstance();
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:4,代码来源:FilesTest.php

示例8: Application

        $application = new Application($shell, $installDir, $installConfigFile, $globalConfigFile, $settings->get('TESTS_GLOBAL_CONFIG_DIR'), $settings->get('TESTS_MAGENTO_MODE'), AutoloaderRegistry::getAutoloader());
        // Create a bootstrapper which will do most of the work of setting up the
        // M2 environment for the application to run.
        $bootstrap = new Bootstrap($settings, new Environment(), new BehatDocBlock("{$testsBaseDir}/testsuite"), new Profiler(new StandardProfilerDriver()), $shell, $application, new MemoryFactory($shell));
        // Setup for environment HTTP and session emulation, profiling, memory
        // limits, and event registration (through a somewhat dubious side-effect
        // of DocBlock annotation registration).
        $bootstrap->runBootstrap();
        // cleanup and install ensure the M2 environment is clean before running
        // tests - uninstalls M2 and then reinstalls it using the test configuration.
        // @TODO This may need to be extended to also include any initial data needed
        // for the tests.
        if ($settings->getAsBoolean('TESTS_CLEANUP')) {
            $application->cleanup();
        }
        if (!$application->isInstalled()) {
            $application->install();
        }
        // Initialize the application. Largely responsible for setting up the
        // object manager instance - including updating relevant configuration for
        // the object manager to use test configuration - and replacing some
        // dependencies from the core Magento framework with alternatives from the
        // test framework.
        $application->initialize();
        BootstrapHelper::setInstance(new BootstrapHelper($bootstrap));
        AppFilesUtility::setInstance(new AppFilesUtility($magentoBaseDir));
    } catch (\Exception $e) {
        echo $e . PHP_EOL;
        exit(1);
    }
});
开发者ID:eBayEnterprise,项目名称:magento2-retail-order-management,代码行数:31,代码来源:bootstrap.php

示例9: tearDown

 protected function tearDown()
 {
     Files::setInstance();
 }
开发者ID:tingyeeh,项目名称:magento2,代码行数:4,代码来源:FilesTest.php

示例10:

<?php

/**
 * Copyright © 2015 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
require __DIR__ . '/autoload.php';
\Magento\Framework\App\Utility\Files::setInstance(new \Magento\Framework\App\Utility\Files(realpath('../..')));
error_reporting(E_ALL);
ini_set('display_errors', 1);
开发者ID:okite11,项目名称:frames21,代码行数:10,代码来源:bootstrap.php


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