Skip to content

Commit

Permalink
Merge pull request #5 from LearningLocker/issue/groups
Browse files Browse the repository at this point in the history
Fixes validation for groups.
  • Loading branch information
ryasmi committed Aug 17, 2015
2 parents efe3030 + 72e0031 commit a30a556
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 13 deletions.
6 changes: 3 additions & 3 deletions src/Group.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ protected function identifierError($used_identifiers) {
}

protected function validateIdentifiers($used_identifiers) {
$members = $this->getProp('members') ?: null;
$members = $members !== null ? $members->getValue() : null;
$members = $this->getPropValue('member') ?: null;
$validateIdentifiers = parent::validateIdentifiers($used_identifiers);
return $validateIdentifiers && $members === null;
$validateMembers = $members === null || count($members) === 0;
return $validateIdentifiers && $validateMembers;
}
}
2 changes: 1 addition & 1 deletion src/Members.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php namespace Locker\XApi;

class Members extends Collection {
protected $member_type = 'Locker\XApi\Actor';
protected $member_type = 'Locker\XApi\Agent';
}
27 changes: 18 additions & 9 deletions tests/assets/test.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
{
"actor":{
"mbox":"mailto:test@example.com"
},
"verb":{
"id":"http://adlnet.gov/expapi/verbs/voided"
},
"object":{
"id":"http://kiem.curatr3.com/courses/mentoropleiding"
}
"actor": {
"objectType": "Group",
"account": {
"homePage": "http://myaccount.bmj.com",
"name": "hrl"
},
"member": [
]
},
"verb": {
"id": "http:\/\/adlnet.gov\/expapi\/verbs\/completed",
"display": {
"en-GB": "completed"
}
},
"object": {
"id": "http:\/\/localhost\/moodle\/mod\/quiz\/attempt.php?attempt=48"
}
}

0 comments on commit a30a556

Please sign in to comment.