Commit 49fdb302 authored by totten's avatar totten
Browse files

Don't run autoconvert if installing on a headless DB

parent 7b71ea3a
......@@ -46,6 +46,9 @@ class CRM_Mosaicomsgtpl_Upgrader extends CRM_Mosaicomsgtpl_Upgrader_Base {
*/
public function enable() {
// CRM_Core_DAO::executeQuery('UPDATE foo SET is_active = 1 WHERE bar = "whiz"');
if (Civi::settings()->get('mosaicomsgtpl_suspend')) {
return;
}
civicrm_api3('Job', 'mosaico_msg_sync', array());
}
......
......@@ -6,6 +6,9 @@ use CRM_Mosaicomsgtpl_ExtensionUtil as E;
function mosaico_civicrm_post($op, $objectName, $objectId, &$objectRef = NULL) {
if (($op === 'create' || $op === 'edit') && $objectName === 'MosaicoTemplate') {
if (Civi::settings()->get('mosaicomsgtpl_suspend')) {
return;
}
civicrm_api3('Job', 'mosaico_msg_sync', array(
'id' => $objectId,
));
......
......@@ -3,6 +3,7 @@
use Civi\Test\HeadlessInterface;
use Civi\Test\HookInterface;
use Civi\Test\TransactionalInterface;
use CRM_Mosaicomsgtpl_ExtensionUtil as E;
/**
* Job.mosaico_msg_sync API Test Case
......@@ -17,8 +18,7 @@ class api_v3_Job_MosaicoMsgSyncTest extends \PHPUnit_Framework_TestCase implemen
*/
public function setUpHeadless() {
return \Civi\Test::headless()
->installMe(__DIR__)
->install(array('uk.co.vedaconsulting.mosaico'))
->install(array('uk.co.vedaconsulting.mosaico', 'org.civicrm.mosaicomsgtpl'))
->apply();
}
......@@ -41,6 +41,8 @@ class api_v3_Job_MosaicoMsgSyncTest extends \PHPUnit_Framework_TestCase implemen
* Synchronize all msg templates.
*/
public function testUpdateAll() {
$this->assertEquals('MosaicoTemplate', CRM_Core_DAO_AllCoreTables::getBriefName('CRM_Mosaico_DAO_MosaicoTemplate'));
$myHtml = '<p>placeholder</p>';
$first = $this->createMosaicoTemplate(array('title' => 'First example', 'html' => $myHtml));
$second = $this->createMosaicoTemplate(array('title' => 'Second example', 'html' => $myHtml));
......@@ -68,6 +70,8 @@ class api_v3_Job_MosaicoMsgSyncTest extends \PHPUnit_Framework_TestCase implemen
* Synchronize one msg templates.
*/
public function testUpdateOne() {
$this->assertEquals('MosaicoTemplate', CRM_Core_DAO_AllCoreTables::getBriefName('CRM_Mosaico_DAO_MosaicoTemplate'));
$first = $this->createMosaicoTemplate(array('title' => 'First example'));
$second = $this->createMosaicoTemplate(array('title' => 'Second example'));
......
......@@ -2,6 +2,9 @@
ini_set('memory_limit', '2G');
ini_set('safe_mode', 0);
define('CIVICRM_TEST', 1);
global $civicrm_setting;
$civicrm_setting['domain']['mosaicomsgtpl_suspend'] = 1;
eval(cv('php:boot --level=classloader', 'phpcode'));
// Allow autoloading of PHPUnit helper classes in this extension.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment