Skip to content
Snippets Groups Projects
Commit 6e332225 authored by Tyler Antonio's avatar Tyler Antonio
Browse files

Address issues from unit tests

parent 32063a86
No related branches found
No related tags found
No related merge requests found
......@@ -117,7 +117,7 @@ class Metadata
// check attributes is an associative array
if (isset($contact['attributes'])) {
if (empty($contact['attributes']) || empty(array_filter(array_keys($contact['attributes']), 'is_string'))) {
if (empty($contact['attributes']) || !is_array($contact['attributes']) || empty(array_filter(array_keys($contact['attributes']), 'is_string'))) {
throw new \InvalidArgumentException('"attributes" must be an array and cannot be empty.');
}
}
......
......@@ -215,6 +215,7 @@ class MetadataTest extends \PHPUnit_Framework_TestCase
}
$contact['contactType'] = 'technical';
$contact['name'] = 'to_be_removed';
$contact['attributes'] = array('test' => 'testval');
$parsed = Metadata::getContact($contact);
foreach (array_keys($parsed) as $key) {
$this->assertEquals($parsed[$key], $contact[$key]);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment