Merge branch '5.11' of https://github.com/civicrm/civicrm-core
[civicrm-core.git] / tests / phpunit / api / v3 / ConstantTest.php
index ece88d4c7ac7d92299caafbcee477c7484fbbd9f..55fe91a72e66151a2a179cbc39f1e7f489961e7a 100644 (file)
  *   <http://www.gnu.org/licenses/>.
  */
 
-/**
- *  Include class definitions
- */
-require_once 'CiviTest/CiviUnitTestCase.php';
-
 /**
  *  Test APIv3 civicrm_activity_* functions
  *
  * @package CiviCRM_APIv3
  * @subpackage API_Constant
+ * @group headless
  */
 class api_v3_ConstantTest 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
@@ -56,7 +52,7 @@ class api_v3_ConstantTest extends CiviUnitTestCase {
   }
 
   /**
-   *  Test civicrm_constant_get( ) for unknown constant
+   * Test civicrm_constant_get( ) for unknown constant
    */
   public function testUnknownConstant() {
     $result = $this->callAPIFailure('constant', 'get', array(
@@ -65,7 +61,7 @@ class api_v3_ConstantTest extends CiviUnitTestCase {
   }
 
   /**
-   *  Test civicrm_constant_get( 'activityStatus' )
+   * Test civicrm_constant_get( 'activityStatus' )
    */
   public function testActivityStatus() {
 
@@ -81,21 +77,18 @@ class api_v3_ConstantTest extends CiviUnitTestCase {
   }
 
   /**
-   *  Test civicrm_constant_get( 'activityType' )
+   * Test civicrm_constant_get( 'activityType' )
    */
   public function testActivityType() {
-
-    $parameters = array(TRUE, FALSE, TRUE);
-
-    $result = $this->callAPISuccess('constant', 'get', array(
+    $result = $this->callAPIAndDocument('constant', 'get', array(
       'name' => 'activityType',
-    ));
+    ), __FUNCTION__, __FILE__, NULL, NULL, 'get');
     $this->assertTrue($result['count'] > 2, "In line " . __LINE__);
     $this->assertContains('Meeting', $result['values'], "In line " . __LINE__);
   }
 
   /**
-   *  Test civicrm_address_getoptions( 'location_type_id' )
+   * Test civicrm_address_getoptions( 'location_type_id' )
    */
   public function testLocationTypeGet() {
     // needed to get rid of cached values from previous tests
@@ -113,13 +106,13 @@ class api_v3_ConstantTest extends CiviUnitTestCase {
   }
 
   /**
-   *  Test civicrm_phone_getoptions( 'phone_type_id' )
+   * Test civicrm_phone_getoptions( 'phone_type_id' )
    */
   public function testPhoneType() {
     $params = array(
       'field' => 'phone_type_id',
     );
-    $result = $this->callAPISuccess('phone', 'getoptions', $params);
+    $result = $this->callAPIAndDocument('phone', 'getoptions', $params, __FUNCTION__, __FILE__);
 
     $this->assertEquals(5, $result['count'], "In line " . __LINE__);
     $this->assertContains('Phone', $result['values'], "In line " . __LINE__);
@@ -130,13 +123,13 @@ class api_v3_ConstantTest extends CiviUnitTestCase {
   }
 
   /**
-   *  Test civicrm_constant_get( 'mailProtocol' )
+   * Test civicrm_constant_get( 'mailProtocol' )
    */
   public function testmailProtocol() {
     $params = array(
       'field' => 'protocol',
     );
-    $result = $this->callAPISuccess('mail_settings', 'getoptions', $params);
+    $result = $this->callAPIAndDocument('mail_settings', 'getoptions', $params, __FUNCTION__, __FILE__);
 
     $this->assertEquals(4, $result['count'], "In line " . __LINE__);
     $this->assertContains('IMAP', $result['values'], "In line " . __LINE__);