1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace SugarAPI\SDK\Tests\Helpers; |
4
|
|
|
|
5
|
|
|
|
6
|
|
|
use SugarAPI\SDK\Helpers\Helpers; |
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* Class HelpersTest |
10
|
|
|
* @package SugarAPI\SDK\Tests\Helpers |
11
|
|
|
* @coversDefaultClass SugarAPI\SDK\Helpers\Helpers |
12
|
|
|
*/ |
13
|
|
|
class HelpersTest extends \PHPUnit_Framework_TestCase { |
14
|
|
|
|
15
|
|
|
public static function setUpBeforeClass() |
16
|
|
|
{ |
17
|
|
|
} |
18
|
|
|
|
19
|
|
|
public static function tearDownAfterClass() |
20
|
|
|
{ |
21
|
|
|
} |
22
|
|
|
|
23
|
|
|
public function setUp() |
24
|
|
|
{ |
25
|
|
|
parent::setUp(); |
26
|
|
|
} |
27
|
|
|
|
28
|
|
|
public function tearDown() |
29
|
|
|
{ |
30
|
|
|
parent::tearDown(); |
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @test |
35
|
|
|
* @covers ::configureAPIURL |
36
|
|
|
* @group default |
37
|
|
|
*/ |
38
|
|
|
public function testConfigureAPIUrl() |
39
|
|
|
{ |
40
|
|
|
$this->assertEquals('http://localhost/rest/v10/',Helpers::configureAPIURL('localhost')); |
41
|
|
|
$this->assertEquals('https://localhost/rest/v10/',Helpers::configureAPIURL('https://localhost')); |
42
|
|
|
$this->assertEquals('http://localhost/rest/v10/',Helpers::configureAPIURL('localhost/rest/v10')); |
43
|
|
|
$this->assertEquals('http://localhost/rest/v10/',Helpers::configureAPIURL('localhost/rest/v10/')); |
44
|
|
|
$this->assertEquals('http://localhost/rest/v10/',Helpers::configureAPIURL('http://localhost/rest/v10/')); |
45
|
|
|
$this->assertEquals('http://localhost/rest/v10/',Helpers::configureAPIURL('http://localhost/')); |
46
|
|
|
$this->assertEquals('https://localhost/rest/v10/',Helpers::configureAPIURL('https://localhost/rest/v10')); |
47
|
|
|
$this->assertEquals('https://localhost/rest/v10/',Helpers::configureAPIURL('https://localhost/rest/v10/')); |
48
|
|
|
$this->assertEquals('http://localhost/rest/v10/',Helpers::configureAPIURL('http://localhost/rest/v10/rest/v10/rest/v10')); |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* @test |
53
|
|
|
* @covers ::getSDKVersion |
54
|
|
|
* @group default |
55
|
|
|
*/ |
56
|
|
|
public function testGetSDKVersion() |
57
|
|
|
{ |
58
|
|
|
$this->assertEquals('1.0',Helpers::getSDKVersion()); |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* @test |
63
|
|
|
* @covers ::getSDKEntryPointRegistry |
64
|
|
|
* @group default |
65
|
|
|
*/ |
66
|
|
|
public function testGetSDKEntryPointRegistry(){ |
67
|
|
|
$this->assertNotEmpty(Helpers::getSDKEntryPointRegistry()); |
68
|
|
|
} |
69
|
|
|
} |
70
|
|
|
|