14 use Symfony\Component\Console\Input\ArrayInput;
15 use Symfony\Component\Console\Output\OutputInterface;
56 private $fixturesByNames = [];
85 $this->reindexCommand = $reindexCommand;
96 $input =
new ArrayInput([]);
97 $this->reindexCommand->run($input,
$output);
106 public function loadFixtures()
108 $files = glob(
__DIR__ . DIRECTORY_SEPARATOR . self::FIXTURE_PATTERN, GLOB_NOSORT);
110 foreach (
$files as $file) {
111 $file = basename($file,
'.php');
113 $type =
'Magento\Setup\Fixtures' .
'\\' . $file;
117 'fixtureModel' => $this,
121 if (isset($this->fixtures[$fixture->getPriority()])) {
122 throw new \InvalidArgumentException(
123 sprintf(
'Duplicate priority %d in fixture %s', $fixture->getPriority(),
$type)
127 if ($fixture->getPriority() >= 0) {
128 $this->fixtures[$fixture->getPriority()] = $fixture;
131 $this->fixturesByNames[get_class($fixture)] = $fixture;
134 ksort($this->fixtures);
167 if (!array_key_exists(
$name, $this->fixturesByNames)) {
168 throw new Exception(
'Wrong fixture name');
171 return $this->fixturesByNames[
$name];
181 if (!$this->objectManager) {
187 $this->objectManager->get(\
Magento\Framework\
App\State::class)->setAreaCode(self::AREA_CODE);
207 $diConfiguration = $this->
getValue(
'di');
208 if (file_exists($diConfiguration)) {
209 $dom = new \DOMDocument();
210 $dom->load($diConfiguration);
212 $objectManger->configure(
219 $objectManger->get(\
Magento\Framework\
Config\ScopeInterface::class)
220 ->setCurrentScope($area);
238 private function getConfig()
240 if (
null === $this->config) {
244 return $this->config;
257 return $this->getConfig()->loadConfig($filename);
270 return $this->getConfig()->getValue($key, $default);
defined('TESTS_BP')||define('TESTS_BP' __DIR__
getValue($key, $default=null)
__construct(IndexerReindexCommand $reindexCommand, $initArguments=[])
reindex(OutputInterface $output)
initObjectManager($area=self::AREA_CODE)
static createObjectManagerFactory($rootDir, array $initParams)
foreach($appDirs as $dir) $files
if(!isset($_GET['name'])) $name