public function testKanbanBoardMethods()
 {
     $searchModel = new AAASearchFormTestModel(new AAA());
     $kanbanBoard = new KanbanBoard(new AAA(), 'industry');
     $kanbanBoard->setGroupByAttributeVisibleValues(array('a', 'b'));
     $kanbanBoard->setSelectedTheme('someTheme');
     $searchModel->setKanbanBoard($kanbanBoard);
     $dataCollection = new SearchAttributesDataCollection($searchModel);
     $this->assertTrue($dataCollection->hasKanbanBoard());
     $this->assertEquals($kanbanBoard, $dataCollection->getKanbanBoard());
     $this->assertFalse($dataCollection->shouldClearStickyForKanbanBoard());
     $this->assertEquals(array('a', 'b'), $dataCollection->getKanbanBoardGroupByAttributeVisibleValuesFromModel());
     $this->assertEquals('someTheme', $dataCollection->getKanbanBoardSelectedThemeFromModel());
 }
 public function testResolveKanbanBoardOptionsForSearchModelFromGetArray()
 {
     $_GET['test'] = array('groupByAttributeVisibleValues' => '', 'selectedTheme' => '');
     $kanbanBoard = new KanbanBoard(new AAA(), 'industry');
     $kanbanBoard->setGroupByAttributeVisibleValues(array('a', 'b'));
     $kanbanBoard->setSelectedTheme('someTheme');
     $this->assertEquals(array('a', 'b'), $kanbanBoard->getGroupByAttributeVisibleValues());
     $this->assertEquals('someTheme', $kanbanBoard->getSelectedTheme());
     $this->assertNull($kanbanBoard->getIsActive());
     $searchModel = new AAASearchFormTestModel(new AAA());
     $searchModel->setKanbanBoard($kanbanBoard);
     KanbanBoard::resolveKanbanBoardOptionsForSearchModelFromArray($searchModel, 'test', $_GET);
     $this->assertNull($kanbanBoard->getGroupByAttributeVisibleValues());
     $this->assertNull($kanbanBoard->getSelectedTheme());
     $this->assertNull($kanbanBoard->getIsActive());
     //Now test setting in a selectedTheme and visibleValues
     $_GET['test'] = array('groupByAttributeVisibleValues' => array('c', 'd'), 'selectedTheme' => 'aTheme');
     KanbanBoard::resolveKanbanBoardOptionsForSearchModelFromArray($searchModel, 'test', $_GET);
     $this->assertEquals(array('c', 'd'), $kanbanBoard->getGroupByAttributeVisibleValues());
     $this->assertEquals('aTheme', $kanbanBoard->getSelectedTheme());
     $this->assertTrue($kanbanBoard->getIsActive());
 }
 public function testResolveSelectedListAttributesForSearchModelFromSourceData()
 {
     $model = new AAASearchFormTestModel(new A());
     $listAttributesSelector = new ListAttributesSelector('AListView', 'TestModule');
     $model->setListAttributesSelector($listAttributesSelector);
     $dataCollection = new SavedSearchAttributesDataCollection($model);
     $getArrayName = 'someArray';
     $dataCollection->resolveSelectedListAttributesForSearchModelFromSourceData();
     $this->assertEquals(array('name'), $model->getListAttributesSelector()->getSelected());
     //Test passing a value in the GET
     $_GET['AAASearchFormTestModel'][SearchForm::SELECTED_LIST_ATTRIBUTES] = 'notAnArray';
     $dataCollection->resolveSelectedListAttributesForSearchModelFromSourceData();
     $this->assertEquals(array('name'), $model->getListAttributesSelector()->getSelected());
     $_GET['AAASearchFormTestModel'][SearchForm::SELECTED_LIST_ATTRIBUTES] = array('All');
     $dataCollection->resolveSelectedListAttributesForSearchModelFromSourceData();
     $this->assertEquals(array('All'), $model->getListAttributesSelector()->getSelected());
     $_GET['AAASearchFormTestModel'][SearchForm::SELECTED_LIST_ATTRIBUTES] = array('name', 'a');
     $dataCollection->resolveSelectedListAttributesForSearchModelFromSourceData();
     $this->assertEquals(array('name', 'a'), $model->getListAttributesSelector()->getSelected());
 }
示例#4
0
 /**
  * Test other invalid expressions
  */
 public function testOtherInvalidExpressionsInStructurePosition()
 {
     $searchForm = new AAASearchFormTestModel(new A());
     $searchForm->dynamicClauses = array(array('structurePosition' => '1'), array('structurePosition' => '2'));
     $searchForm->dynamicStructure = '1 OR OR 2';
     $searchForm->validateDynamicStructure('dynamicStructure', array());
     $this->assertTrue($searchForm->hasErrors());
     $searchForm->clearErrors();
     $searchForm->dynamicStructure = '1 AND ( 2 ) 2';
     $searchForm->validateDynamicStructure('dynamicStructure', array());
     $this->assertTrue($searchForm->hasErrors());
     $searchForm->clearErrors();
     $searchForm->dynamicStructure = 'OR 2 AND 1';
     $searchForm->validateDynamicStructure('dynamicStructure', array());
     $this->assertTrue($searchForm->hasErrors());
     $searchForm->clearErrors();
     $searchForm->dynamicStructure = 'OR 2 AND 1';
     $searchForm->validateDynamicStructure('dynamicStructure', array());
     $this->assertTrue($searchForm->hasErrors());
     $searchForm->clearErrors();
     $searchForm->dynamicStructure = '5 AND';
     $searchForm->validateDynamicStructure('dynamicStructure', array());
     $this->assertTrue($searchForm->hasErrors());
     $searchForm->clearErrors();
 }