3 require_once 'CiviTest/CiviUnitTestCase.php';
5 class CRM_Utils_SystemTest
extends CiviUnitTestCase
{
9 'name' => 'System Test',
10 'description' => 'Test system functions',
11 'group' => 'CiviCRM BAO Tests',
19 function testUrlQueryString() {
20 $config = CRM_Core_Config
::singleton();
21 $this->assertTrue($config->userSystem
instanceof CRM_Utils_System_UnitTests
);
22 $expected = '/index.php?q=civicrm/foo/bar&foo=ab&bar=cd%26ef';
23 $actual = CRM_Utils_System
::url('civicrm/foo/bar', 'foo=ab&bar=cd%26ef', false, null, false);
24 $this->assertEquals($expected, $actual);
27 function testUrlQueryArray() {
28 $config = CRM_Core_Config
::singleton();
29 $this->assertTrue($config->userSystem
instanceof CRM_Utils_System_UnitTests
);
30 $expected = '/index.php?q=civicrm/foo/bar&foo=ab&bar=cd%26ef';
31 $actual = CRM_Utils_System
::url('civicrm/foo/bar', array(
34 ), false, null, false);
35 $this->assertEquals($expected, $actual);
38 public function testEvalUrl() {
39 $this->assertEquals(FALSE, CRM_Utils_System
::evalUrl(FALSE));
40 $this->assertEquals('http://example.com/', CRM_Utils_System
::evalUrl('http://example.com/'));
41 $this->assertEquals('http://example.com/?cms=UnitTests', CRM_Utils_System
::evalUrl('http://example.com/?cms={uf}'));