Skip to content

Commit

Permalink
Merge pull request #2 from romanlum/feature/allow-exclamation-mark
Browse files Browse the repository at this point in the history
Change ini parser to RAW mode
  • Loading branch information
moay authored Mar 26, 2021
2 parents 85a8d30 + 92a7465 commit c53ccea
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/ConfigurationParser/ConfigurationParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function __construct(string $fileName)
if (!file_exists($fileName)) {
throw new ConfigurationException(sprintf('Configuration file %s does not exist', $fileName));
}
$this->config = new \Config_Lite($fileName);
$this->config = new \Config_Lite($fileName,null,INI_SCANNER_RAW );
}

/**
Expand Down
4 changes: 2 additions & 2 deletions tests/ConfigurationParser/ConfigurationParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ protected function setUp(): void
public function testConfigurationIsReadFromFile()
{
$configuration = new ConfigurationParser(self::TEST_CONFIG_FILE);
$this->assertEquals('test', $configuration->get('TEST1', 'test'));
$this->assertEquals('test4', $configuration->get('TEST3', 'test4'));
$this->assertEquals('\'test\'', $configuration->get('TEST1', 'test'));
$this->assertEquals('\'test4\'', $configuration->get('TEST3', 'test4'));
}

public function testConfigurationThrowsExceptionIfFileDoesNotExist()
Expand Down
10 changes: 5 additions & 5 deletions tests/ConfigurationParser/SystemConfigurationParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public function regularValues()
['BINARIES', 'REBOOT', '/sbin/reboot'],
['BINARIES', 'NTPDATE', '/usr/sbin/ntpdate'],
['BINARIES', 'AWK', '/usr/bin/awk'],
['MINISERVER1', 'PASS', 'test12345'],
['MINISERVER1', 'PASS', 'test12345!'],
['MINISERVER1', 'IPADDRESS', '192.168.0.0'],
['MINISERVER1', 'ADMIN', 'Admin'],
['MINISERVER1', 'ENCRYPTRESPONSE', null],
Expand Down Expand Up @@ -189,11 +189,11 @@ public function testLoadsMiniserverInformation()
$this->assertFalse($miniserverByName->isSecureGateway());
$this->assertFalse($miniserverByName->isUseCloudDns());
$this->assertSame('Admin', $miniserverByName->getAdminUsername());
$this->assertSame('test12345', $miniserverByName->getAdminPassword());
$this->assertSame('Admin:test12345', $miniserverByName->getCredentials());
$this->assertSame('test12345!', $miniserverByName->getAdminPassword());
$this->assertSame('Admin:test12345!', $miniserverByName->getCredentials());
$this->assertSame('Admin', $miniserverByName->getAdminUsername(true));
$this->assertSame('test12345', $miniserverByName->getAdminPassword(true));
$this->assertSame('Admin:test12345', $miniserverByName->getCredentials(true));
$this->assertSame('test12345!', $miniserverByName->getAdminPassword(true));
$this->assertSame('Admin:test12345!', $miniserverByName->getCredentials(true));
$this->assertSame('', $miniserverByName->getCloudUrl());
$this->assertEquals(80, $miniserverByName->getPort());
}
Expand Down
2 changes: 1 addition & 1 deletion tests/ConfigurationParser/resources/general.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ NTPDATE=/usr/sbin/ntpdate
AWK=/usr/bin/awk

[MINISERVER1]
PASS=test12345
PASS=test12345!
IPADDRESS=192.168.0.0
ADMIN=Admin
ENCRYPTRESPONSE=
Expand Down

0 comments on commit c53ccea

Please sign in to comment.