示例#1
0
 public function testValidateValueInteger()
 {
     $inputValue = 0;
     $expectedResult = ['"Test" is a required value.'];
     $result = $this->_model->validateValue($inputValue);
     $this->assertEquals($expectedResult, [(string) $result[0]]);
 }
示例#2
0
 /**
  * @param string $value
  * @return true|string[]
  */
 public function validateValue($value)
 {
     $countryId = $this->getExtractedData('country_id');
     $optionalZip = $this->_directoryData->getCountriesWithOptionalZip();
     if (!in_array($countryId, $optionalZip)) {
         return parent::validateValue($value);
     }
     return true;
 }
示例#3
0
 /**
  * Export attribute value to entity model
  *
  * @param array|string $value
  * @return $this
  */
 public function compactValue($value)
 {
     if (is_array($value)) {
         $value = trim(implode("\n", $value));
     }
     return parent::compactValue($value);
 }