2 require_once 'include/MVC/SugarModule.php';
4 class SugarModuleTest extends Sugar_PHPUnit_Framework_TestCase
6 public function setUp()
10 require('include/modules.php');
11 $GLOBALS['beanList'] = $beanList;
12 $GLOBALS['beanFiles'] = $beanFiles;
13 $GLOBALS['current_user'] = SugarTestUserUtilities::createAnonymousUser();
14 $GLOBALS['current_user']->is_admin = '1';
17 public function tearDown()
19 SugarTestUserUtilities::removeAllCreatedAnonymousUsers();
20 unset($GLOBALS['current_user']);
21 unset($GLOBALS['beanFiles']);
22 unset($GLOBALS['beanList']);
25 public function testLoadBean()
27 $this->assertTrue(SugarModule::get('Accounts')->loadBean() instanceOf Account);
30 public function testLoadBeanInvalidBean()
32 $this->assertFalse(SugarModule::get('JohnIsACoolGuy')->loadBean());
35 public function testModuleImpliments()
37 $this->assertTrue(SugarModule::get('Accounts')->moduleImplements('Company'));
40 public function testModuleImplimentsInvalidBean()
42 $this->assertFalse(SugarModule::get('JohnIsACoolGuy')->moduleImplements('Person'));
45 public function testModuleImplimentsWhenModuleDoesNotImplimentTemplate()
47 $this->assertFalse(SugarModule::get('Accounts')->moduleImplements('Person'));