icingaweb2/test/php/regression/Bug11831Test.php
Eric Lippmann 662de28f85 License source files as GPL-3.0-or-later
Add SPDX license headers and mark source files as GPL-3.0-or-later to
preserve the option to relicense under later GPL versions.
2026-03-26 17:49:26 +01:00

39 lines
1.1 KiB
PHP

<?php
// SPDX-FileCopyrightText: 2018 Icinga GmbH <https://icinga.com>
// SPDX-License-Identifier: GPL-3.0-or-later
namespace Tests\Icinga\Regression;
use ReflectionClass;
use Icinga\Application\Icinga;
use Icinga\Application\Modules\Module;
use Icinga\Test\BaseTestCase;
/**
* Regression-Test for bug #11831
*
* Empty lines in module.info must be ignored if they're not part of the module's description
*
* @see https://dev.icinga.com/issues/11831
*/
class Bug11831Test extends BaseTestCase
{
public function testNewlinesInModuleInfo()
{
$moduleInfo = <<<'EOT'
version: 1.0.0
EOT;
$moduleInfoFile = tmpfile();
fwrite($moduleInfoFile, $moduleInfo);
$module = new Module(Icinga::app(), 'Bug11831', '/dev/null');
$reflection = new ReflectionClass($module);
$prop = $reflection->getProperty('metadataFile');
$meta = stream_get_meta_data($moduleInfoFile);
$prop->setValue($module, $meta['uri']);
$this->assertEquals($module->getVersion(), '1.0.0');
fclose($moduleInfoFile);
}
}