]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - tests/include/utils/SugarVersionTest.php
Added unit tests.
[Github/sugarcrm.git] / tests / include / utils / SugarVersionTest.php
1 <?php
2 require_once 'include/utils.php';
3
4 class SugarVersionTest extends Sugar_PHPUnit_Framework_TestCase
5 {
6         /**
7      * @dataProvider providerVersionStatus
8      */
9         public function testVersionStatus(
10         $version, 
11         $expectedResult
12         )
13     {
14                 $returnedStatus = getVersionStatus($version);
15                 $this->assertEquals($returnedStatus,$expectedResult,
16             "{$returnedStatus} status did not match expected status of {$expectedResult}");
17         }
18         
19         public function providerVersionStatus()
20         {
21                 return array(
22             array('5.5.0RC1','RC'),
23             array('5.5.0RC','RC'),
24             array('5.5.0','GA'),
25             array('5.5.0Beta','BETA'),
26             array('5.5.0BEta1','BETA'),
27             array('5.2','GA'),
28             array('5.2RC2','RC'),
29         );
30     }
31     
32         /**
33      * @dataProvider providerVersionMajorMinor
34      */
35         public function testVersionMajorMinor(
36             $version, 
37             $expectedResult
38             )
39         {
40                 $returnedVersion = getMajorMinorVersion($version);
41                 $this->assertEquals($returnedVersion,$expectedResult,
42             "{$returnedVersion} MajorMinor version did not match expected version of {$expectedResult}");
43         }
44         
45         public function providerVersionMajorMinor()
46         {
47                 return array(
48             array('5.5.0RC1','5.5'),
49             array('5.5.1RC','5.5.1'),
50             array('5.0','5.0'),
51             array('5.0Beta','5.0'),
52             array('5.5.1RC','5.5.1'),
53         );
54     }
55 }