diff --git a/admin/code/CMSBatchActionHandler.php b/admin/code/CMSBatchActionHandler.php index 6a273924a..f26f833fe 100644 --- a/admin/code/CMSBatchActionHandler.php +++ b/admin/code/CMSBatchActionHandler.php @@ -116,7 +116,7 @@ class CMSBatchActionHandler extends RequestHandler { } } } else { - $pages = new DataObjectSet(); + $pages = new ArrayList(); } return $actionHandler->run($pages); @@ -173,7 +173,7 @@ class CMSBatchActionHandler extends RequestHandler { */ function batchActionList() { $actions = $this->batchActions(); - $actionList = new DataObjectSet(); + $actionList = new ArrayList(); foreach($actions as $urlSegment => $action) { $actionClass = $action['class']; diff --git a/admin/code/LeftAndMain.php b/admin/code/LeftAndMain.php index 73d3c317c..d07b0eb25 100644 --- a/admin/code/LeftAndMain.php +++ b/admin/code/LeftAndMain.php @@ -382,10 +382,10 @@ class LeftAndMain extends Controller { */ public function MainMenu() { // Don't accidentally return a menu if you're not logged in - it's used to determine access. - if(!Member::currentUser()) return new DataObjectSet(); + if(!Member::currentUser()) return new ArrayList(); // Encode into DO set - $menu = new DataObjectSet(); + $menu = new ArrayList(); $menuItems = CMSMenu::get_viewable_menu_items(); if($menuItems) foreach($menuItems as $code => $menuItem) { // alternate permission checks (in addition to LeftAndMain->canView()) diff --git a/admin/code/ModelAdmin.php b/admin/code/ModelAdmin.php index dae73578b..2eab7a7e9 100755 --- a/admin/code/ModelAdmin.php +++ b/admin/code/ModelAdmin.php @@ -248,7 +248,7 @@ abstract class ModelAdmin extends LeftAndMain { */ protected function getModelForms() { $models = $this->getManagedModels(); - $forms = new DataObjectSet(); + $forms = new ArrayList(); foreach($models as $class => $options) { if(is_numeric($class)) $class = $options; @@ -476,11 +476,11 @@ class ModelAdmin_CollectionController extends Controller { $importerClass = $importers[$modelName]; $importer = new $importerClass($modelName); $spec = $importer->getImportSpec(); - $specFields = new DataObjectSet(); + $specFields = new ArrayList(); foreach($spec['fields'] as $name => $desc) { $specFields->push(new ArrayData(array('Name' => $name, 'Description' => $desc))); } - $specRelations = new DataObjectSet(); + $specRelations = new ArrayList(); foreach($spec['relations'] as $name => $desc) { $specRelations->push(new ArrayData(array('Name' => $name, 'Description' => $desc))); } diff --git a/api/RSSFeed.php b/api/RSSFeed.php index 0cb34c236..5e3d2911b 100755 --- a/api/RSSFeed.php +++ b/api/RSSFeed.php @@ -137,7 +137,7 @@ class RSSFeed extends ViewableData { * @return DataObjectSet Returns the {@link RSSFeed_Entry} objects. */ function Entries() { - $output = new DataObjectSet(); + $output = new ArrayList(); if(isset($this->entries)) { foreach($this->entries as $entry) { $output->push(new RSSFeed_Entry($entry, $this->titleField, $this->descriptionField, $this->authorField)); diff --git a/api/RestfulServer.php b/api/RestfulServer.php index 46186e224..343b9bb30 100644 --- a/api/RestfulServer.php +++ b/api/RestfulServer.php @@ -246,7 +246,7 @@ class RestfulServer extends Controller { return $responseFormatter->convertDataObjectSet($obj, $fields); } else if(!$obj) { $responseFormatter->setTotalSize(0); - return $responseFormatter->convertDataObjectSet(new DataObjectSet(), $fields); + return $responseFormatter->convertDataObjectSet(new ArrayList(), $fields); } else { return $responseFormatter->convertDataObject($obj, $fields); } diff --git a/api/RestfulService.php b/api/RestfulService.php index e3f19217d..56d1982df 100644 --- a/api/RestfulService.php +++ b/api/RestfulService.php @@ -250,7 +250,7 @@ class RestfulService extends ViewableData { public function getAttributes($xml, $collection=NULL, $element=NULL){ $xml = new SimpleXMLElement($xml); - $output = new DataObjectSet(); + $output = new ArrayList(); if($collection) $childElements = $xml->{$collection}; @@ -305,7 +305,7 @@ class RestfulService extends ViewableData { public function getValues($xml, $collection=NULL, $element=NULL){ $xml = new SimpleXMLElement($xml); - $output = new DataObjectSet(); + $output = new ArrayList(); $childElements = $xml; if($collection) @@ -386,7 +386,7 @@ class RestfulService extends ViewableData { */ function searchAttributes($xml, $node=NULL){ $xml = new SimpleXMLElement($xml); - $output = new DataObjectSet(); + $output = new ArrayList(); $childElements = $xml->xpath($node); diff --git a/api/SapphireSoapServer.php b/api/SapphireSoapServer.php index 48124aef6..df6945b78 100755 --- a/api/SapphireSoapServer.php +++ b/api/SapphireSoapServer.php @@ -65,12 +65,12 @@ class SapphireSoapServer extends Controller { } $methods[] = new ArrayData(array( "Name" => $methodName, - "Arguments" => new DataObjectSet($processedArguments), + "Arguments" => new ArrayList($processedArguments), "ReturnType" => self::$xsd_types[$returnType], )); } - return new DataObjectSet($methods); + return new ArrayList($methods); } /** diff --git a/core/PaginatedList.php b/core/PaginatedList.php index 95112d90c..6d85822e5 100644 --- a/core/PaginatedList.php +++ b/core/PaginatedList.php @@ -165,7 +165,7 @@ class PaginatedList extends SS_ListDecorator { * @return DataObjectSet */ public function Pages($max = null) { - $result = new DataObjectSet(); + $result = new ArrayList(); if ($max) { $start = ($this->CurrentPage() - floor($max / 2)) - 1; @@ -232,7 +232,7 @@ class PaginatedList extends SS_ListDecorator { * @return DataObjectSet */ public function PaginationSummary($context = 4) { - $result = new DataObjectSet(); + $result = new ArrayList(); $current = $this->CurrentPage(); $total = $this->TotalPages(); diff --git a/dev/BulkLoader.php b/dev/BulkLoader.php index 20d82743b..f89ccbf91 100644 --- a/dev/BulkLoader.php +++ b/dev/BulkLoader.php @@ -399,7 +399,7 @@ class BulkLoader_Result extends Object { * @return DataObjectSet */ protected function mapToDataObjectSet($arr) { - $set = new DataObjectSet(); + $set = new ArrayList(); foreach($arr as $arrItem) { $obj = DataObject::get_by_id($arrItem['ClassName'], $arrItem['ID']); $obj->_BulkLoaderMessage = $arrItem['Message']; diff --git a/dev/ModelViewer.php b/dev/ModelViewer.php index e23857ee8..74dbebba7 100644 --- a/dev/ModelViewer.php +++ b/dev/ModelViewer.php @@ -43,7 +43,7 @@ class ModelViewer extends Controller { function Models() { $classes = ClassInfo::subclassesFor('DataObject'); array_shift($classes); - $output = new DataObjectSet(); + $output = new ArrayList(); foreach($classes as $class) { $output->push(new ModelViewer_Model($class)); } @@ -60,7 +60,7 @@ class ModelViewer extends Controller { $modules = array(); foreach($classes as $class) { $model = new ModelViewer_Model($class); - if(!isset($modules[$model->Module])) $modules[$model->Module] = new DataObjectSet(); + if(!isset($modules[$model->Module])) $modules[$model->Module] = new ArrayList(); $modules[$model->Module]->push($model); } ksort($modules); @@ -70,7 +70,7 @@ class ModelViewer extends Controller { $modules = array($this->module => $modules[$this->module]); } - $output = new DataObjectSet(); + $output = new ArrayList(); foreach($modules as $moduleName => $models) { $output->push(new ArrayData(array( 'Link' => 'dev/viewmodel/' . $moduleName, @@ -149,7 +149,7 @@ class ModelViewer_Model extends ViewableData { } function Fields() { - $output = new DataObjectSet(); + $output = new ArrayList(); $output->push(new ModelViewer_Field($this,'ID', 'PrimaryKey')); if(!$this->ParentModel) { @@ -165,7 +165,7 @@ class ModelViewer_Model extends ViewableData { } function Relations() { - $output = new DataObjectSet(); + $output = new ArrayList(); foreach(array('has_one','has_many','many_many') as $relType) { $items = singleton($this->className)->uninherited($relType,true); diff --git a/forms/ComplexTableField.php b/forms/ComplexTableField.php index 6537aef57..aba398a5e 100644 --- a/forms/ComplexTableField.php +++ b/forms/ComplexTableField.php @@ -256,7 +256,7 @@ JS; $pageStart = (isset($_REQUEST['ctf'][$this->Name()]['start']) && is_numeric($_REQUEST['ctf'][$this->Name()]['start'])) ? $_REQUEST['ctf'][$this->Name()]['start'] : 0; - $output = new DataObjectSet(); + $output = new ArrayList(); foreach($sourceItems as $pageIndex=>$item) { $output->push(Object::create($this->itemClass,$item, $this, $pageStart+$pageIndex)); } @@ -540,7 +540,7 @@ class ComplexTableField_ItemRequest extends TableListField_ItemRequest { */ /* this doesn't actually work :-( function Paginator() { - $paginatingSet = new DataObjectSet(array($this->dataObj())); + $paginatingSet = new ArrayList(array($this->dataObj())); $start = isset($_REQUEST['ctf']['start']) ? $_REQUEST['ctf']['start'] : 0; $paginatingSet->setPageLimits($start, 1, $this->ctf->TotalCount()); return $paginatingSet; @@ -715,7 +715,7 @@ class ComplexTableField_ItemRequest extends TableListField_ItemRequest { function Pagination() { $this->pageSize = 9; $currentItem = $this->PopupCurrentItem(); - $result = new DataObjectSet(); + $result = new ArrayList(); if($currentItem < 6) { $offset = 1; } elseif($this->TotalCount() - $currentItem <= 4) { diff --git a/forms/OptionsetField.php b/forms/OptionsetField.php index 8c80eb048..4b32ae151 100755 --- a/forms/OptionsetField.php +++ b/forms/OptionsetField.php @@ -136,7 +136,7 @@ class OptionsetField extends DropdownField { } function ExtraOptions() { - return new DataObjectSet(); + return new ArrayList(); } } ?> \ No newline at end of file diff --git a/forms/SelectionGroup.php b/forms/SelectionGroup.php index 672e9aa2e..5a8ca5af2 100755 --- a/forms/SelectionGroup.php +++ b/forms/SelectionGroup.php @@ -74,7 +74,7 @@ class SelectionGroup extends CompositeField { $firstSelected = $checked =""; } - return new DataObjectSet($newItems); + return new ArrayList($newItems); } function hasData() { diff --git a/forms/TableField.php b/forms/TableField.php index 2e33eed1b..7c1e36fd6 100644 --- a/forms/TableField.php +++ b/forms/TableField.php @@ -128,7 +128,7 @@ class TableField extends TableListField { $headings[] = new ArrayData(array("Name" => $fieldName, "Title" => $fieldTitle, "Class" => $class)); $i++; } - return new DataObjectSet($headings); + return new ArrayList($headings); } /** @@ -151,14 +151,14 @@ class TableField extends TableListField { */ function Items() { // holds TableField_Item instances - $items = new DataObjectSet(); + $items = new ArrayList(); $sourceItems = $this->sourceItems(); // either load all rows from the field value, // (e.g. when validation failed), or from sourceItems() if($this->value) { - if(!$sourceItems) $sourceItems = new DataObjectSet(); + if(!$sourceItems) $sourceItems = new ArrayList(); // get an array keyed by rows, rather than values $rows = $this->sortData(ArrayLib::invert($this->value)); @@ -221,7 +221,7 @@ class TableField extends TableListField { ); $form->loadDataFrom($dataObj); - // Add the item to our new DataObjectSet, with a wrapper class. + // Add the item to our new ArrayList, with a wrapper class. return new TableField_Item($dataObj, $this, $form, $this->fieldTypes); } diff --git a/forms/TableListField.php b/forms/TableListField.php index 0dc26ab2d..c4d730a0a 100644 --- a/forms/TableListField.php +++ b/forms/TableListField.php @@ -338,7 +338,7 @@ JS "SortDirection" => (isset($_REQUEST['ctf'][$this->Name()]['dir'])) ? $_REQUEST['ctf'][$this->Name()]['dir'] : null )); } - return new DataObjectSet($headings); + return new ArrayList($headings); } function disableSorting($to = true) { @@ -367,7 +367,7 @@ JS * @return DataObjectSet */ function Actions() { - $allowedActions = new DataObjectSet(); + $allowedActions = new ArrayList(); foreach($this->actions as $actionName => $actionSettings) { if($this->Can($actionName)) { $allowedActions->push(new ViewableData()); @@ -437,7 +437,7 @@ JS * Return a DataObjectSet of TableListField_Item objects, suitable for display in the template. */ function Items() { - $fieldItems = new DataObjectSet(); + $fieldItems = new ArrayList(); if($items = $this->sourceItems()) foreach($items as $item) { if($item) $fieldItems->push(new $this->itemClass($item, $this)); } @@ -630,7 +630,7 @@ JS 'Title' => DBField::create('Varchar', $fieldTitle), )); } - return new DataObjectSet($summaryFields); + return new ArrayList($summaryFields); } function HasGroupedItems() { @@ -648,9 +648,9 @@ JS } $groupedItems = $items->groupBy($this->groupByField); - $groupedArrItems = new DataObjectSet(); + $groupedArrItems = new ArrayList(); foreach($groupedItems as $key => $group) { - $fieldItems = new DataObjectSet(); + $fieldItems = new ArrayList(); foreach($group as $item) { if($item) $fieldItems->push(new $this->itemClass($item, $this)); } @@ -961,7 +961,7 @@ JS $csvColumns = ($this->fieldListCsv) ? $this->fieldListCsv : $this->fieldList; $fileData = ''; $columnData = array(); - $fieldItems = new DataObjectSet(); + $fieldItems = new ArrayList(); if($this->csvHasHeader) { $fileData .= "\"" . implode("\"{$separator}\"", array_values($csvColumns)) . "\""; @@ -1064,7 +1064,7 @@ JS * ################################# */ function Utility() { - $links = new DataObjectSet(); + $links = new ArrayList(); if($this->can('export')) { $links->push(new ArrayData(array( 'Title' => _t('TableListField.CSVEXPORT', 'Export to CSV'), @@ -1280,7 +1280,7 @@ JS function SelectOptions(){ if(!$this->selectOptions) return; - $selectOptionsSet = new DataObjectSet(); + $selectOptionsSet = new ArrayList(); foreach($this->selectOptions as $k => $v) { $selectOptionsSet->push(new ArrayData(array( 'Key' => $k, @@ -1377,7 +1377,7 @@ class TableListField_Item extends ViewableData { "CsvSeparator" => $this->parent->getCsvSeparator(), )); } - return new DataObjectSet($fields); + return new ArrayList($fields); } function Markable() { @@ -1430,7 +1430,7 @@ class TableListField_Item extends ViewableData { * @return DataObjectSet */ function Actions() { - $allowedActions = new DataObjectSet(); + $allowedActions = new ArrayList(); foreach($this->parent->actions as $actionName => $actionSettings) { if($this->parent->Can($actionName)) { $allowedActions->push(new ArrayData(array( diff --git a/forms/TreeMultiselectField.php b/forms/TreeMultiselectField.php index 80cdeb81d..e53ca1397 100755 --- a/forms/TreeMultiselectField.php +++ b/forms/TreeMultiselectField.php @@ -59,7 +59,7 @@ class TreeMultiselectField extends TreeDropdownField { // Otherwise, look data up from the linked relation } if($this->value != 'unchanged' && is_string($this->value)) { - $items = new DataObjectSet(); + $items = new ArrayList(); $ids = explode(',', $this->value); foreach($ids as $id) { if(!is_numeric($id)) continue; diff --git a/model/DataDifferencer.php b/model/DataDifferencer.php index 9bb1c564f..1278b1252 100644 --- a/model/DataDifferencer.php +++ b/model/DataDifferencer.php @@ -96,7 +96,7 @@ class DataDifferencer extends ViewableData { * - To: The newer version of the field */ function ChangedFields() { - $changedFields = new DataObjectSet(); + $changedFields = new ArrayList(); if($this->fromRecord) { $base = $this->fromRecord; diff --git a/model/Hierarchy.php b/model/Hierarchy.php index b98a28b86..5180d2944 100644 --- a/model/Hierarchy.php +++ b/model/Hierarchy.php @@ -400,7 +400,7 @@ class Hierarchy extends DataExtension { if(!(isset($this->_cache_children) && $this->_cache_children)) { $result = $this->owner->stageChildren(false); if(isset($result)) { - $this->_cache_children = new DataObjectSet(); + $this->_cache_children = new ArrayList(); foreach($result as $child) { if($child->canView()) { $this->_cache_children->push($child); @@ -452,7 +452,7 @@ class Hierarchy extends DataExtension { // Next, go through the live children. Only some of these will be listed $liveChildren = $this->owner->liveChildren(true, true); if($liveChildren) { - $merged = new DataObjectSet(); + $merged = new ArrayList(); $merged->merge($stageChildren); $merged->merge($liveChildren); $stageChildren = $merged; @@ -590,7 +590,7 @@ class Hierarchy extends DataExtension { * @return DataObjectSet */ public function getAncestors() { - $ancestors = new DataObjectSet(); + $ancestors = new ArrayList(); $object = $this->owner; while($object = $object->getParent()) { diff --git a/model/MySQLDatabase.php b/model/MySQLDatabase.php index 67d969b13..fc1a7bd06 100644 --- a/model/MySQLDatabase.php +++ b/model/MySQLDatabase.php @@ -829,8 +829,8 @@ class MySQLDatabase extends SS_Database { $objects[] = new $record['ClassName']($record); - if(isset($objects)) $doSet = new DataObjectSet($objects); - else $doSet = new DataObjectSet(); + if(isset($objects)) $doSet = new ArrayList($objects); + else $doSet = new ArrayList(); $list = new PaginatedList($doSet); $list->setPageStart($start); diff --git a/model/SQLMap.php b/model/SQLMap.php index 933591ef3..af6d7323c 100755 --- a/model/SQLMap.php +++ b/model/SQLMap.php @@ -68,7 +68,7 @@ class SQLMap extends Object implements IteratorAggregate { */ protected function genItems() { if(!isset($this->items)) { - $this->items = new DataObjectSet(); + $this->items = new ArrayList(); $items = $this->query->execute(); foreach($items as $item) { diff --git a/model/Versioned.php b/model/Versioned.php index e3ab086c7..e845995cb 100644 --- a/model/Versioned.php +++ b/model/Versioned.php @@ -700,7 +700,7 @@ class Versioned extends DataExtension { $query->orderby = ($sort) ? $sort : "\"{$baseTable}_versions\".\"LastEdited\" DESC, \"{$baseTable}_versions\".\"Version\" DESC"; $records = $query->execute(); - $versions = new DataObjectSet(); + $versions = new ArrayList(); foreach($records as $record) { $versions->push(new Versioned_Version($record)); diff --git a/model/fieldtypes/Int.php b/model/fieldtypes/Int.php index 2f14a725e..c31459e13 100644 --- a/model/fieldtypes/Int.php +++ b/model/fieldtypes/Int.php @@ -31,7 +31,7 @@ class Int extends DBField { } function Times() { - $output = new DataObjectSet(); + $output = new ArrayList(); for( $i = 0; $i < $this->value; $i++ ) $output->push( new ArrayData( array( 'Number' => $i + 1 ) ) ); diff --git a/parsers/BBCodeParser.php b/parsers/BBCodeParser.php index 1f7ba19a1..ae798d478 100644 --- a/parsers/BBCodeParser.php +++ b/parsers/BBCodeParser.php @@ -60,7 +60,7 @@ class BBCodeParser extends TextParser { static function usable_tags() { - return new DataObjectSet( + return new ArrayList( new ArrayData(array( "Title" => _t('BBCodeParser.BOLD', 'Bold Text'), "Example" => '[b]'._t('BBCodeParser.BOLDEXAMPLE', 'Bold').'[/b]' diff --git a/security/Group.php b/security/Group.php index af30c5f99..2f5416406 100644 --- a/security/Group.php +++ b/security/Group.php @@ -42,7 +42,7 @@ class Group extends DataObject { } function getAllChildren() { - $doSet = new DataObjectSet(); + $doSet = new ArrayList(); if ($children = DataObject::get('Group', '"ParentID" = '.$this->ID)) { foreach($children as $child) { @@ -137,7 +137,7 @@ class Group extends DataObject { // Add roles (and disable all checkboxes for inherited roles) $allRoles = Permission::check('ADMIN') ? DataObject::get('PermissionRole') : DataObject::get('PermissionRole', 'OnlyAdminCanApply = 0'); $groupRoles = $this->Roles(); - $inheritedRoles = new DataObjectSet(); + $inheritedRoles = new ArrayList(); $ancestors = $this->getAncestors(); foreach($ancestors as $ancestor) { $ancestorRoles = $ancestor->Roles(); @@ -399,7 +399,7 @@ class Group extends DataObject { $children = $extInstance->AllChildrenIncludingDeleted(); $extInstance->clearOwner(); - $filteredChildren = new DataObjectSet(); + $filteredChildren = new ArrayList(); if($children) foreach($children as $child) { if($child->canView()) $filteredChildren->push($child); diff --git a/security/Permission.php b/security/Permission.php index 3d9ede9ab..f8b01f35b 100755 --- a/security/Permission.php +++ b/security/Permission.php @@ -379,7 +379,7 @@ class Permission extends DataObject { */ public static function get_members_by_permission($code) { $toplevelGroups = self::get_groups_by_permission($code); - if (!$toplevelGroups) return new DataObjectSet(); + if (!$toplevelGroups) return new ArrayList(); $groupIDs = array(); foreach($toplevelGroups as $group) { @@ -389,7 +389,7 @@ class Permission extends DataObject { } } - if(!count($groupIDs)) return new DataObjectSet(); + if(!count($groupIDs)) return new ArrayList(); $members = DataObject::get( Object::getCustomClass('Member'), diff --git a/security/PermissionCheckboxSetField.php b/security/PermissionCheckboxSetField.php index 14467d1d8..334fe14e6 100644 --- a/security/PermissionCheckboxSetField.php +++ b/security/PermissionCheckboxSetField.php @@ -45,7 +45,7 @@ class PermissionCheckboxSetField extends FormField { if($records instanceof SS_List) { $this->records = $records; } elseif($records instanceof Group) { - $this->records = new DataObjectSet($records); + $this->records = new ArrayList(array($records)); } elseif($records) { throw new InvalidArgumentException('$record should be either a Group record, or a DataObjectSet of Group records'); } @@ -76,7 +76,7 @@ class PermissionCheckboxSetField extends FormField { $uninheritedCodes = array(); $inheritedCodes = array(); - $records = ($this->records) ? $this->records : new DataObjectSet(); + $records = ($this->records) ? $this->records : new ArrayList(); // Get existing values from the form record (assuming the formfield name is a join field on the record) if(is_object($this->form)) { diff --git a/tests/api/RSSFeedTest.php b/tests/api/RSSFeedTest.php index 55b235892..a33137006 100755 --- a/tests/api/RSSFeedTest.php +++ b/tests/api/RSSFeedTest.php @@ -8,7 +8,7 @@ class RSSFeedTest extends SapphireTest { protected static $original_host; function testRSSFeed() { - $list = new DataObjectSet(); + $list = new ArrayList(); $list->push(new RSSFeedTest_ItemA()); $list->push(new RSSFeedTest_ItemB()); $list->push(new RSSFeedTest_ItemC()); diff --git a/tests/forms/TableListFieldTest.php b/tests/forms/TableListFieldTest.php index 4b3d8964c..8be886f49 100755 --- a/tests/forms/TableListFieldTest.php +++ b/tests/forms/TableListFieldTest.php @@ -304,7 +304,7 @@ class TableListFieldTest extends SapphireTest { $three = new TableListFieldTest_Obj; $three->A = "A-three"; - $list = new DataObjectSet($one, $two, $three); + $list = new ArrayList(array($one, $two, $three)); // A TableListField must be inside a form for its links to be generated $form = new Form(new TableListFieldTest_TestController(), "TestForm", new FieldSet( diff --git a/tests/model/PaginatedListTest.php b/tests/model/PaginatedListTest.php index e6384c8bf..fc367034c 100644 --- a/tests/model/PaginatedListTest.php +++ b/tests/model/PaginatedListTest.php @@ -8,27 +8,27 @@ class PaginatedListTest extends SapphireTest { public function testPageStart() { - $list = new PaginatedList(new DataObjectSet()); + $list = new PaginatedList(new ArrayList()); $this->assertEquals(0, $list->getPageStart(), 'The start defaults to 0.'); $list->setPageStart(10); $this->assertEquals(10, $list->getPageStart(), 'You can set the page start.'); - $list = new PaginatedList(new DataObjectSet(), array('start' => 50)); + $list = new PaginatedList(new ArrayList(), array('start' => 50)); $this->assertEquals(50, $list->getPageStart(), 'The page start can be read from the request.'); } public function testGetTotalItems() { - $list = new PaginatedList(new DataObjectSet()); + $list = new PaginatedList(new ArrayList()); $this->assertEquals(0, $list->getTotalItems()); $list->setTotalItems(10); $this->assertEquals(10, $list->getTotalItems()); - $list = new PaginatedList(new DataObjectSet( + $list = new PaginatedList(new ArrayList(array( new ArrayData(array()), new ArrayData(array()) - )); + ))); $this->assertEquals(2, $list->getTotalItems()); } @@ -39,7 +39,7 @@ class PaginatedListTest extends SapphireTest { ->method('unlimitedRowCount') ->will($this->returnValue(100)); - $list = new PaginatedList(new DataObjectSet()); + $list = new PaginatedList(new ArrayList()); $list->setPaginationFromQuery($query); $this->assertEquals(15, $list->getPageLength()); @@ -48,7 +48,7 @@ class PaginatedListTest extends SapphireTest { } public function testSetCurrentPage() { - $list = new PaginatedList(new DataObjectSet()); + $list = new PaginatedList(new ArrayList()); $list->setPageLength(10); $list->setCurrentPage(10); @@ -57,7 +57,7 @@ class PaginatedListTest extends SapphireTest { } public function testGetIterator() { - $list = new PaginatedList(new DataObjectSet(array( + $list = new PaginatedList(new ArrayList(array( new DataObject(array('Num' => 1)), new DataObject(array('Num' => 2)), new DataObject(array('Num' => 3)), @@ -85,7 +85,7 @@ class PaginatedListTest extends SapphireTest { } public function testPages() { - $list = new PaginatedList(new DataObjectSet()); + $list = new PaginatedList(new ArrayList()); $list->setPageLength(10); $list->setTotalItems(50); @@ -113,7 +113,7 @@ class PaginatedListTest extends SapphireTest { } public function testPaginationSummary() { - $list = new PaginatedList(new DataObjectSet()); + $list = new PaginatedList(new ArrayList()); $list->setPageLength(10); $list->setTotalItems(250); @@ -134,7 +134,7 @@ class PaginatedListTest extends SapphireTest { } public function testCurrentPage() { - $list = new PaginatedList(new DataObjectSet()); + $list = new PaginatedList(new ArrayList()); $list->setTotalItems(50); $this->assertEquals(1, $list->CurrentPage()); @@ -145,7 +145,7 @@ class PaginatedListTest extends SapphireTest { } public function testTotalPages() { - $list = new PaginatedList(new DataObjectSet()); + $list = new PaginatedList(new ArrayList()); $list->setPageLength(1); $this->assertEquals(0, $list->TotalPages()); @@ -158,7 +158,7 @@ class PaginatedListTest extends SapphireTest { } public function testMoreThanOnePage() { - $list = new PaginatedList(new DataObjectSet()); + $list = new PaginatedList(new ArrayList()); $list->setPageLength(1); $list->setTotalItems(1); @@ -169,14 +169,14 @@ class PaginatedListTest extends SapphireTest { } public function testNotFirstPage() { - $list = new PaginatedList(new DataObjectSet()); + $list = new PaginatedList(new ArrayList()); $this->assertFalse($list->NotFirstPage()); $list->setCurrentPage(2); $this->assertTrue($list->NotFirstPage()); } public function testNotLastPage() { - $list = new PaginatedList(new DataObjectSet()); + $list = new PaginatedList(new ArrayList()); $list->setTotalItems(50); $this->assertTrue($list->NotLastPage()); @@ -185,14 +185,14 @@ class PaginatedListTest extends SapphireTest { } public function testFirstItem() { - $list = new PaginatedList(new DataObjectSet()); + $list = new PaginatedList(new ArrayList()); $this->assertEquals(1, $list->FirstItem()); $list->setPageStart(10); $this->assertEquals(11, $list->FirstItem()); } public function testLastItem() { - $list = new PaginatedList(new DataObjectSet()); + $list = new PaginatedList(new ArrayList()); $list->setPageLength(10); $list->setTotalItems(25); @@ -205,19 +205,19 @@ class PaginatedListTest extends SapphireTest { } public function testFirstLink() { - $list = new PaginatedList(new DataObjectSet()); + $list = new PaginatedList(new ArrayList()); $this->assertContains('start=0', $list->FirstLink()); } public function testLastLink() { - $list = new PaginatedList(new DataObjectSet()); + $list = new PaginatedList(new ArrayList()); $list->setPageLength(10); $list->setTotalItems(100); $this->assertContains('start=90', $list->LastLink()); } public function testNextLink() { - $list = new PaginatedList(new DataObjectSet()); + $list = new PaginatedList(new ArrayList()); $list->setTotalItems(50); $this->assertContains('start=10', $list->NextLink()); @@ -232,7 +232,7 @@ class PaginatedListTest extends SapphireTest { } public function testPrevLink() { - $list = new PaginatedList(new DataObjectSet()); + $list = new PaginatedList(new ArrayList()); $list->setTotalItems(50); $this->assertNull($list->PrevLink()); diff --git a/tests/view/SSViewerTest.php b/tests/view/SSViewerTest.php index 3fe08bbcf..5230a6acb 100644 --- a/tests/view/SSViewerTest.php +++ b/tests/view/SSViewerTest.php @@ -332,10 +332,10 @@ after') $data = new ArrayData(array( 'Title' => 'A', - 'Children' => new DataObjectSet(array( + 'Children' => new ArrayList(array( new ArrayData(array( 'Title' => 'A1', - 'Children' => new DataObjectSet(array( + 'Children' => new ArrayList(array( new ArrayData(array( 'Title' => 'A1 i', )), new ArrayData(array( 'Title' => 'A1 ii', )), )), @@ -415,7 +415,7 @@ after') // Data to run the loop tests on - one sequence of three items, each with a subitem $data = new ArrayData(array( 'Name' => 'Top', - 'Foo' => new DataObjectSet(array( + 'Foo' => new ArrayList(array( new ArrayData(array( 'Name' => '1', 'Sub' => new ArrayData(array( @@ -538,7 +538,7 @@ class SSViewerTestFixture extends ViewableData { // Special field name Loop### to create a list if(preg_match('/^Loop([0-9]+)$/', $fieldName, $matches)) { - $output = new DataObjectSet(); + $output = new ArrayList(); for($i=0;$i<$matches[1];$i++) $output->push(new SSViewerTestFixture($childName)); return $output;