forked from inetprocess/libsugarcrm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBeanFactoryCacheTest.php
35 lines (29 loc) · 1.04 KB
/
BeanFactoryCacheTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
namespace Inet\SugarCRM\Tests;
use Inet\SugarCRM\EntryPoint;
use Inet\SugarCRM\DB;
use Inet\SugarCRM\Bean;
use Inet\SugarCRM\BeanFactoryCache;
class BeanFactoryCacheTest extends SugarTestCase
{
public function testRightInstanciation()
{
// first load a bean
$entryPoint = $this->getEntryPointInstance();
// My beans are empty: I have never loaded anything
BeanFactoryCache::clearCache();
$loadedBeans = BeanFactoryCache::getLoadedBeans();
$this->assertEmpty($loadedBeans);
$DBTest = new DBTest();
$sugarDB = $DBTest->rightInstanciation();
$sugarBean = new Bean($entryPoint, $sugarDB);
$sugarBean->getBean('Users', 1, array(), true, true);
// Now it contains something
$loadedBeans = BeanFactoryCache::getLoadedBeans();
$this->assertNotEmpty($loadedBeans);
// Now it's empty again
BeanFactoryCache::clearCache();
$loadedBeans = BeanFactoryCache::getLoadedBeans();
$this->assertEmpty($loadedBeans);
}
}