Ian province abbreviation patch - issue 724
[civicrm-core.git] / tests / phpunit / CRM / Utils / SystemTest.php
CommitLineData
6a488035
TO
1<?php
2
3require_once 'CiviTest/CiviUnitTestCase.php';
4
aba1cd8b
EM
5/**
6 * Class CRM_Utils_SystemTest
7 */
6a488035
TO
8class CRM_Utils_SystemTest extends CiviUnitTestCase {
9
00be9182 10 public function setUp() {
6a488035
TO
11 parent::setUp();
12 }
13
00be9182 14 public function testUrlQueryString() {
6a488035
TO
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';
6c6e6187 18 $actual = CRM_Utils_System::url('civicrm/foo/bar', 'foo=ab&bar=cd%26ef', FALSE, NULL, FALSE);
6a488035
TO
19 $this->assertEquals($expected, $actual);
20 }
b6708aeb 21
00be9182 22 public function testUrlQueryArray() {
6a488035
TO
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(
27 'foo' => 'ab',
28 'bar' => 'cd&ef',
6c6e6187 29 ), FALSE, NULL, FALSE);
6a488035
TO
30 $this->assertEquals($expected, $actual);
31 }
efceedd4
TO
32
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}'));
37 }
96025800 38
6a488035 39}