3 require_once 'CiviTest/CiviUnitTestCase.php';
6 * Class CRM_Utils_SystemTest
8 class CRM_Utils_SystemTest
extends CiviUnitTestCase
{
10 public function setUp() {
14 public function testUrlQueryString() {
15 $config = CRM_Core_Config
::singleton();
16 $this->assertTrue($config->userSystem
instanceof CRM_Utils_System_UnitTests
);
17 $expected = '/index.php?q=civicrm/foo/bar&foo=ab&bar=cd%26ef';
18 $actual = CRM_Utils_System
::url('civicrm/foo/bar', 'foo=ab&bar=cd%26ef', FALSE, NULL, FALSE);
19 $this->assertEquals($expected, $actual);
22 public function testUrlQueryArray() {
23 $config = CRM_Core_Config
::singleton();
24 $this->assertTrue($config->userSystem
instanceof CRM_Utils_System_UnitTests
);
25 $expected = '/index.php?q=civicrm/foo/bar&foo=ab&bar=cd%26ef';
26 $actual = CRM_Utils_System
::url('civicrm/foo/bar', array(
29 ), FALSE, NULL, FALSE);
30 $this->assertEquals($expected, $actual);
33 public function testEvalUrl() {
34 $this->assertEquals(FALSE, CRM_Utils_System
::evalUrl(FALSE));
35 $this->assertEquals('http://example.com/', CRM_Utils_System
::evalUrl('http://example.com/'));
36 $this->assertEquals('http://example.com/?cms=UnitTests', CRM_Utils_System
::evalUrl('http://example.com/?cms={uf}'));