public function testLoadAggregateWithDocuments()
 {
     $user = phpillowUserDocument::createNew();
     $user->login = '******';
     $group = phpillowGroupDocument::createNew();
     $group->name = 'users';
     try {
         $group->userDocs = array($user);
         $groupID = $group->save();
         $this->fail('Expected phpillowValidationException.');
     } catch (phpillowValidationException $e) {
         /* Expected */
     }
 }
 public function testCheckRequirements()
 {
     $doc = phpillowGroupDocument::createNew();
     $this->assertSame(array('name'), $doc->checkRequirements());
 }
 public function testDocumentArrayValidatorSpecifiedValid()
 {
     $validator = new phpillowDocumentArrayValidator('phpillowGroupDocument');
     $doc1 = phpillowGroupDocument::createNew();
     $doc1->name = 'Maintainer';
     $doc1->save();
     $doc2 = phpillowGroupDocument::createNew();
     $doc2->name = 'Maintainers';
     $doc2->description = 'The project leaders.';
     $doc2->save();
     $this->assertSame(array('group-maintainer', 'group-maintainers'), $validator->validate(array($doc1, $doc2)));
 }
 public function testDocumentFetchByIdWithTypeMismatch()
 {
     $doc = phpillowUserDocument::createNew();
     $doc->login = '******';
     $doc->save();
     try {
         $group = new phpillowGroupDocument();
         $group->fetchById($doc->_id);
         $this->fail('Expected phpillowResponseNotFoundErrorException.');
     } catch (phpillowResponseNotFoundErrorException $e) {
         /* Expected exception */
     }
 }
 public function generateId()
 {
     return parent::generateId();
 }