<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.4 |
+ | CiviCRM version 4.6 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2013 |
+ | Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
- *
- * @access protected
*/
protected function setUp() {
parent::setUp();
+ $this->useTransaction(TRUE);
CRM_Utils_Hook_UnitTests::singleton()->setHook('civicrm_apiWrappers', array($this, 'onApiWrappers'));
}
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
- *
- * @access protected
*/
protected function tearDown() {
parent::tearDown();
}
- function onApiWrappers(&$apiWrappers, $apiRequest) {
+ /**
+ * @param $apiWrappers
+ * @param $apiRequest
+ */
+ public function onApiWrappers(&$apiWrappers, $apiRequest) {
$this->assertTrue(is_string($apiRequest['entity']) && !empty($apiRequest['entity']));
$this->assertTrue(is_string($apiRequest['action']) && !empty($apiRequest['action']));
$this->assertTrue(is_array($apiRequest['params']) && !empty($apiRequest['params']));
$apiWrappers[] = new api_v3_APIWrapperTest_Impl();
}
- function testWrapperHook() {
+ public function testWrapperHook() {
// Note: this API call would fail due to missing contact_type, but
// the wrapper intervenes (fromApiInput)
// Note: The output would define "display_name", but the wrapper
}
}
+/**
+ * Class api_v3_APIWrapperTest_Impl
+ */
class api_v3_APIWrapperTest_Impl implements API_Wrapper {
/**
* {@inheritDoc}