public setLogger ( Psr\Log\LoggerInterface $logger ) : Browscap\Writer\WriterInterface | ||
$logger | Psr\Log\LoggerInterface | |
리턴 | Browscap\Writer\WriterInterface |
/** * tests rendering the version information * * @group writer * @group sourcetest */ public function testRenderVersionIfNotSilentButWithoutVersion() { $mockLogger = $this->getMock('\\Monolog\\Logger', array(), array(), '', false); $this->object->setLogger($mockLogger); $version = array(); $this->object->setSilent(false); self::assertSame($this->object, $this->object->renderVersion($version)); self::assertSame(' "GJK_Browscap_Version": {' . PHP_EOL . ' "Version": "0",' . PHP_EOL . ' "Released": ""' . PHP_EOL . ' },' . PHP_EOL, file_get_contents($this->file)); }
/** * tests rendering the version information * * @group writer * @group sourcetest */ public function testRenderVersionIfNotSilentButWithoutVersion() { $logger = $this->createMock(\Monolog\Logger::class); $this->object->setLogger($logger); $version = []; $this->object->setSilent(false); self::assertSame($this->object, $this->object->renderVersion($version)); self::assertSame(' "GJK_Browscap_Version": {' . PHP_EOL . ' "Version": "0",' . PHP_EOL . ' "Released": ""' . PHP_EOL . ' },' . PHP_EOL, file_get_contents($this->file)); }
/** * @param \Psr\Log\LoggerInterface $logger * @param string $buildFolder * * @return \Browscap\Writer\WriterCollection */ public function createCollection(LoggerInterface $logger, $buildFolder) { $writerCollection = new WriterCollection(); $fullFilter = new FullFilter(); $stdFilter = new StandardFilter(); $liteFilter = new LiteFilter(); $fullAspWriter = new IniWriter($buildFolder . '/full_asp_browscap.ini'); $formatter = new AspFormatter(); $fullAspWriter->setLogger($logger)->setFormatter($formatter->setFilter($fullFilter))->setFilter($fullFilter); $writerCollection->addWriter($fullAspWriter); $fullPhpWriter = new IniWriter($buildFolder . '/full_php_browscap.ini'); $formatter = new PhpFormatter(); $fullPhpWriter->setLogger($logger)->setFormatter($formatter->setFilter($fullFilter))->setFilter($fullFilter); $writerCollection->addWriter($fullPhpWriter); $stdAspWriter = new IniWriter($buildFolder . '/browscap.ini'); $formatter = new AspFormatter(); $stdAspWriter->setLogger($logger)->setFormatter($formatter->setFilter($stdFilter))->setFilter($stdFilter); $writerCollection->addWriter($stdAspWriter); $stdPhpWriter = new IniWriter($buildFolder . '/php_browscap.ini'); $formatter = new PhpFormatter(); $stdPhpWriter->setLogger($logger)->setFormatter($formatter->setFilter($stdFilter))->setFilter($stdFilter); $writerCollection->addWriter($stdPhpWriter); $liteAspWriter = new IniWriter($buildFolder . '/lite_asp_browscap.ini'); $formatter = new AspFormatter(); $liteAspWriter->setLogger($logger)->setFormatter($formatter->setFilter($liteFilter))->setFilter($liteFilter); $writerCollection->addWriter($liteAspWriter); $litePhpWriter = new IniWriter($buildFolder . '/lite_php_browscap.ini'); $formatter = new PhpFormatter(); $litePhpWriter->setLogger($logger)->setFormatter($formatter->setFilter($liteFilter))->setFilter($liteFilter); $writerCollection->addWriter($litePhpWriter); $csvWriter = new CsvWriter($buildFolder . '/browscap.csv'); $formatter = new CsvFormatter(); $csvWriter->setLogger($logger)->setFormatter($formatter->setFilter($fullFilter))->setFilter($fullFilter); $writerCollection->addWriter($csvWriter); $xmlWriter = new XmlWriter($buildFolder . '/browscap.xml'); $formatter = new XmlFormatter(); $xmlWriter->setLogger($logger)->setFormatter($formatter->setFilter($stdFilter))->setFilter($stdFilter); $writerCollection->addWriter($xmlWriter); $jsonWriter = new JsonWriter($buildFolder . '/browscap.json'); $formatter = new JsonFormatter(); $jsonWriter->setLogger($logger)->setFormatter($formatter->setFilter($fullFilter))->setFilter($fullFilter); $writerCollection->addWriter($jsonWriter); $liteJsonWriter = new JsonWriter($buildFolder . '/lite_browscap.json'); $formatter = new JsonFormatter(); $liteJsonWriter->setLogger($logger)->setFormatter($formatter->setFilter($liteFilter))->setFilter($liteFilter); $writerCollection->addWriter($liteJsonWriter); return $writerCollection; }