self::ENDPOINT_NAME, 'id' => $homePageId ); $response = dokuwiki_plugin_api_util::getRequest($queryParameters); $data = self::$JSON->decode($response->getContent()); /** * Test */ // Same Title $actualPageTitle = $data['title']; $expectedTitle = $homePageId; $this->assertEquals($expectedTitle, $actualPageTitle, "A page title without header must be the page id"); // Html $expectedHtml = DOKU_LF . '

' . DOKU_LF . 'Home Page' . DOKU_LF . '

' . DOKU_LF; $actualHtml = $data['html']; $this->assertEquals($expectedHtml, $actualHtml, "The Html must be the same"); // backlinks $actualBacklinks = $data['backlinks']; $expectedBacklinks = array( 0 => $backlinkHomePageId ); $this->assertEquals($expectedBacklinks, $actualBacklinks, "The Backlinks must be the same"); /** * Query Second page */ $queryParameters = array( 'fn' => 'page', 'id' => $backlinkHomePageId ); $response = dokuwiki_plugin_api_util::getRequest($queryParameters); $data = self::$JSON->decode($response->getContent()); // Title $actualPageTitle = $data['title']; $expectedTitle = $backlinkHomePageTitle; $this->assertEquals($expectedTitle, $actualPageTitle, "A page title with header must be the first heading"); // internal links $actualLinks = $data['links']; $expectedLinks = array( 0 => $homePageId ); $this->assertEquals($expectedLinks, $actualLinks, "The links must be the same"); // external links $actualExternalLinks = $data['external_links']; $expectedExternalLinks = array( 0 => $externalLink ); $this->assertEquals($expectedExternalLinks, $actualExternalLinks, "The externals links must be the same"); } }