markTestSkipped('Testing Zend_Service_ShortUrl_MetamarkNetTest only works when TESTS_ZEND_SERVICE_SHORTURL_METAMARKNET_ENABLED is set.'); } Zend_Service_Abstract::setHttpClient(new Zend_Http_Client()); $this->_s = new Zend_Service_ShortUrl_MetamarkNet(); } public function testShortenEmptyUrlException() { $this->setExpectedException('Zend_Service_ShortUrl_Exception'); $this->_s->shorten(''); } public function testShortenIncorrectUrlException() { $this->setExpectedException('Zend_Service_ShortUrl_Exception'); $this->_s->shorten('wrongAdress.cccc'); } public function testShorten() { $urls = array( 'http://framework.zend.com/' => 'http://xrl.us/bh4ptf', 'http://framework.zend.com/manual/en/' => 'http://xrl.us/bh4pth' ); foreach ($urls as $url => $shortenedUrl) { $this->assertEquals($shortenedUrl, $this->_s->shorten($url)); } } public function testUnshorten() { $urls = array( 'http://framework.zend.com/' => 'http://xrl.us/bh4ptf', 'http://framework.zend.com/manual/en/' => 'http://xrl.us/bh4pth' ); foreach ($urls as $url => $shortenedUrl) { $this->assertEquals($url, $this->_s->unshorten($shortenedUrl)); } } public function testUnshortenEmptyUrlException() { $this->setExpectedException('Zend_Service_ShortUrl_Exception'); $this->_s->unshorten(''); } public function testUnshortenIncorrectUrlException() { $this->setExpectedException('Zend_Service_ShortUrl_Exception'); $this->_s->unshorten('wrongAdress.cccc'); } public function testUnshortenWrongUrlException() { $this->setExpectedException('Zend_Service_ShortUrl_Exception'); $this->_s->unshorten('http://www.zend.com'); } }