Example #1
0
 /**
  * Load the given fixture classes.
  *
  * @param array           $fixtures
  * @param mixed           $purge
  * @param mixed           $initialize
  * @param OutputInterface $output
  */
 public function execute(array $fixtures, $purge = true, $initialize = true, OutputInterface $output = null)
 {
     $output = $output ?: new NullOutput();
     if (true === $purge) {
         $output->writeln('<comment>Purging workspace</comment>');
         $this->nodeManager->purgeWorkspace();
         $this->nodeManager->save();
     }
     if (true === $initialize) {
         $output->writeln('<comment>Initializing repository</comment>');
         $this->initializer->initialize($output);
     }
     $output->writeln('<comment>Loading fixtures</comment>');
     foreach ($fixtures as $fixture) {
         $output->writeln(sprintf(' - %s<info>loading "</info>%s<info>"</info>', $fixture instanceof OrderedFixtureInterface ? '[' . $fixture->getOrder() . ']' : '', get_class($fixture)));
         $fixture->load($this->documentManager);
         $this->documentManager->clear();
     }
 }