MNT Fix minor typos

This commit is contained in:
Michal Kleiner 2021-09-24 22:29:43 +12:00
parent 7226d7fab6
commit 38fe326262
5 changed files with 15 additions and 15 deletions

View File

@ -501,7 +501,7 @@ class TreeDropdownField extends FormField
// Begin marking // Begin marking
$markingSet->markPartialTree(); $markingSet->markPartialTree();
// Explicitely mark our search results if necessary // Explicitly mark our search results if necessary
foreach ($this->searchIds as $id => $marked) { foreach ($this->searchIds as $id => $marked) {
if ($marked) { if ($marked) {
$object = $this->objectForKey($id); $object = $this->objectForKey($id);

View File

@ -30,7 +30,7 @@ class Hierarchy extends DataExtension
{ {
/** /**
* The lower bounds for the amount of nodes to mark. If set, the logic will expand nodes until it reaches at least * The lower bounds for the amount of nodes to mark. If set, the logic will expand nodes until it reaches at least
* this number, and then stops. Root nodes will always show regardless of this settting. Further nodes can be * this number, and then stops. Root nodes will always show regardless of this setting. Further nodes can be
* lazy-loaded via ajax. This isn't a hard limit. Example: On a value of 10, with 20 root nodes, each having 30 * lazy-loaded via ajax. This isn't a hard limit. Example: On a value of 10, with 20 root nodes, each having 30
* children, the actual node count will be 50 (all root nodes plus first expanded child). * children, the actual node count will be 50 (all root nodes plus first expanded child).
* *
@ -286,7 +286,7 @@ class Hierarchy extends DataExtension
/** /**
* Return the number of direct children. By default, values are cached after the first invocation. Can be * Return the number of direct children. By default, values are cached after the first invocation. Can be
* augumented by {@link augmentNumChildrenCountQuery()}. * augmented by {@link augmentNumChildrenCountQuery()}.
* *
* @param bool $cache Whether to retrieve values from cache * @param bool $cache Whether to retrieve values from cache
* @return int * @return int
@ -322,7 +322,7 @@ class Hierarchy extends DataExtension
/** /**
* Pre-populate any appropriate caches prior to rendering a tree. * Pre-populate any appropriate caches prior to rendering a tree.
* This is used to allow for the efficient rendering of tree views, notably in the CMS. * This is used to allow for the efficient rendering of tree views, notably in the CMS.
* In the cace of Hierarchy, it caches numChildren values. Other extensions can provide an * In the case of Hierarchy, it caches numChildren values. Other extensions can provide an
* onPrepopulateTreeDataCache(DataList $recordList = null, array $options) methods to hook * onPrepopulateTreeDataCache(DataList $recordList = null, array $options) methods to hook
* into this event as well. * into this event as well.
* *

View File

@ -56,7 +56,7 @@ class TreeDropdownFieldTest extends SapphireTest
{ {
$field = new TreeDropdownField('TestTree', 'Test tree', Folder::class); $field = new TreeDropdownField('TestTree', 'Test tree', Folder::class);
// case insensitive search against keyword 'sub' for folders // case-insensitive search against keyword 'sub' for folders
$request = new HTTPRequest('GET', 'url', ['search'=>'sub', 'format' => 'json']); $request = new HTTPRequest('GET', 'url', ['search'=>'sub', 'format' => 'json']);
$request->setSession(new Session([])); $request->setSession(new Session([]));
$response = $field->tree($request); $response = $field->tree($request);
@ -87,7 +87,7 @@ class TreeDropdownFieldTest extends SapphireTest
{ {
$field = new TreeDropdownField('TestTree', 'Test tree', Folder::class); $field = new TreeDropdownField('TestTree', 'Test tree', Folder::class);
// case insensitive search against keyword 'sub' for folders // case-insensitive search against keyword 'sub' for folders
$request = new HTTPRequest('GET', 'url', ['search'=>'sub', 'format' => 'json', 'flatList' => '1']); $request = new HTTPRequest('GET', 'url', ['search'=>'sub', 'format' => 'json', 'flatList' => '1']);
$request->setSession(new Session([])); $request->setSession(new Session([]));
$response = $field->tree($request); $response = $field->tree($request);
@ -176,7 +176,7 @@ class TreeDropdownFieldTest extends SapphireTest
{ {
$field = new TreeDropdownField('TestTree', 'Test tree', Folder::class); $field = new TreeDropdownField('TestTree', 'Test tree', Folder::class);
// case insensitive search against keyword 'sub' for folders // case-insensitive search against keyword 'sub' for folders
$request = new HTTPRequest('GET', 'url', ['search'=>'sub']); $request = new HTTPRequest('GET', 'url', ['search'=>'sub']);
$request->setSession(new Session([])); $request->setSession(new Session([]));
$response = $field->tree($request); $response = $field->tree($request);
@ -214,7 +214,7 @@ class TreeDropdownFieldTest extends SapphireTest
$field = new TreeDropdownField('TestTree', 'Test tree', File::class); $field = new TreeDropdownField('TestTree', 'Test tree', File::class);
// case insensitive search against keyword 'sub' for files // case-insensitive search against keyword 'sub' for files
$request = new HTTPRequest('GET', 'url', ['search'=>'sub']); $request = new HTTPRequest('GET', 'url', ['search'=>'sub']);
$request->setSession(new Session([])); $request->setSession(new Session([]));
$response = $field->tree($request); $response = $field->tree($request);
@ -340,7 +340,7 @@ class TreeDropdownFieldTest extends SapphireTest
$treeBaseID = $this->idFromFixture(Folder::class, 'folder1'); $treeBaseID = $this->idFromFixture(Folder::class, 'folder1');
$field = new TreeDropdownField('TestTree', 'Test tree', Folder::class); $field = new TreeDropdownField('TestTree', 'Test tree', Folder::class);
// getSchemaDataDefaults needs the field to be attach to a form // getSchemaDataDefaults needs the field to be attached to a form
new Form( new Form(
null, null,
'mock', 'mock',

View File

@ -48,10 +48,10 @@ class HierachyCacheTest extends SapphireTest
[TestObject::class, 'obj2', true, 2, 'Root object numChildren should count direct children when cache'], [TestObject::class, 'obj2', true, 2, 'Root object numChildren should count direct children when cache'],
[TestObject::class, 'obj3a', false, 2, 'Sub object numChildren should count direct children'], [TestObject::class, 'obj3a', false, 2, 'Sub object numChildren should count direct children'],
[TestObject::class, 'obj3a', true, 2, 'Sub object numChildren should count direct children when cache'], [TestObject::class, 'obj3a', true, 2, 'Sub object numChildren should count direct children when cache'],
[TestObject::class, 'obj3d', false, 0, 'Childess Sub object numChildren should be 0'], [TestObject::class, 'obj3d', false, 0, 'Childless Sub object numChildren should be 0'],
[TestObject::class, 'obj3d', true, 0, 'Childess Sub object numChildren should be 0 when cache'], [TestObject::class, 'obj3d', true, 0, 'Childless Sub object numChildren should be 0 when cache'],
[HideTestObject::class, 'obj4', false, 1, 'Hidden object should not be included in count'], [HideTestObject::class, 'obj4', false, 1, 'Hidden object should not be included in count'],
[HideTestObject::class, 'obj4', true, 1, 'Hidden object should not be included in couunt when cache'] [HideTestObject::class, 'obj4', true, 1, 'Hidden object should not be included in count when cache']
]; ];
} }
@ -68,7 +68,7 @@ class HierachyCacheTest extends SapphireTest
$this->assertEquals($expected, $actual, $message); $this->assertEquals($expected, $actual, $message);
if ($cache) { if ($cache) {
// When caching is eanbled, try re-accessing the numChildren value to make sure it doesn't change. // When caching is enabled, try re-accessing the numChildren value to make sure it doesn't change.
$actual = $node->numChildren($cache); $actual = $node->numChildren($cache);
$this->assertEquals($expected, $actual, $message); $this->assertEquals($expected, $actual, $message);
} }

View File

@ -258,7 +258,7 @@ class HierarchyTest extends SapphireTest
$this->assertEquals('Obj 2 » Obj 2a » Obj 2aa', $obj2aa->getBreadcrumbs()); $this->assertEquals('Obj 2 » Obj 2a » Obj 2aa', $obj2aa->getBreadcrumbs());
} }
public function testNoHideFromHeirarchy() public function testNoHideFromHierarchy()
{ {
/** @var HierarchyTest\HideTestObject $obj4 */ /** @var HierarchyTest\HideTestObject $obj4 */
$obj4 = $this->objFromFixture(HierarchyTest\HideTestObject::class, 'obj4'); $obj4 = $this->objFromFixture(HierarchyTest\HideTestObject::class, 'obj4');
@ -271,7 +271,7 @@ class HierarchyTest extends SapphireTest
$this->assertEquals($obj4->liveChildren()->Count(), 2); $this->assertEquals($obj4->liveChildren()->Count(), 2);
} }
public function testHideFromHeirarchy() public function testHideFromHierarchy()
{ {
HierarchyTest\HideTestObject::config()->update( HierarchyTest\HideTestObject::config()->update(
'hide_from_hierarchy', 'hide_from_hierarchy',