public function testArrayListInput() { $button = new GridFieldExportButton(); $this->gridField->getConfig()->addComponent(new GridFieldPaginator()); //Create an ArrayList 1 greater the Paginator's default 15 rows $arrayList = new ArrayList(); for ($i = 1; $i <= 16; $i++) { $dataobject = new DataObject(array('ID' => $i)); $arrayList->add($dataobject); } $this->gridField->setList($arrayList); $this->assertEquals("ID\n" . "1\n" . "2\n" . "3\n" . "4\n" . "5\n" . "6\n" . "7\n" . "8\n" . "9\n" . "10\n" . "11\n" . "12\n" . "13\n" . "14\n" . "15\n" . "16\n", $button->generateExportFileData($this->gridField)); }
/** * Check that we don't cause recursion errors with array_multisort() and circular dependencies */ public function testSortWithCircularDependencies() { $itemA = new stdClass(); $childA = new stdClass(); $itemA->child = $childA; $childA->parent = $itemA; $itemA->Sort = 1; $itemB = new stdClass(); $childB = new stdClass(); $itemB->child = $childB; $childB->parent = $itemB; $itemB->Sort = 1; $items = new ArrayList(); $items->add($itemA); $items->add($itemB); // This call will trigger a fatal error if there are issues with circular dependencies $items->sort('Sort'); }