/** * @param ResponseSection $responseSection * @return bool */ protected function matchesSection(ResponseSection $responseSection) { $records = $responseSection->getRecords(); if (empty($records) || !is_array($records)) { $this->sectionFailures[$responseSection->getIdentifier()] = 'No records found.'; return FALSE; } $nonMatchingValues = $this->getNonMatchingValues($records); if (!empty($nonMatchingValues)) { $this->sectionFailures[$responseSection->getIdentifier()] = 'Could not assert all values for "' . $this->table . '.' . $this->field . '": ' . implode(', ', $nonMatchingValues); return FALSE; } return TRUE; }
/** * @param ResponseSection $responseSection * @return bool */ protected function matchesSection(ResponseSection $responseSection) { $records = $responseSection->getRecords(); if (empty($records) || !is_array($records)) { $this->sectionFailures[$responseSection->getIdentifier()] = 'No records found.'; return false; } $nonMatchingValues = $this->getNonMatchingValues($records); $matchingValues = array_diff($this->values, $nonMatchingValues); if (!empty($matchingValues)) { $this->sectionFailures[$responseSection->getIdentifier()] = 'Could not assert not having values for "' . $this->table . '.' . $this->field . '": ' . implode(', ', $matchingValues); return false; } return true; }