mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #6512 from silverstripe/pulls/3.4/ensure-string-return
Test fixes - reorder assertions and ensure string returned
This commit is contained in:
commit
609b0a612c
@ -2022,7 +2022,7 @@ class LeftAndMain_TreeNode extends ViewableData {
|
|||||||
}
|
}
|
||||||
$classes .= ' ' . $filterClasses;
|
$classes .= ' ' . $filterClasses;
|
||||||
}
|
}
|
||||||
return $classes;
|
return $classes ?: '';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getObj() {
|
public function getObj() {
|
||||||
|
@ -302,6 +302,8 @@ class LeftAndMainTest_Object extends DataObject implements TestOnly {
|
|||||||
'Hierarchy'
|
'Hierarchy'
|
||||||
);
|
);
|
||||||
|
|
||||||
public function CMSTreeClasses() {}
|
public function CMSTreeClasses() {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -22,8 +22,8 @@ class TreeDropdownFieldTest extends SapphireTest {
|
|||||||
$cssPath = 'ul.tree li#selector-TestTree-'.$folder1->ID.' li#selector-TestTree-'.$folder1Subfolder1->ID.' a span.item';
|
$cssPath = 'ul.tree li#selector-TestTree-'.$folder1->ID.' li#selector-TestTree-'.$folder1Subfolder1->ID.' a span.item';
|
||||||
$firstResult = $parser->getBySelector($cssPath);
|
$firstResult = $parser->getBySelector($cssPath);
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
(string)$firstResult[0],
|
|
||||||
$folder1Subfolder1->Name,
|
$folder1Subfolder1->Name,
|
||||||
|
(string)$firstResult[0],
|
||||||
$folder1Subfolder1->Name.' is found, nested under '.$folder1->Name
|
$folder1Subfolder1->Name.' is found, nested under '.$folder1->Name
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -31,8 +31,8 @@ class TreeDropdownFieldTest extends SapphireTest {
|
|||||||
$cssPath = 'ul.tree li#selector-TestTree-'.$subfolder->ID.' a span.item';
|
$cssPath = 'ul.tree li#selector-TestTree-'.$subfolder->ID.' a span.item';
|
||||||
$secondResult = $parser->getBySelector($cssPath);
|
$secondResult = $parser->getBySelector($cssPath);
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
(string)$secondResult[0],
|
|
||||||
$subfolder->Name,
|
$subfolder->Name,
|
||||||
|
(string)$secondResult[0],
|
||||||
$subfolder->Name.' is found at root level'
|
$subfolder->Name.' is found at root level'
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -40,9 +40,8 @@ class TreeDropdownFieldTest extends SapphireTest {
|
|||||||
$folder2 = $this->objFromFixture('Folder','folder2');
|
$folder2 = $this->objFromFixture('Folder','folder2');
|
||||||
$cssPath = 'ul.tree li#selector-TestTree-'.$folder2->ID.' a span.item';
|
$cssPath = 'ul.tree li#selector-TestTree-'.$folder2->ID.' a span.item';
|
||||||
$noResult = $parser->getBySelector($cssPath);
|
$noResult = $parser->getBySelector($cssPath);
|
||||||
$this->assertEquals(
|
$this->assertEmpty(
|
||||||
$noResult,
|
$noResult,
|
||||||
array(),
|
|
||||||
$folder2.' is not found'
|
$folder2.' is not found'
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -58,8 +57,8 @@ class TreeDropdownFieldTest extends SapphireTest {
|
|||||||
$cssPath = 'ul.tree li#selector-TestTree-'.$folder1->ID.' li#selector-TestTree-'.$folder1Subfolder1->ID.' a span.item';
|
$cssPath = 'ul.tree li#selector-TestTree-'.$folder1->ID.' li#selector-TestTree-'.$folder1Subfolder1->ID.' a span.item';
|
||||||
$firstResult = $parser->getBySelector($cssPath);
|
$firstResult = $parser->getBySelector($cssPath);
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
(string)$firstResult[0],
|
|
||||||
$folder1Subfolder1->Name,
|
$folder1Subfolder1->Name,
|
||||||
|
(string)$firstResult[0],
|
||||||
$folder1Subfolder1->Name.' is found, nested under '.$folder1->Name
|
$folder1Subfolder1->Name.' is found, nested under '.$folder1->Name
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -74,8 +73,8 @@ class TreeDropdownFieldTest extends SapphireTest {
|
|||||||
$file1->Name.' with ID '.$file1->ID.' is in search results'
|
$file1->Name.' with ID '.$file1->ID.' is in search results'
|
||||||
);
|
);
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
(string)$firstResult[0],
|
|
||||||
$file1->Name,
|
$file1->Name,
|
||||||
|
(string)$firstResult[0],
|
||||||
$file1->Name.' is found nested under '.$subfolder->Name
|
$file1->Name.' is found nested under '.$subfolder->Name
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -87,8 +86,8 @@ class TreeDropdownFieldTest extends SapphireTest {
|
|||||||
$file2->Name.' with ID '.$file2->ID.' is in search results'
|
$file2->Name.' with ID '.$file2->ID.' is in search results'
|
||||||
);
|
);
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
(string)$secondResult[0],
|
|
||||||
$file2->Name,
|
$file2->Name,
|
||||||
|
(string)$secondResult[0],
|
||||||
$file2->Name.' is found nested under '.$subfolder->Name
|
$file2->Name.' is found nested under '.$subfolder->Name
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -96,9 +95,8 @@ class TreeDropdownFieldTest extends SapphireTest {
|
|||||||
$file3 = $this->objFromFixture('File','asdf');
|
$file3 = $this->objFromFixture('File','asdf');
|
||||||
$cssPath = 'ul.tree li#selector-TestTree-'.$file3->ID;
|
$cssPath = 'ul.tree li#selector-TestTree-'.$file3->ID;
|
||||||
$noResult = $parser->getBySelector($cssPath);
|
$noResult = $parser->getBySelector($cssPath);
|
||||||
$this->assertEquals(
|
$this->assertEmpty(
|
||||||
$noResult,
|
$noResult,
|
||||||
array(),
|
|
||||||
$file3->Name.' is not found'
|
$file3->Name.' is not found'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user