public function testAjaxImage() { $this->markTestSkipped('Akzeptanztest (es fehlen die Passwörter in der DB)'); $url = 'http://download.serienjunkies.org/f-3c346d11cb64efec/fc_HMM-701-rar.html'; $json = $this->ajaxTestRequest('/ajax.php?todo=ctrl&ctrlTodo=check', array('type' => 'captcha', 'url' => $url)); $imageURL = $json->content; $this->assertRegexp('|/captchas/[0-9]+/image|', $imageURL); $this->assertEquals('captcha', $json->type); $request = new Request($hostURL . $imageURL); $this->assertNotEmpty($pngRaw = $request->init()->process()); $this->assertInternalType('resource', imagecreatefromstring($pngRaw)); }
public function getBoardIds() { $this->logger->writeln('Lade BoardIds'); $cache = new \Psc\Data\FileCache(); $ser = $cache->load('boardIds', $loaded); if (!$loaded) { $this->logger->writeln('BoardIds nicht im Cache, mache URL Request'); $this->req = new URLRequest('http://www.subcentral.de/index.php?s=' . $this->sessionId, $this->cookieJar); $html = $this->req->init()->process(); $boardIds = array(); $dom = xml::doc($html); foreach (xml::query($dom, '#search select[name=boardID] option') as $option) { $title = $option->nodeValue; $boardIds[mb_strtolower($title)] = (int) $option->getAttribute('value'); } $this->logger->writeln(count($boardIds) . ' BoardIds gefunden. Speichere im Cache'); $ser = serialize($boardIds); $cache->store('boardIds', $ser); } else { $boardIds = unserialize($ser); $this->logger->writeln(count($boardIds) . ' BoardIds im Cache gefunden'); } return $boardIds; }