Merge branch '2015.11' into 2015.11-develop
authorPhilipp Schüle <p.schuele@metaways.de>
Mon, 14 Mar 2016 12:51:20 +0000 (13:51 +0100)
committerPhilipp Schüle <p.schuele@metaways.de>
Mon, 14 Mar 2016 12:51:20 +0000 (13:51 +0100)
Conflicts:
tests/tine20/TestCase.php

Change-Id: Ib06a5152b691fdb5ca766f8895e7b109884c92db

1  2 
tests/tine20/Calendar/Controller/EventTests.php
tests/tine20/Felamimail/Frontend/JsonTest.php
tests/tine20/Sales/InvoiceControllerTests.php
tests/tine20/Sales/InvoiceJsonTests.php
tests/tine20/TestCase.php

@@@ -506,39 -506,13 +506,50 @@@ abstract class TestCase extends PHPUnit
      }
  
      /**
-         if (! $uit instanceof Tinebase_Frontend_Json_Abstract) {
 +     * test record json api
 +     *
 +     * @param $modelName
 +     */
 +    protected function _testSimpleRecordApi($modelName)
 +    {
 +        $uit = $this->_getUit();
-             'name'          => 'my test ' . $modelName,
-             'description'   => 'my test description'
++        if (!$uit instanceof Tinebase_Frontend_Json_Abstract) {
 +            throw new Exception('only allowed for json frontend tests suites');
 +        }
 +
 +        $newRecord = array(
++            'name' => 'my test ' . $modelName,
++            'description' => 'my test description'
 +        );
 +        $savedRecord = call_user_func(array($uit, 'save' . $modelName), $newRecord);
 +
 +        $this->assertEquals('my test ' . $modelName, $savedRecord['name'], print_r($savedRecord, true));
 +        $savedRecord['description'] = 'my updated description';
 +
 +        $updatedRecord = call_user_func(array($uit, 'save' . $modelName), $savedRecord);
 +        $this->assertEquals('my updated description', $updatedRecord['description']);
 +
 +        $filter = array(array('field' => 'id', 'operator' => 'equals', 'value' => $updatedRecord['id']));
 +        $result = call_user_func(array($uit, 'search' . $modelName . 's'), $filter, array());
 +        $this->assertEquals(1, $result['totalcount']);
 +
 +        call_user_func(array($uit, 'delete' . $modelName . 's'), array($updatedRecord['id']));
 +        try {
 +            call_user_func(array($uit, 'get' . $modelName), $updatedRecord['id']);
 +            $this->fail('should delete Record');
 +        } catch (Tinebase_Exception_NotFound $tenf) {
 +            $this->assertTrue($tenf instanceof Tinebase_Exception_NotFound);
 +        }
 +    }
++
++    /**
+      * returns true if main db adapter is postgresql
+      *
+      * @return bool
+      */
+     protected function _dbIsPgsql()
+     {
+         $db = Tinebase_Core::getDb();
+         return ($db instanceof Zend_Db_Adapter_Pdo_Pgsql);
+     }
  }