Exemplo n.º 1
0
 public function testResolveAnyMixedAttributesScopeForSearchModelFromGetArray()
 {
     $searchModel = new ASearchFormTestModel(new A());
     $getArrayName = 'someArray';
     SearchUtil::resolveAnyMixedAttributesScopeForSearchModelFromArray($searchModel, $getArrayName, $_GET);
     $this->assertNull($searchModel->getAnyMixedAttributesScope());
     //Test passing a value in the GET
     $_GET['someArray'][SearchForm::ANY_MIXED_ATTRIBUTES_SCOPE_NAME] = 'notAnArray';
     SearchUtil::resolveAnyMixedAttributesScopeForSearchModelFromArray($searchModel, $getArrayName, $_GET);
     $this->assertNull($searchModel->getAnyMixedAttributesScope());
     $_GET['someArray'][SearchForm::ANY_MIXED_ATTRIBUTES_SCOPE_NAME] = array('All');
     SearchUtil::resolveAnyMixedAttributesScopeForSearchModelFromArray($searchModel, $getArrayName, $_GET);
     $this->assertNull($searchModel->getAnyMixedAttributesScope());
     $_GET['someArray'][SearchForm::ANY_MIXED_ATTRIBUTES_SCOPE_NAME] = array('A', 'B', 'C');
     SearchUtil::resolveAnyMixedAttributesScopeForSearchModelFromArray($searchModel, $getArrayName, $_GET);
     $this->assertEquals(array('A', 'B', 'C'), $searchModel->getAnyMixedAttributesScope());
 }
 public function resolveAnyMixedAttributesScopeForSearchModelFromSourceData()
 {
     return SearchUtil::resolveAnyMixedAttributesScopeForSearchModelFromArray($this->model, get_class($this->model), $this->getSourceData());
 }