/** * Test incorrect usage of the Filter by providing an invalid option. */ public function testIncorrectUsageWithInvalidOption() { setlocale(LC_MESSAGES, 'C'); $_SERVER['argv'] = array($_SERVER['argv'][0], '--recipient'); $filter = new Horde_Kolab_Filter(); $inh = fopen(__DIR__ . '/../fixtures/tiny.eml', 'r'); try { $result = $filter->main('Incoming', $inh, 'echo'); } catch (Horde_Kolab_Filter_Exception $e) { $this->assertContains('error: --recipient option requires an argument', $e->getMessage()); return; } $this->assertFail('No exception!'); }
/** * Handle a "when" step. * * @param array &$world Joined "world" of variables. * @param string $action The description of the step. * @param array $arguments Additional arguments to the step. * * @return mixed The outcome of the step. */ public function runWhen(&$world, $action, $arguments) { switch ($action) { case 'handling the message': global $conf; $conf['server']['mock'] = true; //@todo: Fix guid => dn here $conf['server']['data'] = array('dn=example' => array('dn' => 'dn=example', 'data' => array('mail' => array('*****@*****.**'), 'kolabHomeServer' => array('localhost'), 'objectClass' => array('kolabInetOrgPerson'), 'guid' => 'dn=example'))); $_SERVER['argv'] = $this->_prepareArguments($world); $filter = new Horde_Kolab_Filter(); ob_start(); $result = $filter->main($world['type'], $world['fp'], 'echo'); $world['output'] = ob_get_contents(); ob_end_clean(); break; default: return $this->notImplemented($action); } }