Merge remote-tracking branch 'upstream/4.6' into 4.6-master-2015-08-12-15-44-44
[civicrm-core.git] / tests / phpunit / CRM / Core / ManagedEntitiesTest.php
index 71383b04bb7eb3f9d040ee01d7e61ca45fa69904..2f38ee2d903cbefe97ab6184b429560009b792c1 100644 (file)
@@ -24,13 +24,15 @@ class CRM_Core_ManagedEntitiesTest extends CiviUnitTestCase {
   protected $fixtures;
 
   public function setUp() {
+    $this->useTransaction(TRUE);
     parent::setUp();
     $this->modules = array(
       'one' => new CRM_Core_Module('com.example.one', TRUE),
       'two' => new CRM_Core_Module('com.example.two', TRUE),
     );
-    $this->assertDBQuery(0, 'SELECT count(*) FROM civicrm_managed');
-    $this->assertDBQuery(0, 'SELECT count(*) FROM civicrm_option_value WHERE name like "CRM_Example_%"');
+
+    // Testing on drupal-demo fails because some extensions have mgd ents.
+    CRM_Core_DAO::singleValueQuery('DELETE FROM civicrm_managed');
 
     $this->fixtures['com.example.one-foo'] = array(
       'module' => 'com.example.one',
@@ -60,8 +62,6 @@ class CRM_Core_ManagedEntitiesTest extends CiviUnitTestCase {
 
   public function tearDown() {
     parent::tearDown();
-    CRM_Core_DAO::singleValueQuery('DELETE FROM civicrm_managed');
-    CRM_Core_DAO::singleValueQuery('DELETE FROM civicrm_option_value WHERE name like "CRM_Example_%"');
     \Civi\Core\Container::singleton(TRUE);
   }
 
@@ -377,7 +377,7 @@ class CRM_Core_ManagedEntitiesTest extends CiviUnitTestCase {
     $this->assertEquals('CRM_Example_One_Foo', $foo['name']);
     $this->assertDBQuery(1, 'SELECT count(*) FROM civicrm_option_value WHERE name = "CRM_Example_One_Foo"');
 
-    // then destory module; note that decls go away
+    // then destroy module; note that decls go away
     unset($this->modules['one']);
     $me = new CRM_Core_ManagedEntities($this->modules, array());
     $me->reconcile();