Author: Thomas Müller (t_mueller_stolzenhain@yahoo.de)
 /**
  * runs before the build
  *
  * @param array       $fields
  * @param string|null $file
  * @param string      $format
  *
  * @return \Browscap\Generator\BuildCustomFileGenerator
  */
 protected function preBuild($fields = [], $file = null, $format = self::OUTPUT_FORMAT_PHP)
 {
     parent::preBuild();
     $this->getLogger()->info('started creating the custom output file');
     if (null === $this->collectionCreator) {
         $this->setCollectionCreator(new CollectionCreator());
     }
     if (null === $this->writerCollection) {
         $factory = new Writer\Factory\CustomWriterFactory();
         $this->setWriterCollection($factory->createCollection($this->getLogger(), $this->buildFolder, $file, $fields, $format));
     }
     return $this;
 }
 /**
  * tests creating a writer collection
  *
  * @group writer
  * @group sourcetest
  */
 public function testCreateCollection()
 {
     $logger = $this->createMock(\Monolog\Logger::class);
     $dir = vfsStream::url(self::STORAGE_DIR);
     self::assertInstanceOf(\Browscap\Writer\WriterCollection::class, $this->object->createCollection($logger, $dir));
 }
 /**
  * tests creating a writer collection
  *
  * @group writer
  * @group sourcetest
  */
 public function testCreateCollection()
 {
     $mockLogger = $this->getMock('\\Monolog\\Logger', array(), array(), '', false);
     $dir = vfsStream::url(self::STORAGE_DIR);
     self::assertInstanceOf('\\Browscap\\Writer\\WriterCollection', $this->object->createCollection($mockLogger, $dir));
 }