3 require_once 'CiviTest/CiviUnitTestCase.php';
6 * Class CRM_Utils_SystemTest
8 class CRM_Utils_SystemTest
extends CiviUnitTestCase
{
15 'name' => 'System Test',
16 'description' => 'Test system functions',
17 'group' => 'CiviCRM BAO Tests',
25 function testUrlQueryString() {
26 $config = CRM_Core_Config
::singleton();
27 $this->assertTrue($config->userSystem
instanceof CRM_Utils_System_UnitTests
);
28 $expected = '/index.php?q=civicrm/foo/bar&foo=ab&bar=cd%26ef';
29 $actual = CRM_Utils_System
::url('civicrm/foo/bar', 'foo=ab&bar=cd%26ef', false, null, false);
30 $this->assertEquals($expected, $actual);
33 function testUrlQueryArray() {
34 $config = CRM_Core_Config
::singleton();
35 $this->assertTrue($config->userSystem
instanceof CRM_Utils_System_UnitTests
);
36 $expected = '/index.php?q=civicrm/foo/bar&foo=ab&bar=cd%26ef';
37 $actual = CRM_Utils_System
::url('civicrm/foo/bar', array(
40 ), false, null, false);
41 $this->assertEquals($expected, $actual);
44 public function testEvalUrl() {
45 $this->assertEquals(FALSE, CRM_Utils_System
::evalUrl(FALSE));
46 $this->assertEquals('http://example.com/', CRM_Utils_System
::evalUrl('http://example.com/'));
47 $this->assertEquals('http://example.com/?cms=UnitTests', CRM_Utils_System
::evalUrl('http://example.com/?cms={uf}'));