protected function ServicesEntityNodeResourceTest::assertNodeProperties in Services Entity API 7.2
Asserts that all properties in the list are the same in both versions of the node.
Parameters
array $a: One version of the node, converted to an array of values.
array $b: The other version of the node, similarly converted.
$keys: The list of properties to compare.
$msg: An assertion message prefix.
1 call to ServicesEntityNodeResourceTest::assertNodeProperties()
- ServicesEntityNodeResourceTest::testCRUD in tests/
services_entity.test - Tests basic CRUD and index actions of a node via the entity_node service.
File
- tests/
services_entity.test, line 984 - Services Entity Tests
Class
- ServicesEntityNodeResourceTest
- Tests entity_node services for both the generic and clean controller.
Code
protected function assertNodeProperties($a, $b, $keys, $msg) {
// List of drupal fields which require text_format processing.
$special_fields = array(
'body',
);
foreach ($keys as $name) {
if (in_array($name, $special_fields)) {
// Clean controller.
if (isset($aprop['format']) && isset($bprop['format'])) {
// Compare the formatted values.
$aprop = check_markup($aprop['value'], $aprop['format']);
$bprop = check_markup($bprop['value'], $bprop['format']);
}
elseif (isset($aprop['und'][0]['format']) && isset($bprop['und'][0]['format'])) {
// Compare the formatted values.
$aprop = check_markup($aprop['und'][0]['value'], $aprop['und'][0]['format']);
$bprop = check_markup($bprop['und'][0]['value'], $bprop['und'][0]['format']);
}
}
else {
$aprop = $a[$name];
$bprop = $b[$name];
}
$this
->assertEqual($aprop, $bprop, "{$msg}: Property {$name} matches");
}
}