Exemplo n.º 1
0
 /** @test */
 public function initByGpVarsSetsCorrectSortingWhenSortingForSortingFieldsIsGiven()
 {
     $columnsConfiguration = $this->configurationBuilderMock->buildColumnsConfiguration();
     $sorterMock = $this->getMock('Tx_PtExtlist_Domain_Model_Sorting_Sorter', array('getSortingStateCollection'), array(), '', FALSE);
     $sorterMock->expects($this->any())->method('getSortingStateCollection')->will($this->returnValue(null));
     $headerColumn = new Tx_PtExtlist_Domain_Model_List_Header_HeaderColumn();
     $headerColumn->injectColumnConfig($columnsConfiguration[50]);
     $headerColumn->registerSorter($sorterMock);
     $headerColumn->_injectGPVars(array('sortingFields' => 'field1:1;field2:1'));
     $headerColumn->init();
     $sortingStateCollection = $headerColumn->getSortingStateCollection();
     $this->assertEquals($sortingStateCollection->count(), 2);
     $this->assertEquals($sortingStateCollection->getSortingState('field1')->getDirection(), -1);
     $this->assertEquals($sortingStateCollection->getItemByIndex(0)->getField()->getIdentifier(), 'field1');
     $this->assertEquals($sortingStateCollection->getItemByIndex(1)->getDirection(), 1);
     $this->assertEquals($sortingStateCollection->getItemByIndex(1)->getField()->getIdentifier(), 'field2');
 }