Пример #1
0
    public function setUp()
    {
        if (defined('TESTS_Zend_Feed_PubSubHubbub_BASEURI') &&
            \Zend\Uri\Url::check(TESTS_Zend_Feed_PubSubHubbub_BASEURI)) {
            $this->_baseuri = TESTS_Zend_Feed_PubSubHubbub_BASEURI;
            if (substr($this->_baseuri, -1) != '/') $this->_baseuri .= '/';
            $name = $this->getName();
            if (($pos = strpos($name, ' ')) !== false) {
                $name = substr($name, 0, $pos);
            }
            $uri = $this->_baseuri . $name . '.php';
            $this->_adapter = new $this->_config['adapter'];
            $this->_client = new \Zend\Http\Client($uri, $this->_config);
            $this->_client->setAdapter($this->_adapter);
            \Zend\Feed\PubSubHubbub\PubSubHubbub::setHttpClient($this->_client);
            $this->_subscriber = new \Zend\Feed\PubSubHubbub\Subscriber\Subscriber;
            
            
            $this->_storage = $this->_getCleanMock('Zend_Feed_PubSubHubbub_Entity_TopicSubscription');
            $this->_subscriber->setStorage($this->_storage);

        } else {
            // Skip tests
            $this->markTestSkipped("Zend_Feed_PubSubHubbub_Subscriber dynamic tests'
            . ' are not enabled in TestConfiguration.php");
        }
    }
Пример #2
0
 public function setUp()
 {
     $client = new HttpClient();
     PubSubHubbub::setHttpClient($client);
     $this->subscriber = new Subscriber();
     $this->adapter = $this->_getCleanMock('\\Zend\\Db\\Adapter\\Adapter');
     $this->tableGateway = $this->_getCleanMock('\\Zend\\Db\\TableGateway\\TableGateway');
     $this->tableGateway->expects($this->any())->method('getAdapter')->will($this->returnValue($this->adapter));
 }
Пример #3
0
 public function setUp()
 {
     $client = new \Zend\Http\Client();
     PubSubHubbub\PubSubHubbub::setHttpClient($client);
     $this->_subscriber = new \Zend\Feed\PubSubHubbub\Subscriber();
     $this->_adapter = $this->_getCleanMock('\\Zend\\Db\\Adapter\\AbstractAdapter');
     $this->_tableGateway = $this->_getCleanMock('\\Zend\\Db\\Table\\AbstractTable');
     $this->_tableGateway->expects($this->any())->method('getAdapter')->will($this->returnValue($this->_adapter));
 }
Пример #4
0
 public function setUp()
 {
     $this->baseuri = constant('TESTS_ZEND_FEED_PUBSUBHUBBUB_BASEURI');
     if ($this->baseuri) {
         if (substr($this->baseuri, -1) != '/') {
             $this->baseuri .= '/';
         }
         $name = $this->getName();
         if (($pos = strpos($name, ' ')) !== false) {
             $name = substr($name, 0, $pos);
         }
         $uri = $this->baseuri . $name . '.php';
         $this->client = new HttpClient($uri);
         $this->client->setAdapter('\\Zend\\Http\\Client\\Adapter\\Socket');
         PubSubHubbub::setHttpClient($this->client);
         $this->subscriber = new Subscriber();
         $this->storage = $this->_getCleanMock('\\Zend\\Feed\\PubSubHubbub\\Model\\Subscription');
         $this->subscriber->setStorage($this->storage);
     } else {
         // Skip tests
         $this->markTestSkipped('Zend\\Feed\\PubSubHubbub\\Subscriber dynamic tests are not enabled in TestConfiguration.php');
     }
 }
Пример #5
0
 public function testNotifiesHubAndReportsFail()
 {
     PubSubHubbub::setHttpClient($this->getClientFail());
     $client = PubSubHubbub::getHttpClient();
     $this->_publisher->addHubUrl('http://www.example.com/hub');
     $this->_publisher->addUpdatedTopicUrl('http://www.example.com/topic');
     $this->_publisher->setParameter('foo', 'bar');
     $this->_publisher->notifyAll();
     $this->assertFalse($this->_publisher->isSuccess());
 }
Пример #6
0
 public function testCanSetCustomHttpClient()
 {
     PubSubHubbub\PubSubHubbub::setHttpClient(new Pubsub());
     $this->assertInstanceOf('ZendTest\\Feed\\PubSubHubbub\\Pubsub', PubSubHubbub\PubSubHubbub::getHttpClient());
 }