]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - tests/modules/ModuleBuilder/parsers/AbstractMetaDataParserTest.php
Added unit tests.
[Github/sugarcrm.git] / tests / modules / ModuleBuilder / parsers / AbstractMetaDataParserTest.php
1 <?php
2
3 require_once("modules/ModuleBuilder/parsers/views/AbstractMetaDataParser.php");
4
5 class AbstractMetaDataParserTest extends Sugar_PHPUnit_Framework_TestCase
6 {
7         
8         public function setUp() 
9     {                       
10         
11     }
12     
13     public function tearDown() 
14     {
15        
16     }
17     
18     public function testValidField()
19     {
20         $validDef = array (
21                     'name' => 'status',
22                     'vname' => 'LBL_STATUS',
23                     'type' => 'enum',
24                     'len' => '25',
25                     'options' => 'meeting_status_dom',
26                     'comment' => 'Meeting status (ex: Planned, Held, Not held)'
27                 );
28                 
29                 $invalidDef = array (
30                     'name' => 'direction',
31                     'vname' => 'LBL_DIRECTION',
32                     'type' => 'enum',
33                     'len' => '25',
34                     'options' => 'call_direction_dom',
35                     'comment' => 'Indicates whether call is inbound or outbound',
36                     'source' => 'non-db',
37                     'importable' => 'false',
38                     'massupdate'=>false,
39                     'reportable'=>false
40                 );
41                 
42                 $this->assertTrue(AbstractMetaDataParser::validField($validDef));
43                 $this->assertFalse(AbstractMetaDataParser::validField($invalidDef));
44                 
45                 //Test the studio override property
46                 $invalidDef['studio'] = 'visible';
47                 $validDef['studio'] = false;
48                 
49                 $this->assertFalse(AbstractMetaDataParser::validField($validDef));
50         $this->assertTrue(AbstractMetaDataParser::validField($invalidDef));
51                 
52                 $invalidDef['studio'] = array('editview' => 'visible');
53         
54         $this->assertTrue(AbstractMetaDataParser::validField($invalidDef, 'editview'));
55                 $this->assertFalse(AbstractMetaDataParser::validField($invalidDef, 'detailview'));
56     }
57     
58 }