當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。