Fixed testGetModulePagesShort, no longer listing subfolders first

This commit is contained in:
Ingo Schommer 2013-06-10 09:53:05 +02:00
parent 2d7c1499d7
commit cb877536b6

View File

@ -108,11 +108,10 @@ class DocumentationViewerTest extends FunctionalTest {
$response = $v->handleRequest(new SS_HTTPRequest('GET', 'DocumentationViewerTests/en/2.3/subfolder/'), DataModel::inst()); $response = $v->handleRequest(new SS_HTTPRequest('GET', 'DocumentationViewerTests/en/2.3/subfolder/'), DataModel::inst());
$pages = $v->getEntityPages(); $pages = $v->getEntityPages();
$arr = $pages->toArray(); $this->assertEquals(
$pages->column('Title'),
$page = $arr[2]; array('Sort', 'Subfolder', 'Test')
);
$this->assertEquals('Subfolder', $page->Title);
} }
function testGetEntityPages() { function testGetEntityPages() {
@ -137,27 +136,20 @@ class DocumentationViewerTest extends FunctionalTest {
$this->assertStringEndsWith('DocumentationViewerTests/en/2.3/subfolder/', $links[1]); $this->assertStringEndsWith('DocumentationViewerTests/en/2.3/subfolder/', $links[1]);
$this->assertStringEndsWith('DocumentationViewerTests/en/2.3/test', $links[2]); $this->assertStringEndsWith('DocumentationViewerTests/en/2.3/test', $links[2]);
// Children $pageSort = $pages->find('Title', 'Sort');
$pagesArr = $pages->toArray(); $this->assertFalse($pageSort->Children);
$child1 = $pagesArr[1];
$this->assertFalse($child1->Children);
$child2 = $pagesArr[2];
$pageSubfolder = $pages->find('Title', 'Subfolder');
$this->assertEquals( $this->assertEquals(
array('subfolder/subpage.md', 'subfolder/subsubfolder/'), array('subfolder/subpage.md', 'subfolder/subsubfolder/'),
$child2->Children->column('Filename') $pageSubfolder->Children->column('Filename')
); );
$children = $child2->Children; $children = $pageSubfolder->Children;
foreach($children as $child) { foreach($children as $child) {
$child->setVersion('2.3'); $child->setVersion('2.3');
} }
$child2Links = $children->column('Link'); $child2Links = $children->column('Link');
$subpage = $children->First();
$this->assertStringEndsWith('DocumentationViewerTests/en/2.3/subfolder/subpage', $child2Links[0]); $this->assertStringEndsWith('DocumentationViewerTests/en/2.3/subfolder/subpage', $child2Links[0]);
$this->assertStringEndsWith('DocumentationViewerTests/en/2.3/subfolder/subsubfolder/', $child2Links[1]); $this->assertStringEndsWith('DocumentationViewerTests/en/2.3/subfolder/subsubfolder/', $child2Links[1]);
} }