Add a recipient for this element.
public addRecipient ( Horde_Push_Recipient $recipient ) : Horde_Push | ||
$recipient | Horde_Push_Recipient | The recipient. |
return | Horde_Push | This content element. |
public function testTwitterPretend() { $push = new Horde_Push(); $stub = new Horde_Push_Stub_Twitter(); $result = $push->addRecipient(new Horde_Push_Recipient_Twitter($stub))->setSummary('TWEET')->push(array('pretend' => true)); $this->assertEquals(array('Would push tweet "TWEET" to twitter.'), $result); }
public function testPretend() { $push = new Horde_Push(); $mx = new Horde_Mail_Transport_Mock(); $recipient = new Horde_Push_Recipient_Mail($mx, array('from' => '*****@*****.**')); $recipient->setAcl('*****@*****.**'); $return = $push->addRecipient($recipient)->setSummary('E-MAIL')->push(array('pretend' => true)); $this->assertContains('Would push mail', $return[0]); }
public function testPretend() { $push = new Horde_Push(); $mock = new Horde_Push_Recipient_Mock(); $result = $push->addRecipient($mock)->setSummary('Test')->push(array('pretend' => true)); $this->assertEquals(array('Would push "Test".'), $result); }
/** * @expectedException Horde_Push_Exception */ public function testBadResponse() { $push = new Horde_Push(); $request = new Horde_Http_Request_Mock(); $request->addResponse('Auth=X'); $request->addResponse('', 201); $client = new Horde_Http_Client(array('request' => $request)); $result = $push->addRecipient(new Horde_Push_Recipient_Blogger($client, array('url' => 'http://blogger.com', 'username' => 'test', 'password' => 'pass')))->setSummary('BLOG')->push(); }
public function testToConfiguredHeader() { $factory = new Horde_Push_Factory_Recipients(); $recipients = $factory->create(array(), array('recipients' => array('mail-me'), 'recipient' => array('mail-me' => array('type' => 'mail', 'acl' => '*****@*****.**', 'mailer' => array('type' => 'mock', 'from' => '*****@*****.**'))))); $push = new Horde_Push(); $push->setSummary('E-MAIL'); foreach ($recipients as $recipient) { $push->addRecipient($recipient); } $result = $push->push(array('pretend' => true)); $this->assertContains('to: recipient@example.com', $result[0]); }