Write the Dusk PHPUnit configuration.

@return void
187664
protected function writeConfiguration()
    {
        if (! file_exists($file = base_path('phpunit.dusk.xml')) &&
            ! file_exists(base_path('phpunit.dusk.xml.dist'))) {
            copy(realpath(__DIR__.'/../../stubs/phpunit.xml'), $file);

            return;
        }

        $this->hasPhpUnitConfiguration = true;
    }
879392
public function compile()
  {
    if (!$this->enabled || $this->env !== "dev") {
      return;
    }
    foreach ($this->watchers as $name => $watcher) {
      if (isset($this->configs[$name])) {
        foreach ($this->configs[$name] as $configPath) {
          $files = $watcher->getChildren($configPath);
          if ($this->cache->isFresh($configPath, $files)) {
            $watcher->compile($configPath);
            $this->cache->write($configPath, $files);
          }
        }
      }
    }
  }
274182
protected function configure(): void
    {
        // First command : Test the DB Connexion
        $this->setName($this->command)
            ->setDescription(
                'Validate a configuration for the Anonymizer'
            )->setHelp(
                'This command will validate that the configuration provided is valid' . PHP_EOL .
                "Usage: neuralyzer <info>{$this->command}</info> -f neuralyzer.yml"
            )->addOption(
                'file',
                'f',
                InputOption::VALUE_REQUIRED,
                'File',
                'neuralyzer.yml'
            )->addOption(
                'dump',
                'D',
                InputOption::VALUE_NONE,
                'Dump full configuration'
            );
    }
665347
public function complete()
    {
        $this->io->write('<info>Summary :</info>');
        foreach ($this->getConfigKey('Placeholders') as $placeholder) {
            $this->io->write(
                sprintf(
                    '%1$s: <info>%2$s</info>',
                    $placeholder['name'],
                    $placeholder['value']
                )
            );
        }
    }
1308425
public function init() {
    $result = $this->taskFilesystemStack()
      ->copy(
        $this->getConfigValue('blt.root') . '/scripts/blt/examples/Commands/ExampleCommands.php',
        $this->getConfigValue('repo.root') . '/blt/src/Blt/Plugin/Commands/ExampleCommands.php', FALSE)
      ->copy(
        $this->getConfigValue('blt.root') . '/scripts/blt/examples/Test/ExampleTest.php',
        $this->getConfigValue('repo.root') . '/tests/phpunit/ExampleTest.php', FALSE)
      ->copy(
        $this->getConfigValue('blt.root') . '/scripts/blt/examples/Test/Examples.feature',
        $this->getConfigValue('repo.root') . '/tests/behat/features/Examples.feature', FALSE)
      ->copy(
        $this->getConfigValue('blt.root') . '/scripts/blt/examples/Filesets.php',
        $this->getConfigValue('repo.root') . '/blt/src/Filesets.php', FALSE)
      ->stopOnFail()
      ->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERBOSE)
      ->run();

    if (!$result->wasSuccessful()) {
      throw new BltException("Could not copy example files into the repository root.");
    }

    $this->say("<info>Example commands and hooks were copied to your repository root.</info>");
  }
302617
public static function setup_real_writer_instance() {
        if (!PHPUNIT_TEST) {
            throw new coding_exception('setup_real_writer_instance() is only for use with PHPUnit tests.');
        }

        $instance = static::instance();

        if (null === $instance->realwriter) {
            $instance->realwriter = new moodle_content_writer(static::instance());
        }
    }
48118
def Write(self):
    """"""
    if self.writeback:
      self.writeback.SaveData(self.writeback_data)
    else:
      raise RuntimeError("Attempting to write a configuration without a "
                         "writeback location.")
799411
private function write()
	{
		$content = '';

		foreach ($this->getFiles() as $file)
		{
			$content .= '$this->call(\'' . str_replace('.php', '', $file) . '\');';	
		}
		
		$databaseSeeder = str_replace('{calls}', $content, $this->getPattern());

		$this->getFilesystem()->put(app_path() . '/database/seeds/DatabaseSeeder.php', $databaseSeeder);
	}
68303
private function write()
    {
        $sessionData['data'] = $this->data;
        $sessionData['flash'] = $this->newFlashData;

        // Write session data to database
        $stmt = $this->db->prepare("UPDATE {$this->tableName} SET data = ? WHERE session_id = ?");
        $stmt->execute([json_encode($sessionData), $this->sessionId]);
    }
190867
protected function doSetupDevelopmentSettings() {
    $source = __DIR__ . '/../dist/development.services.yml';
    $destination = $this->getSitesDirectory() . '/development.services.yml';
    $this->write('Make sure that Twig cache is disabled in <comment>%s</comment>', $this->shortenDirectory($destination));
    copy($source, $destination);

    $destination = $this->getDefaultDirectory() . '/default.settings.php';
    $content = file_get_contents($destination);
    $ignore_directory_setting = sprintf('$settings[\'file_scan_ignore_directories\'][] = \'%s\';', $this->getBuildRoot());
    if (strstr($content, $ignore_directory_setting) === FALSE) {
      file_put_contents($destination, $ignore_directory_setting . PHP_EOL, FILE_APPEND);
    }
    $this->write('Add build directory to list of ignored paths in <comment>%s</comment>.', $this->shortenDirectory($destination));

    $destination = $this->getDefaultDirectory() . '/settings.local.php';
    $source = $this->getSitesDirectory() . '/example.settings.local.php';
    $content = file_get_contents($source);
    $content = str_replace('# $settings[\'cache\'][\'bins\']', '$settings[\'cache\'][\'bins\']', $content);
    file_put_contents($destination, $content);
    $this->write('Setup local development settings at <comment>%s</comment>.', $this->shortenDirectory($destination));
    $this->write('Note: local development settings file is disabled by default, enable it by un-commenting related lines in your settings.php file.');
  }
623788
private function _warmup()
    {
        $warmup = new Test('warmup', function () {
        });

        $this->_overhead = $warmup->runTest($this->_count);

        // One call each method for init (warmup)

        /** @var Test $test */
        foreach ($this->_tests as $test) {
            $test->runTest(1);
        }

        $this->out(
            'PHP Overhead: ' .
            'time=' . Timer::formatMS($this->_overhead['time']) . '; ' .
            'memory=' . FS::format($this->_overhead['memory'], 2) . ';' .
            PHP_EOL
        );
    }
653311
public function init()
    {
        $testConfig = $this->getTestConfig();

        $this->cleanUpExceptionLogFile();
        $this->prepareShop();
        $this->setGlobalConstants();

        if ($testConfig->shouldRestoreShopAfterTestsSuite()) {
            $this->registerResetDbAfterSuite();
        }

        if ($testConfig->shouldInstallShop()) {
            $this->installShop();
        }

        /** @var \OxidEsales\Eshop\Core\Config $config */
        $config = oxNew(\OxidEsales\Eshop\Core\Config::class);
        \OxidEsales\Eshop\Core\Registry::set(\OxidEsales\Eshop\Core\Config::class, $config);

        $config->init();
    }
1073364
public function bootstrap()
    {
        if (!$this->booted) {
            $config = load($this->path.'/config/app.php');
            $this->name = $config['name'];

            date_default_timezone_set(isset($config['timezone']) ? $config['timezone'] : 'UTC');

            $this->add('config', new Config($config));
            $this->add('logger', new Logger($this->name));

            $this->registerExceptionHandler();
            $this->registerServicesProviders($config['services']);

            unset($config);
            $this->booted = true;
        }
    }
41758
public static function configure(IOInterface $io, PhpUnit $phpUnit)
    {
        /** @var PhpUnit $phpUnit */
        if (true === $phpUnit->isUndefined()) {
            $answer = $io->ask(HookQuestions::PHPUNIT_TOOL, HookQuestions::DEFAULT_TOOL_ANSWER);

            $phpUnit = $phpUnit->setEnabled(new Enabled(HookQuestions::DEFAULT_TOOL_ANSWER === strtoupper($answer)));

            if (true === $phpUnit->isEnabled()) {
                $randomAnswer = $io->ask(HookQuestions::PHPUNIT_RANDOM_MODE, HookQuestions::DEFAULT_TOOL_ANSWER);
                $optionsAnswer = $io->ask(HookQuestions::PHPUNIT_OPTIONS, null);

                $randomMode = new PhpUnitRandomMode(HookQuestions::DEFAULT_TOOL_ANSWER === strtoupper($randomAnswer));
                $options = new PhpUnitOptions($optionsAnswer);

                $phpUnit = $phpUnit->setRandomModeAndOptions($randomMode, $options);
            }
        }

        return $phpUnit;
    }
897902
function writeBaseConfiguration()
    {
        if (! $this->files->exists($this->path())) {
            $this->write(['tld' => 'test', 'paths' => []]);
        }

        /**
         * Migrate old configurations from 'domain' to 'tld'
         */
        $config = $this->read();

        if (isset($config['tld'])) {
            return;
        }

        $this->updateKey('tld', !empty($config['domain']) ? $config['domain'] : 'test');
    }
564609
public function execute()
    {
        $curdir = getcwd();
        chdir($this->phpci->buildPath);

        $phpspec = $this->phpci->findBinary(array('phpspec', 'phpspec.php'));

        $success = $this->phpci->executeCommand($phpspec . ' --format=junit --no-code-generation run');
        $output = $this->phpci->getLastOutput();

        chdir($curdir);

        /*
         * process xml output
         *
         * <testsuites time=FLOAT tests=INT failures=INT errors=INT>
         *   <testsuite name=STRING time=FLOAT tests=INT failures=INT errors=INT skipped=INT>
         *     <testcase name=STRING time=FLOAT classname=STRING status=STRING/>
         *   </testsuite>
         * </testsuites
         */

        $xml = new \SimpleXMLElement($output);
        $attr = $xml->attributes();
        $data = array(
            'time' => (float)$attr['time'],
            'tests' => (int)$attr['tests'],
            'failures' => (int)$attr['failures'],
            'errors' => (int)$attr['errors'],

            // now all the tests
            'suites' => array()
        );

        /**
         * @var \SimpleXMLElement $group
         */
        foreach ($xml->xpath('testsuite') as $group) {
            $attr = $group->attributes();
            $suite = array(
                'name' => (String)$attr['name'],
                'time' => (float)$attr['time'],
                'tests' => (int)$attr['tests'],
                'failures' => (int)$attr['failures'],
                'errors' => (int)$attr['errors'],
                'skipped' => (int)$attr['skipped'],

                // now the cases
                'cases' => array()
            );

            /**
             * @var \SimpleXMLElement $child
             */
            foreach ($group->xpath('testcase') as $child) {
                $attr = $child->attributes();
                $case = array(
                    'name' => (String)$attr['name'],
                    'classname' => (String)$attr['classname'],
                    'time' => (float)$attr['time'],
                    'status' => (String)$attr['status'],
                );

                if ($case['status']=='failed') {
                    $error = array();
                    /*
                     * ok, sad, we had an error
                     *
                     * there should be one - foreach makes this easier
                     */
                    foreach ($child->xpath('failure') as $failure) {
                        $attr = $failure->attributes();
                        $error['type'] = (String)$attr['type'];
                        $error['message'] = (String)$attr['message'];
                    }

                    foreach ($child->xpath('system-err') as $system_err) {
                        $error['raw'] = (String)$system_err;
                    }

                    $case['error'] = $error;
                }

                $suite['cases'][] = $case;
            }

            $data['suites'][] = $suite;
        }

        $this->build->storeMeta('phpspec', $data);


        return $success;
    }
131306
public function main()
    {
        $this->validate();
        $this->datetimeTaskStart = new \DateTimeImmutable();

        if ($this->describeMainStack()) {
            $this->updateStacks();
        } else {
            $this->creationStacks();
        }

        while (!$this->stackIsReady()) {
            sleep(3);
            if (empty($this->events)) {
                $this->log("Waiting for stack provisioning...");
            }
        }

        $stacks = $this->describeMainStack($e);

        if (null === $stacks) {
            throw $e;
        }

        $outputLog = '';

        if ($stacks[0]['Outputs']) {
            foreach ($stacks[0]['Outputs'] as $row) {
                $outputLog .= PHP_EOL . $row['OutputKey'] . ': ' . $row['OutputValue'];
                if ($output = $this->getOutput($row['OutputKey'])) {
                    /** @var StackOutput $output */
                    $this->project->setProperty($output->getProperty(), $row['OutputValue']);
                }
            }
        }

        $this->log($outputLog);
    }