示例#1
0
 public function testUnsetFields()
 {
     $this->eventResult->unsetFields(array('unsetField1'));
     $this->assertCount(1, $this->eventResult->getUnset());
     $this->eventResult->unsetField('unsetField2');
     $this->assertCount(2, $this->eventResult->getUnset());
 }
示例#2
0
 public function testMergeFields()
 {
     $fields = array('NAME' => 'NAME', 'CODE' => 'CODE', 'SORT' => 500);
     $event = new Event(FormEvents::BUILD, $fields);
     $eventResult = new EventResult();
     $eventResult->modifyFields(array('NAME' => 'NAME_CHANGE'));
     $eventResult->unsetFields(array('CODE'));
     $eventResult->unsetField('SORT');
     $event->addResult($eventResult);
     $fields = $event->mergeFields($fields);
     $this->assertArrayNotHasKey('CODE', $fields);
     $this->assertArrayNotHasKey('SORT', $fields);
     $this->assertArrayHasKey('NAME', $fields);
     $this->assertEquals('NAME_CHANGE', $fields['NAME']);
 }