Merge branch 'master' into bugfix/broken-user-and-group-management-10367

This commit is contained in:
Johannes Meyer 2015-10-15 17:23:08 +02:00
commit e2e802ef96
1 changed files with 3 additions and 29 deletions

View File

@ -44,41 +44,15 @@ class MacroTest extends BaseTestCase
$this->assertEquals(Macro::resolveMacros('$service.description$', $svcMock), $svcMock->service_description); $this->assertEquals(Macro::resolveMacros('$service.description$', $svcMock), $svcMock->service_description);
} }
public function testCustomvars()
{
$objectMock = Mockery::mock('object');
$objectMock->customvars = array(
'customvar' => 'test'
);
$this->assertEquals(Macro::resolveMacros('$CUSTOMVAR$', $objectMock), $objectMock->customvars['customvar']);
}
public function testFaultyMacros() public function testFaultyMacros()
{ {
$hostMock = Mockery::mock('host'); $hostMock = Mockery::mock('host');
$hostMock->host_name = 'test'; $hostMock->host_name = 'test';
$hostMock->customvars = array( $hostMock->host = 'te';
'host' => 'te',
'name' => 'st'
);
$this->assertEquals( $this->assertEquals(
Macro::resolveMacros('$$HOSTNAME$ $ HOSTNAME$ $HOST$NAME$', $hostMock), '$test $ HOSTNAME$ teNAME$',
'$test $ HOSTNAME$ teNAME$' Macro::resolveMacros('$$HOSTNAME$ $ HOSTNAME$ $host$NAME$', $hostMock)
);
}
public function testMacrosWithSpecialCharacters()
{
$objectMock = Mockery::mock('object');
$objectMock->customvars = array(
'v€ry_sp3c|@l' => 'not too special!'
);
$this->assertEquals(
Macro::resolveMacros('$V€RY_SP3C|@L$', $objectMock),
$objectMock->customvars['v€ry_sp3c|@l']
); );
} }
} }