public static function setUpBeforeClass() { $testStrings = ['THEQUICKBROWNFOXJUMPSOVERTHELAZYDOG', '{人口統計画像情報|千葉県|市原市}']; self::$testString = $testStrings[rand(0, 1)]; self::$tmpStream = tmpfile(); fwrite(self::$tmpStream, self::$testString); rewind(self::$tmpStream); self::$adapter = AbstractDataAdapter::getAdapterInstance(StreamDataAdapter::NAME, null, self::$tmpStream); }
public static function setUpBeforeClass() { self::$length = rand(3, 200); self::$adapter = AbstractDataAdapter::getAdapterInstance(RandomDataAdapter::NAME, self::$length); }
/** * {@inheritDoc} */ protected function execute(InputInterface $input, OutputInterface $output) { $output->writeln(ucfirst($this->getCommandName()) . ' Sampler'); // base length only needed at random and remote. $baseLength = null; if ($this->isBaseLengthEnabled()) { $baseLength = $input->getArgument(self::ARGUMENT_BASE_LENGTH); } $dataAdapter = AbstractDataAdapter::getAdapterInstance($this->getAdapterName(), $baseLength); $sample = $this->sampler->getRandomSample($dataAdapter, $input->getArgument(self::ARGUMENT_LENGTH)); if ($output->getVerbosity() >= OutputInterface::VERBOSITY_VERY_VERBOSE) { $output->write('Random base: '); $dataAdapter->printData($output); } $output->writeln('Sample: ' . $sample); }