protected function DraftyTitleTestCase::checkFieldValues in Drafty 7
Checks that the field values and optionally the legacy ones match the given values.
1 call to DraftyTitleTestCase::checkFieldValues()
- DraftyTitleTestCase::testProgrammaticTranslationWorkflow in tests/
DraftyTitleTestCase.test - Tests title module interaction with draft translation creation.
File
- tests/
DraftyTitleTestCase.test, line 212
Class
- DraftyTitleTestCase
- Tests for legacy field replacement.
Code
protected function checkFieldValues($entity, $values, $langcode, $legacy_match = TRUE) {
foreach ($values as $name => $value) {
$field_name = $name . '_field';
if (!empty($entity->{$field_name}[$langcode])) {
$field_value = $entity->{$field_name}[$langcode][0]['value'];
}
else {
return FALSE;
}
if ($field_value != $value) {
debug($field_value);
debug($value);
return FALSE;
}
if ($legacy_match !== ($field_value == $entity->{$name})) {
debug($legacy_match);
debug($field_value);
debug($entity->{$name});
return FALSE;
}
}
return TRUE;
}