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 static function createNew($docType = null) { return parent::createNew($docType === null ? __CLASS__ : $docType); }