/** * @magentoDataFixture Magento/Newsletter/_files/subscribers.php * @magentoAppArea frontend */ public function testUnsubscribeSubscribe() { // Unsubscribe and verify $this->assertSame($this->_model, $this->_model->loadByCustomerId(1)); $this->assertEquals($this->_model, $this->_model->unsubscribe()); $this->assertEquals(Subscriber::STATUS_UNSUBSCRIBED, $this->_model->getSubscriberStatus()); // Subscribe and verify $this->assertEquals(Subscriber::STATUS_SUBSCRIBED, $this->_model->subscribe('*****@*****.**')); $this->assertEquals(Subscriber::STATUS_SUBSCRIBED, $this->_model->getSubscriberStatus()); }
public function testUnsubscribe() { $sub = new Subscriber($this->mock); $sub->unsubscribe('http://hub.tld/subscribe', 'http://subscriber.tld/callback', 'http://publisher.tld/topic', 'sync'); $this->markTestIncomplete('This test has not been implemented yet.'); }
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * * $Id$ * ******************************************************************************/ include "../interface/EventChannel.php"; include "../interface/Subscriber.php"; $subject = "testsubj"; print "generating Famouso EventChannel\n"; $EventChannel = new EventChannel($subject); print "generating PHP Subscriber\n"; $Subscriber = new Subscriber($EventChannel); print "sending subscribtion\n"; if (!$Subscriber->subscribe()) { print "subscribtion failed - exit\n"; exit; } print "getting all events by polling\n"; for ($i = 0; $i < 10; $i++) { $event = $Subscriber->getEvent(); print $i . " event\n"; print "subject: " . $event['subject'] . "\n"; print "length : " . $event['length'] . "\n"; print "data : " . $event['data'] . "\n"; } print "sending unsubscribtion\n"; $Subscriber->unsubscribe();
<?php // simple example for the PHP pubsubhubbub Subscriber // as defined at http://code.google.com/p/pubsubhubbub/ // written by Josh Fraser | joshfraser.com | josh@eventvue.com // Released under Apache License 2.0 include "subscriber.php"; $hub_url = "http://pubsubhubbub.appspot.com"; $callback_url = "put your own endpoint here"; $feed = "http://feeds.feedburner.com/onlineaspect"; // create a new subscriber $s = new Subscriber($hub_url, $callback_url); // subscribe to a feed $s->subscribe($feed); // unsubscribe from a feed $s->unsubscribe($feed); ?>
/** * unsubscribing means losing the socket and kill the child-process */ public function unsubscribe() { parent::unsubscribe(); posix_kill($this->m_PidChild, SIGABRT); }