29 $nonMatchingVariants = array();
30 $remainingRecordVariants = array();
32 foreach ($responseSection->
findStructures($this->recordIdentifier, $this->recordField) as $path => $structure) {
33 if (empty($structure) || !is_array($structure)) {
34 $this->sectionFailures[$responseSection->
getIdentifier()] =
'No records found in "' . $path .
'"';
38 $remainingRecords = array();
45 if (empty($nonMatchingValues) && (!$this->strict || empty($remainingRecords))) {
49 if (!empty($nonMatchingValues)) {
50 $nonMatchingVariants[$path] = $nonMatchingValues;
52 if ($this->strict && !empty($remainingRecords)) {
53 $remainingRecordVariants[$path] = $remainingRecords;
59 if (!empty($nonMatchingVariants)) {
60 $failureMessage .=
'Could not assert all values for "' . $this->table .
'.' . $this->field .
'"' . LF;
61 foreach ($nonMatchingVariants as $path => $nonMatchingValues) {
62 $failureMessage .=
' * Not found in "' . $path .
'": ' . implode(
', ', $nonMatchingValues) . LF;
66 if (!empty($remainingRecordVariants)) {
67 $failureMessage .=
'Found remaining records for "' . $this->table .
'.' . $this->field .
'"' . LF;
68 foreach ($remainingRecordVariants as $path => $remainingRecords) {
69 $failureMessage .=
' * Found in "' . $path .
'": ' . implode(
', ', array_keys($remainingRecords)) . LF;
73 $this->sectionFailures[$responseSection->
getIdentifier()] = $failureMessage;
83 return 'structure has record';
getNonMatchingValues(array $records)
getRemainingRecords(array $records)
findStructures($recordIdentifier, $fieldName='')
matchesSection(ResponseSection $responseSection)