Merge pull request #7728 from andrew-cormick-dockery/CRM-17959
[civicrm-core.git] / tests / phpunit / api / v3 / DashboardTest.php
index 245de3b46aa4fe967b372c7746985ed2de4348a4..183a5584af065de03171a863b8338045a3b4c40c 100644 (file)
  *   <http://www.gnu.org/licenses/>.
  */
 
-/**
- *  Include class definitions
- */
-require_once 'CiviTest/CiviUnitTestCase.php';
-
 /**
  *  Test APIv3 civicrm_action_schedule functions
  *
  * @package CiviCRM_APIv3
  * @subpackage API_ActionSchedule
+ * @group headless
  */
-
 class api_v3_DashboardTest extends CiviUnitTestCase {
   protected $_params;
   protected $_params2;
@@ -38,30 +33,18 @@ class api_v3_DashboardTest extends CiviUnitTestCase {
   protected $_apiversion = 3;
 
   /**
-   *  Test setup for every test
+   * Test setup for every test.
    *
-   *  Connect to the database, truncate the tables that will be used
-   *  and redirect stdin to a temporary file
+   * Connect to the database, truncate the tables that will be used
+   * and redirect stdin to a temporary file
    */
   public function setUp() {
     //  Connect to the database
     parent::setUp();
+    $this->useTransaction(TRUE);
   }
 
-  /**
-   * Tears down the fixture, for example, closes a network connection.
-   * This method is called after a test is executed.
-   *
-   * @access protected
-   */
-  function tearDown() {
-    $tablesToTruncate = array(
-      'civicrm_dashboard',
-    );
-    $this->quickCleanup($tablesToTruncate, TRUE);
-  }
-
-  function testDashboardCreate() {
+  public function testDashboardCreate() {
     $oldCount = CRM_Core_DAO::singleValueQuery('select count(*) from civicrm_dashboard');
     $params = array(
       'version' => 3,
@@ -82,7 +65,7 @@ class api_v3_DashboardTest extends CiviUnitTestCase {
    * @param int $id
    * @param $oldCount
    */
-  function DashboardDelete($id, $oldCount) {
+  public function DashboardDelete($id, $oldCount) {
     $params = array(
       'version' => 3,
       'id' => $id,
@@ -93,4 +76,5 @@ class api_v3_DashboardTest extends CiviUnitTestCase {
     $newCount = CRM_Core_DAO::singleValueQuery('select count(*) from civicrm_dashboard');
     $this->assertEquals($oldCount, $newCount);
   }
+
 }