Skip to content

Commit

Permalink
Added 2 methods related to Activities
Browse files Browse the repository at this point in the history
  • Loading branch information
Emmanuel Dyan committed Jan 26, 2016
1 parent be95c29 commit aeae6f9
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/System.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,23 @@ public function repair($executeSql = false)
return $this->messages;
}

/**
* Disable trackers in SugarCRM
*/
public function disableActivity()
{
\Activity::disable();
}

/**
* Is activity Enabled ?
* @return boolean
*/
public function isActivityEnabled()
{
return \Activity::isEnabled();
}

/**
* Taken from fayebsg/sugarcrm-cli
* Useful to clean Sugar before leaving it
Expand Down
20 changes: 20 additions & 0 deletions tests/SystemTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php
namespace Inet\SugarCRM\Tests;

use Inet\SugarCRM\EntryPoint;
use Inet\SugarCRM\DB;
use Inet\SugarCRM\System;

class SystemTest extends SugarTestCase
{
public function testRightInstanciation()
{
// first load a bean
$entryPoint = $this->getEntryPointInstance();

$system = new System($entryPoint);
$this->assertTrue($system->isActivityEnabled());
$system->disableActivity();
$this->assertFalse($system->isActivityEnabled());
}
}

0 comments on commit aeae6f9

Please sign in to comment.