public renderVersion ( array $versionData = [] ) : Browscap\Writer\WriterInterface | ||
$versionData | array | |
리턴 | Browscap\Writer\WriterInterface |
public function renderVersion(array $versionData = [])
{
if ($this->isSilent()) {
return $this;
}
$this->getLogger()->debug('rendering version information');
fputs($this->file, '"GJK_Browscap_Version","GJK_Browscap_Version"' . PHP_EOL);
if (!isset($versionData['version'])) {
$versionData['version'] = '0';
}
if (!isset($versionData['released'])) {
$versionData['released'] = '';
}
fputs($this->file, '"' . $versionData['version'] . '","' . $versionData['released'] . '"' . PHP_EOL);
return $this;
}
/** * 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","GJK_Browscap_Version"' . PHP_EOL . '"0",""' . PHP_EOL, file_get_contents($this->file)); }