CRM-12595 fix formatting in tests files
[civicrm-core.git] / tests / phpunit / CRM / Utils / SystemTest.php
1 <?php
2
3 require_once 'CiviTest/CiviUnitTestCase.php';
4
5 class CRM_Utils_SystemTest extends CiviUnitTestCase {
6
7 function get_info() {
8 return array(
9 'name' => 'System Test',
10 'description' => 'Test system functions',
11 'group' => 'CiviCRM BAO Tests',
12 );
13 }
14
15 function setUp() {
16 parent::setUp();
17 }
18
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);
25 }
26
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(
32 'foo' => 'ab',
33 'bar' => 'cd&ef',
34 ), false, null, false);
35 $this->assertEquals($expected, $actual);
36 }
37
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}'));
42 }
43 }