/** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. */ protected function setUp() { $httpClient = new HttpClientManager(); // $httpClient->setDebug(FALSE); // $httpClient->get('http://www.packtpub.com/learning-ext-js/book'); $httpClient->get('http://www.tdperformance.com/site/?callHandle=search&Keyword=9468'); // $httpClient->get('http://php.net/manual/ru/domdocument.loadhtml.php'); $this->object = new EasyHtmlDom($httpClient->getResponse()->getBody()); }
/** * @covers Svetel\Manager\HttpClientManager::__call */ public function testCall() { $this->object->get(self::testMyIPUrl); $this->assertTrue(is_object($this->object->getResponse())); $this->object->post(self::testMyIPUrl); $this->assertTrue(is_object($this->object->getResponse())); try { $this->object->put(self::testMyIPUrl); } catch (\InvalidArgumentException $ex) { $this->assertEquals('Not allowed method', $ex->getMessage()); } try { $this->object->get(); } catch (\InvalidArgumentException $ex) { $this->assertEquals('Magic request methods require a URI', $ex->getMessage()); } $this->object->get(self::testMyIPUrl); $this->assertNotEquals('217.77.219.166', $this->object->getResponse()->getBody()); $this->object->setUseSocksProxy(FALSE); $this->object->get(self::testMyIPUrl); $this->assertEquals('217.77.219.166', $this->object->getResponse()->getBody()); }