tests/phpunit/** - Remove unnecessary "require_once" statements
[civicrm-core.git] / tests / phpunit / CRM / Utils / SystemTest.php
1 <?php
2
3 /**
4 * Class CRM_Utils_SystemTest
5 */
6 class CRM_Utils_SystemTest extends CiviUnitTestCase {
7
8 public function setUp() {
9 parent::setUp();
10 }
11
12 public function testUrlQueryString() {
13 $config = CRM_Core_Config::singleton();
14 $this->assertTrue($config->userSystem instanceof CRM_Utils_System_UnitTests);
15 $expected = '/index.php?q=civicrm/foo/bar&foo=ab&bar=cd%26ef';
16 $actual = CRM_Utils_System::url('civicrm/foo/bar', 'foo=ab&bar=cd%26ef', FALSE, NULL, FALSE);
17 $this->assertEquals($expected, $actual);
18 }
19
20 public function testUrlQueryArray() {
21 $config = CRM_Core_Config::singleton();
22 $this->assertTrue($config->userSystem instanceof CRM_Utils_System_UnitTests);
23 $expected = '/index.php?q=civicrm/foo/bar&foo=ab&bar=cd%26ef';
24 $actual = CRM_Utils_System::url('civicrm/foo/bar', array(
25 'foo' => 'ab',
26 'bar' => 'cd&ef',
27 ), FALSE, NULL, FALSE);
28 $this->assertEquals($expected, $actual);
29 }
30
31 public function testEvalUrl() {
32 $this->assertEquals(FALSE, CRM_Utils_System::evalUrl(FALSE));
33 $this->assertEquals('http://example.com/', CRM_Utils_System::evalUrl('http://example.com/'));
34 $this->assertEquals('http://example.com/?cms=UnitTests', CRM_Utils_System::evalUrl('http://example.com/?cms={uf}'));
35 }
36
37 }