配列をまとめた

Co-authored-by: hina <hina@hinaloe.net>
This commit is contained in:
eai04191 2019-07-03 15:12:53 +09:00
parent a47f4537b1
commit 23f9d1a220

View File

@ -46,15 +46,16 @@ class UpdateFixture extends Command
$test_file = file_get_contents($test_file_path); $test_file = file_get_contents($test_file_path);
preg_match_all('~file_get_contents\(__DIR__ . \'/(.+)\'\);~', $test_file, $fixtures); preg_match_all('~file_get_contents\(__DIR__ . \'/(.+)\'\);~', $test_file, $fixtures);
preg_match_all('~\$this->assertSame\(\'(.+)\', \(string\) \$this->handler->getLastRequest\(\)->getUri\(\)\);~', $test_file, $urls); preg_match_all('~\$this->assertSame\(\'(.+)\', \(string\) \$this->handler->getLastRequest\(\)->getUri\(\)\);~', $test_file, $urls);
$update_list = array_combine($fixtures[1], $urls[1]);
$progress = $this->output->createProgressBar(count($fixtures[1])); $progress = $this->output->createProgressBar(count($update_list));
$progress->setFormat('Updating %file% from %url%' . PHP_EOL . '%current%/%max% [%bar%] %percent:3s%%'); $progress->setFormat('Updating %path% from %url%' . PHP_EOL . '%current%/%max% [%bar%] %percent:3s%%');
for ($i = 0; $i < count($urls[1]); $i++) { foreach ($update_list as $path => $url) {
sleep(1); sleep(1);
$progress->setMessage($fixtures[1][$i], 'file'); $progress->setMessage($path, 'path');
$progress->setMessage($urls[1][$i], 'url'); $progress->setMessage($url, 'url');
file_put_contents($resolver_base_path . $fixtures[1][$i], file_get_contents($urls[1][$i])); file_put_contents($resolver_base_path . $path, file_get_contents($url));
$progress->advance(); $progress->advance();
} }