Merge branch '2015.11' into 2015.11-develop
authorPhilipp Schüle <p.schuele@metaways.de>
Tue, 5 Apr 2016 14:00:58 +0000 (16:00 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Tue, 5 Apr 2016 14:00:58 +0000 (16:00 +0200)
Conflicts:
tests/tine20/Addressbook/Export/DocTest.php
tests/tine20/Addressbook/JsonTest.php

Change-Id: I918dba12e780ccb4e4ac0d1bd9559268d4627a70

1  2 
tests/tine20/Addressbook/Export/DocTest.php
tests/tine20/Addressbook/JsonTest.php
tests/tine20/Calendar/Controller/EventTests.php
tine20/Addressbook/Setup/Initialize.php
tine20/Addressbook/js/ContactSearchCombo.js

@@@ -24,13 -24,16 +24,21 @@@ class Addressbook_Export_DocTest extend
  {
      public function testExportLetter()
      {
+         // skip tests for php7
+         // ERROR: PHP Fatal error:  Cannot use PhpOffice\PhpWord\Shared\String as String because 'String' is a special
+         //  class name in /usr/local/share/tine20.git/tine20/vendor/phpoffice/phpword/src/PhpWord/TemplateProcessor.php
+         //  on line 23
+         if (PHP_VERSION_ID >= 70000) {
+             $this->markTestSkipped('FIXME in php7');
+         }
 +        // make sure definition is imported
 +        $definitionFile = __DIR__ . '/../../../../tine20/Addressbook/Export/definitions/adb_default_doc.xml';
 +        $app = Tinebase_Application::getInstance()->getApplicationByName('Addressbook');
 +        Tinebase_ImportExportDefinition::getInstance()->updateOrCreateFromFilename($definitionFile, $app);
 +
          $filter = new Addressbook_Model_ContactFilter(array(
 -            array('field' => 'n_given', 'operator' => 'equals', 'value' => 'Robert')
 +            array('field' => 'n_given', 'operator' => 'equals', 'value' => 'James')
          ));
          $doc = new Addressbook_Export_Doc($filter);
          $doc->generate();
@@@ -1777,69 -1753,16 +1783,83 @@@ Steuernummer 33/111/32212"
      }
  
      /**
 +     * @see 0011584: allow to set group member roles
 +     */
 +    public function testCeateListWithMemberAndRole($listRoleName = 'my test role')
 +    {
 +        $contact = $this->_addContact();
 +        $listRole = $this->_uit->saveListRole(array(
 +            'name'          => $listRoleName,
 +            'description'   => 'my test description'
 +        ));
 +        $memberroles = array(array(
 +            'contact_id'   => $contact['id'],
 +            'list_role_id' => $listRole['id'],
 +        ));
 +        $list = $this->_uit->saveList(array(
 +            'name'                  => 'my test list',
 +            'description'           => '',
 +            'members'               => array($contact['id']),
 +            'memberroles'           => $memberroles,
 +            'type'                  => Addressbook_Model_List::LISTTYPE_LIST,
 +        ));
 +
 +        $this->assertEquals(array($contact['id']), $list['members'], 'members are not saved/returned in list: ' . print_r($list, true));
 +        $this->assertTrue(isset($list['memberroles']), 'memberroles missing from list');
 +        $this->assertEquals(1, count($list['memberroles']), 'member roles are not saved/returned in list: ' . print_r($list, true));
 +        $this->assertTrue(isset($list['memberroles'][0]['list_role_id']['id']), 'list roles should be resolved');
 +        $this->assertEquals($listRole['id'], $list['memberroles'][0]['list_role_id']['id'], 'member roles are not saved/returned in list: ' . print_r($list, true));
 +
 +        return $list;
 +    }
 +
 +    /**
 +     * @see 0011584: allow to set group member roles
 +     */
 +    public function testRemoveListMemberRoles()
 +    {
 +        $list = $this->testCeateListWithMemberAndRole();
 +
 +        $list['memberroles'] = array();
 +        $updatedList = $this->_uit->saveList($list);
 +        $this->assertTrue(empty($updatedList['memberroles']), 'memberroles should be removed: ' . print_r($updatedList, true));
 +    }
 +
 +    /**
 +     * @see 0011578: add list roles to CoreData + Addressbook
 +     */
 +    public function testListRolesApi()
 +    {
 +        $this->_testSimpleRecordApi('ListRole');
 +    }
 +
 +    /**
 +     * @see 0011584: allow to set group member roles
 +     */
 +    public function testSearchContactByListRole()
 +    {
 +        $list = $this->testCeateListWithMemberAndRole();
 +
 +        $filter = array(
 +            array('field' => 'list_role_id','operator' => 'in', 'value' => array($list['memberroles'][0]['list_role_id']['id']))
 +        );
 +
 +        $result = $this->_uit->searchContacts($filter, array());
 +
 +        $this->assertEquals(1, $result['totalcount']);
 +    }
++
++    /**
+      * @see 0011704: PHP 7 can't decode empty JSON-strings
+      */
+     public function testEmptyPagingParamJsonDecode()
+     {
+         $filter = array(array(
+             'field'    => 'n_family',
+             'operator' => 'equals',
+             'value'    => 'somename'
+         ));
+         $result = $this->_instance->searchContacts($filter, '');
+         $this->assertEquals(0, $result['totalcount']);
+     }
  }