mirror of
https://github.com/silverstripe/silverstripe-docsviewer
synced 2024-10-22 11:05:56 +02:00
2c00a3b20f
Clean up of existing theme, implementation of a new easier to integrate layout.
39 lines
1.3 KiB
PHP
Executable File
39 lines
1.3 KiB
PHP
Executable File
<?php
|
|
|
|
/**
|
|
* @package docsviewer
|
|
* @subpackage tests
|
|
*/
|
|
|
|
class DocumentationSearchTest extends FunctionalTest {
|
|
|
|
function setUp() {
|
|
parent::setUp();
|
|
|
|
if(!DocumentationSearch::enabled()) return;
|
|
|
|
DocumentationService::set_automatic_registration(false);
|
|
DocumentationService::register('docs-search', DOCSVIEWER_PATH . '/tests/docs-search/');
|
|
}
|
|
|
|
function testOpenSearchControllerAccessible() {
|
|
$c = new DocumentationOpenSearchController();
|
|
|
|
$response = $c->handleRequest(new SS_HTTPRequest('GET', ''), DataModel::inst());
|
|
$this->assertEquals(404, $response->getStatusCode());
|
|
|
|
// test accessing it when the search isn't active
|
|
DocumentationSearch::enable(false);
|
|
$response = $c->handleRequest(new SS_HTTPRequest('GET', 'description/'), DataModel::inst());
|
|
$this->assertEquals(404, $response->getStatusCode());
|
|
|
|
// test we get a response to the description. The meta data test will check
|
|
// that the individual fields are valid but we should check urls are there
|
|
DocumentationSearch::enable(true);
|
|
$response = $c->handleRequest(new SS_HTTPRequest('GET', 'description'), DataModel::inst());
|
|
$this->assertEquals(200, $response->getStatusCode());
|
|
|
|
$desc = new SimpleXMLElement($response->getBody());
|
|
$this->assertEquals(2, count($desc->Url));
|
|
}
|
|
} |