/** * @param string $destination * @param array $params * @param array $post * * @return \Nette\Application\Responses\TextResponse * @throws \Exception */ protected function checkRss($destination, $params = [], $post = []) { /** @var \Nette\Application\Responses\TextResponse $response */ $response = $this->check($destination, $params, $post); if (!$this->__testbench_exception) { Assert::same(200, $this->getReturnCode()); Assert::type('Nette\\Application\\Responses\\TextResponse', $response); Assert::type('Nette\\Application\\UI\\ITemplate', $response->getSource()); $dom = \Tester\DomQuery::fromXml($response->getSource()); Assert::true($dom->has('rss')); Assert::true($dom->has('channel')); Assert::true($dom->has('title')); Assert::true($dom->has('link')); Assert::true($dom->has('item')); } return $response; }
protected function getDomQueryFromOb(Button $button, $data = [], $xml = false) { $out = $this->getStringFromOb($button, $data); return $xml ? DomQuery::fromXml($out) : DomQuery::fromHtml($out); }
/** * @return DomQuery */ public static function getDomFromXml($xml) { $xml = strtr($xml, self::$HTML401NamedToNumeric); return DomQuery::fromXml($xml); }
/** * @param string $destination fully qualified presenter name (module:module:presenter) * @param array $params provided to the presenter usually via URL * @param array $post provided to the presenter via POST * * @return \Nette\Application\Responses\TextResponse * @throws \Exception */ protected function checkSitemap($destination, $params = [], $post = []) { /** @var \Nette\Application\Responses\TextResponse $response */ $response = $this->check($destination, $params, $post); if (!$this->__testbench_exception) { Assert::same(200, $this->getReturnCode()); Assert::type('Nette\\Application\\Responses\\TextResponse', $response); Assert::type('Nette\\Application\\UI\\ITemplate', $response->getSource()); $xml = \Tester\DomQuery::fromXml($response->getSource()); Assert::same('urlset', $xml->getName(), 'root element is'); $url = $xml->children(); Assert::same('url', $url->getName(), "child of 'urlset'"); Assert::same('loc', $url->children()->getName(), "child of 'url'"); } return $response; }