Example #1
0
 /**
  * call setContainerGrants cli function with params
  * 
  * @param array $_params
  * @return string
  */
 protected function _cliHelper($_params, $_numberExpected = 1)
 {
     $opts = new Zend_Console_Getopt('abp:');
     $opts->setArguments($_params);
     ob_start();
     $this->_cli->setContainerGrants($opts);
     $out = ob_get_clean();
     $this->assertContains("Updated {$_numberExpected} container(s)", $out, 'Text not found in: ' . $out);
     return $out;
 }
 /**
  * testRemoveAutogeneratedContacts
  * 
  * @see 0010257: add cli function for deleting autogenerated contacts
  */
 public function testRemoveAutogeneratedContacts()
 {
     if (!Tinebase_Application::getInstance()->isInstalled('Calendar')) {
         $this->markTestSkipped('only works with Calendar app');
     }
     $attenderEmail = '*****@*****.**';
     $attenderData = array('email' => $attenderEmail);
     Calendar_Model_Attender::resolveEmailToContact($attenderData);
     $opts = new Zend_Console_Getopt('abp:');
     $opts->setArguments(array());
     $this->_cli->removeAutogeneratedContacts($opts);
     $filter = new Addressbook_Model_ContactFilter(array(array('field' => 'email', 'operator' => 'equals', 'value' => $attenderEmail)));
     $result = Addressbook_Controller_Contact::getInstance()->search($filter);
     $this->assertEquals(0, count($result), 'should not find autogenerated contact any more: ' . print_r($result->toArray(), true));
 }